Skip to Content
Menu
This question has been flagged
1 Reply
1446 Views

 I'm really struggling with help getting Sales Orders into Odoo.

To successfully insert a sales Order via XML-RPAS, Odoo requires:

  • partner_id

  • partner_shipping_id

If I set these both to the value of child_ids/id (4328) it works, but the sales order is created for a contact on the company rather than the company.

If I use the actual partner_id (ES062) it fails with the following error:

Traceback (most recent call last): File "/home/odoo/src/odoo/saas-14/odoo/service/wsgi_server.py", line 56, in xmlrpc_return result = odoo.http.dispatch_rpc(service, method, params) File "/home/odoo/src/odoo/saas-14/odoo/http.py", line 118, in dispatch_rpc result = dispatch(method, params) File "/home/odoo/src/odoo/saas-14/odoo/service/model.py", line 38, in dispatch res = fn(db, uid, *params) File "/home/odoo/src/odoo/saas-14/odoo/service/model.py", line 157, in execute_kw return execute(db, uid, obj, method, *args, **kw or {}) File "/home/odoo/src/odoo/saas-14/odoo/service/model.py", line 143, in wrapper raise ValidationError(msg) ValidationError: ('The operation cannot be completed, probably due to the following:\n- deletion: you may be trying to delete a record while other records still reference it\n- creation/update: a mandatory field is not correctly set\n\n[object with reference: partner_id - partner.id]', None)

Why can't the partner_id be used? If I export the company I am trying to create the order for I get the following values:

id = ES062
child_ids/id = __export__.res_partner_4328

I really am struggling here. Please help.

 



Avatar
Discard
Best Answer

partner_id is a Many2one field which must be an integer as it represents a corresponding id from the related table (the table in question is res.partner). I am not sure about how exporting strings generation works but I am absolutely positive that an id must be an integer in the DB under SQL constraints (primary key) so my guess is that it is just 62 instead of ES062.

Thanks

Avatar
Discard