Skip to Content
Menu
This question has been flagged
3 Replies
6269 Views
 

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)


 

Avatar
Discard
Best Answer

Hi,

deleting the product_uom is definitively neither a good idea nor correct. Because the onchange method use the UOM in this view to compute prices, you MUSTN'T delete this field.

Yet you could hide it easily with something like :

<xpath expr="//field[@name='ur_field']" position="attributes">

<attribute name="invisible">1</attribute>

</xpath>

Avatar
Discard
Author Best Answer

I put the screenshot. Still not working using xpath. I don't know what to do.

Avatar
Discard
Best Answer

Simply use xpath ,I didnt see any screen shot here.


<xpath expr="//field[@name='ur_field']" position="replace">

</xpath>

Please check the below tag is correct or not from your code?

<field name="inherit_id" ref="sale.view_order_line_form2"/>

--------------------


Avatar
Discard