Search code examples
pythonodoo

Getting "Record does not exist or has been deleted " error when trying to add service product in sales order line via APIs


I am using Odoos APIs as per the documentation: https://www.odoo.com/documentation/13.0/webservices/odoo.html

When trying to add a service product into a sales order line, I'm getting the error:

xmlrpc.client.Fault: <Fault 2: "('Record does not exist or has been deleted.\\n(Record: product.product(14589,), User: 2)', None)">

This is only happening when I'm trying to add a newly created service product. But when adding old service products that already existed before we migrated to Odoo 13, it works fine.

I'm adding the service product order line as follows:

order_line_id = models.execute_kw(db, uid, password, 'sale.order.line', 'create', [{
'order_id':sales_order_id
,'product_id':odoo_product_id
,'name': product_sku
,'price_unit':product_price
,'product_uom_qty':product_quantity
,'state':'sale'
,'qty_delivered_method': 'manual'
,'customer_lead': 0.0
,'invoice_status':'no'
,'product_type': 'service'
}])

Does anyone know what might be causing this?


Solution

  • Make sure you are using product.product instead of product.template, that is a common mistake.