Zum Inhalt springen
Menü
Sie müssen registriert sein, um mit der Community zu interagieren.
Diese Frage wurde gekennzeichnet
2 Antworten
6316 Ansichten

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
Verwerfen
Autor Beste Antwort

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
Verwerfen
Beste Antwort

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
Verwerfen
Verknüpfte Beiträge Antworten Ansichten Aktivität
1
Aug. 24
1603
1
März 25
2012
1
Mai 24
2275
1
Nov. 22
4599
1
Juli 18
5576