0
votes

This is my view:

<record id="view_order_form_inherit_sale_stock" model="ir.ui.view">
    <field name="name">sale.management.order.form</field>
    <field name="model">sale.order</field>
    <field name="inherit_id" ref="sale_stock.view_order_form_inherit_sale_stock"/>
    <field name="arch" type="xml">
        <xpath expr="//group[@name='sale_shipping']" position="attributes">
            <attribute name="invisible">1</attribute>
        </xpath>
    </field>
</record>

This is the error:

Odoo Server Error

Traceback (most recent call last):
  File "/opt/odoo/odoo/addons/base/models/ir_ui_view.py", line 394, in _check_xml
    self.postprocess_and_fields(view.model, view_doc, view.id)
  File "/opt/odoo/odoo/addons/base/models/ir_ui_view.py", line 975, in postprocess_and_fields
    fields_def = self.postprocess(model, node, view_id, False, fields)
  File "/opt/odoo/odoo/addons/base/models/ir_ui_view.py", line 905, in postprocess
    fields.update(self.postprocess(model, f, view_id, in_tree_view, model_fields))
  File "/opt/odoo/odoo/addons/base/models/ir_ui_view.py", line 905, in postprocess
    fields.update(self.postprocess(model, f, view_id, in_tree_view, model_fields))
  File "/opt/odoo/odoo/addons/base/models/ir_ui_view.py", line 905, in postprocess
    fields.update(self.postprocess(model, f, view_id, in_tree_view, model_fields))
  [Previous line repeated 1 more time]
  File "/opt/odoo/odoo/addons/base/models/ir_ui_view.py", line 828, in postprocess
    ).postprocess_and_fields(field.comodel_name, f, view_id)
  File "/opt/odoo/odoo/addons/base/models/ir_ui_view.py", line 987, in postprocess_and_fields
    self.raise_view_error(message, view_id)
  File "/opt/odoo/odoo/addons/base/models/ir_ui_view.py", line 614, in raise_view_error
    raise ValueError(message)
ValueError: Veld 'product_uom_category_id' bestaat niet

Fout context:
Weergave`sale.management.order.form`

The field product_uom_category_id is a default one in Odoo 13? It's in the sale & sale_management addon modules

This is their declaration

So yeah, i'm stuck. What i've tried:

  • <xpath expr="//field[@name='product_uom_category_id']" position="replace" /> in the view

  • in another model declaration:

    _inherit = "sale.order.line" product_uom_category_id = fields.Many2one('uom.category')

What i've checked:

  • models/init.py has correct models imported

  • init.py has from . import models

  • manifest.py has correct dependencies

    "depends": [ "base", "sale", "sale_subscription", "sale_management", "sale_stock", "account", "product", "stock", "mail", "sale_stock", "telsmart_invoice_add_order_to_invoice", ],

Should I use the model sale.order.line? It sounds wrong, since the 'base' model is sale.order, but the field appears in sale.order.line which is already in the view

I have no more things to try. Your help is mutch appreciated!

2

2 Answers

0
votes

I was having almost the same issue with a custom inherited view for the helpdesk.tasks model. The problem was in the model name. I included the name of the module at the beginning of the name and it fixed.

<field name="name"><module>.sale.management.order.form</field>

Also, be sure that the inherit_id field is correct.

0
votes

Found after 4 days: It was another Model that used order_line.product_uom_category_id In that model, there was no product_id present. Which is weird, since that model did not inherit from sale.order.line