Odoo Help

Welcome!

This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

0

Remove product_uom from sale.order.line

By
Jean-Marc Dupont
on 2/19/16, 6:03 AM 558 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)


 

0
Jean-Marc Dupont
On 2/19/16, 6:59 AM

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

0

Odoo

--Odoo --
1328
| 5 2 5
kerala, India
--Odoo --

Working as a Odoo Functional and Technical Expert

Odoo
On 2/19/16, 6:18 AM

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"/>

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


Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

Asked: 2/19/16, 6:03 AM
Seen: 558 times
Last updated: 2/19/16, 6:59 AM