Odoo Help


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.


Remove Column (Not Only Data) In View and Template From Sales Order

Irving Carrion
on 8/2/16, 11:56 AM 154 views

We are trying to remove a custom column from the Order Detail screen based on if it contains data.  We have been able to remove the line item data using attrs but not the column itself.  Below is the view we are trying to modify.

<record model="ir.ui.view" id="myid_view_sale_order_form">

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

<field name="model">sale.order</field>

<field name="arch" type="xml">

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

<field invisible="context.get('show_sale')" class="text-left" name="ram_esc1" attrs="{'invisible': [('ram_esc1', '==', 0)]}"/>


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

<field invisible="context.get('show_sale')" class="text-left" name="ram_esc2" attrs="{'invisible': [('ram_esc2', '==', 0)]}"/>


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

<field invisible="context.get('show_sale')" class="text-left" name="ram_esc3" attrs="{'invisible': [('ram_esc2', '==', 0)]}"/>


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

<field invisible="context.get('show_sale')" class="text-left" name="ram_esc4" attrs="{'invisible': [('ram_esc4', '==', 0)]}"/>


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

<field invisible="context.get('show_sale')" class="text-left" name="ram_esc5" attrs="{'invisible': [('ram_esc5', '==', 0)]}"/>




Any help would be much appreciated.




Axel Mendoza

--Axel Mendoza--
| 6 7 8
Camaguey, Cuba
--Axel Mendoza--

DevOps - Full stack - Software Architect - Developer - Technology Integrator

I could help you to develop anything and solve complex problems based on technologies, integrations and tricky stuffs mostly in Python with OpenERP/Odoo, Zato, Django and many others frameworks programming languages and technologies.

I offers consulting services to anyone with an unanswered questions or needs for customizations. Think about it, maybe it's better to have an expert to solve your issues and projects than having a full time employee trying to understand what to do an how

Reach me at aekroft@gmail.com

Axel Mendoza
On 8/2/16, 11:45 PM

The thing is that the way you are doing it it's not correct. You are doing it on the tree field definition attrs and that will cause to display the data or not based on the value of the field and also the domain for attrs it's based on the field value. Try by using directly <field invisible="context.get('show_sale')" without the attrs to hide it if that not work for you then you could think to define hide them using a security group that will cause that the field get removed from the view if you don't have the group assigned

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)


Asked: 8/2/16, 11:56 AM
Seen: 154 times
Last updated: 8/2/16, 11:45 PM