This question has been flagged
1 Reply
3583 Views

When I try to confirm a sale order through the UI, I get the following validation error:

The operation cannot be completed, probably due to the following:
- deletion: you may be trying to delete a record while other records still reference it- creation/update: a mandatory field is not correctly set
[object with reference: Product Template - product.template]

I am simply creating a basic sales order by selecting a few products and saving it, then clicking "Confirm Sale", but I keep getting the error. Does anybody know why this would be occurring?

I am working on what is basically a fresh Odoo 10 install with only a few modications. I created a custom view that inherits from sale.order.form.sale.stock and the content is:

<?xml version="1.0"?>

<data>

<xpath expr="//field[@name='order_line']/tree/field[@name='route_id']" position="before">

<field name="x_all_route_ids" invisible="1"/>

</xpath>

<xpath expr="//field[@name='order_line']/tree/field[@name='route_id']" position="attributes">

<attribute name="attrs">{'readonly': [('product_id', '=', False)]}</attribute>

<attribute name="domain">[('id', 'in', x_all_route_ids[0][2])]</attribute>

</xpath></data>

However, even when this view is inactive, the error still occurs, so I don't believe it is causing the issue.


Avatar
Discard
Best Answer

Unfortunately, these kinds of errors are very hard to trace. My best suggestion is to temporarily show all attributes on the form to see if any required fields are not set.


My preferred way to disable this is with Chrome's Developer Tools.

Simply inspect the page and search ("ctrl+f") for an element with the class named "o_form_invisible" or "oe_form_invisible".

Click the element and "uncheck" the "display: none" attribute in the CSS panel.


This will show all fields which would otherwise be hidden. Once you refresh the browser window, the fields will be hidden normally again.


I suggest doing this on both the sale.order.form.sale.stock form and on the product template form. 

Avatar
Discard