我想使用节点js使用odoo-xml-rpc创建订单。现在写,我首先创建了订单,然后创建了以下网址中提到的订单商品:-https://stackoverflow.com/a/40595869/363661
odoo.execute_kw('pos.order', 'create', params, function (err, value) { //first creating order
if (err) { return console.log(err); }
console.log(value)
var inParams = [];
inParams.push({
'order_id' : value //passing previous executed order_id to order item
})
var params = [];
params.push(inParams);
odoo.execute_kw('pos.order.line', 'create', params, function (err, value) { // then create order item with that order id
if (err) { return console.log(err); }
res.send('order item created')
});
});
这里的逻辑是首先我们创建一个订单,并将该订单ID传递给创建api的订单项。但是这里的问题是,在创建订单时必须添加“ amount_total”,并且在将订单ID附加到订单商品后,订单金额不会更新。我们如何使用api管理订单小计? (我正在使用nodejs xml-rpc)