How do I add products to purchase order in Odoo using xml-rpc?

廉价感情. 提交于 2020-01-14 03:57:06

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!