问题
Im creating the 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}],)
and then I need to add the products but I can't find how
odoo v9 P.S. I need to use the webservice API as I don't have aces to change the code on server
回答1:
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}])
You will have to determine the appropriate values for your new_order
and order_line
record. Repeat the order_line
as necessary.
来源:https://stackoverflow.com/questions/40594637/how-do-i-add-products-to-purchase-order-in-odoo-using-xml-rpc