且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何使用xml-rpc在Odoo中将产品添加到采购订单中?

更新时间:2021-11-03 22:28:43

创建您的采购订单.然后创建采购订单行,并为其提供新创建的采购订单的order_id.

Create your purchase order. Then create the purchase order lines and give them an order_id of your newly created purchase order.

new_order = models.execute_kw(db, uid, password, 'purchase.order','create', [{'partner_id':VENDOR_ID_soucastky,'product_uom':1, 'bom_id':product.odoo_id, 'product_qty': 1.0}],)

order_line = models.execute_kw(db, uid, password, 'purchase.order.line', 'create', [{ 'name': 'NAME TEXT','product_qty': 1, date_planned': ....... 'order_id': new_order}])

您将必须为new_orderorder_line记录确定适当的值.根据需要重复order_line.

You will have to determine the appropriate values for your new_order and order_line record. Repeat the order_line as necessary.