Help

0

New Sale order (XMLRPC)

Avatar
Antoine

Hi,

I can't seem to find any documentation to create a sale order from XML-RPC. This is what I have now :

order = models.execute_kw(db, uid, password, 'sale.order', 'create', [{
'partner_id': 2,
'order_line': [(0, 0, {'product_id':1,'product_uom_qty':2}),
(0, 0, {'product_id':1,'product_uom_qty':2}),
(0, 0, {'product_id':1,'product_uom_qty':2})
]
}])

I don't get any error, printing the order gives me an integer but in Odoo module "Sales" under "Orders" > "Orders", nothing is created...

Thanks for your help!

Avatar
Discard
2 Answers
0
Avatar
Antoine
Best Answer

Hey thanks, for the answer. I don't find any quotation or order. I also tried that but doesn't work either:


order_data = {
'state': 'sale',
'date_order': '2021-04-25',
'user_id': 2,
'partner_id': client_id,
'partner_invoice_id': 1,
'partner_shipping_id': 1,
'picking_policy': 'direct',
'pricelist_id': 1,
'note': 'note',
}

test = models.execute(db, uid, password, 'sale.order', 'create', order_data)
Avatar
Discard
0
Avatar
Paresh Wagh
Best Answer

Hi Antoine: Since you are not setting the state of the Order it is probably getting created as a Quotation. Both Quotation and Sale Order use the same model - sale.order. Go to Sales > Orders > Quotations, clear out the filter and you should see the quotation you created through xmlrpc.

Avatar
Discard