(Odoo 17)
I have the sale.order
id of an existing order. I want to append some items to it using the external web services API.
I can't seem to get the payload correct.
This is as close as I've gotten.
payload = [
{
'order_id': 1071,
'product_id': 44623,
'name': 'TEST LINE: Product Description',
'product_uom': 1,
'product_uom_qty': 1.0
}
]
so_lines = models.execute_kw(db, uid, password,
'sale.order.line', 'create',
payload
)
When I run this, I get this error message.
xmlrpc.client.Fault: Fault 2: 'Record does not exist or has been deleted.\n(Record: product.product(44623,), User: 377)'
I know for certain that the product matching that ID exists because I just searched for it.
payload = [
[
[
"id",
"=",
"44623"
]
]
]
product = models.execute_kw(db, uid, password,
'product.template', 'search',
payload)
And I get results the same ID back.
Can someone tell me what I'm lacking? Can I create sale.order.line
items with create
or do I have to use update
for a sale.order
?
@Cybrosys, Thanks for the answer. (I'm unable to comment on your answer.) I updated my question with the actual error code (with bad chars stripped). When I try your code verbatim, I get the same result.
Does something need to be true about a product before I can add it as a line item on a sale order?
If I add the product in the web app, when I retrieve the `sale.order.line` data, the `product_id` doesn't match what I retrieved from `product.template`. Is there a different model that sale.order.line items link to?