Hello,
I want to remove product_uom (Unity of Measure) field from the view the above screenshot shows. This view appears when you click on an order line on the sale order view.
I tried to inherit the sale.view_order_line_tree and sale.view_order_line_form views and use xpath to add invisible attribute to this field, but it does not work. Maybe someone could help me because I can't see what I am doing wrong.
This is my xml code:
<record id="uomless_view_order_line_tree" model="ir.ui.view">
<field name="name">sale.order.line.tree</field>
<field name="model">sale.order.line</field>
<field name="inherit_id" ref="sale.view_order_line_tree"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='product_id']">
<attribute name="invisible">True</attribute>
</xpath>
</field>
</record>
<record id="uomless_view_order_line_form2" model="ir.ui.view">
<field name="name">sale.order.line.form2.uomless</field>
<field name="model">sale.order.line</field>
<field name="inherit_id" ref="sale.view_order_line_form2"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='product_id']"
position="attributes">
<attribute name="invisible">True</attribute>
</xpath>
</field>
</record>
(Sorry I can't manage to have well-formed code using the code tag of the forum)