Skip to Content
Menú
This question has been flagged
2 Respostes
5967 Vistes

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
Descartar
Autor 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
Descartar
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
Descartar
Related Posts Respostes Vistes Activitat
1
d’ag. 24
1318
1
de març 25
1721
1
de maig 24
2076
1
de nov. 22
4297
1
de jul. 18
5330