TypeError:product.product(3,)不是JSON可序列化的

时间:2018-01-17 14:30:10

标签: python odoo

我现在对这段代码有很多问题。这是我的功能:

import express from "express";
const router = express.Router();

/*router.get("/", (req,res,next) => {
  res.send("download");
});*/
router.get("/:filename", (req,res,next) =>{
  console.log(req.params.filename);

});

export default router;

当我打印报告时出现此错误:

def _get_invoice_lines(self):
    self.cr.execute("SELECT inv.number,l.price_subtotal_taxed,l.name,inv.maitre_ouvrage,m.type_paiement,m.ref,m.date 
        FROM product_product p,account_invoice inv, account_invoice_line l,account_move ml
        where p.id = l.product_id
        and inv.id= l.invoice_id
        and ml.invoice_id=inv.id
        and ml.type_paiement is not null
        and inv.journal_id = 1
        and ml.type_paiement = '%s'
        and  inv.date_invoice =DATE '%s'
        and  p.id = %d "%(self.datas['type_paiement'],self.datas['date_invoice'],self.datas['product_id'].id))
    return self.cr.fetchall()

1 个答案:

答案 0 :(得分:0)

看来你l.product_id完全是产品对象而你只需要id。

您是否测试过 l.product_id.id

你可能会遇到与inv.id = l.invoice_id相同的错误。同样的解决方案!