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>
<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>
<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>
<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>
<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)]}"/>
</xpath>
</field>
</record>
Any help would be much appreciated.
Thanks,
Irving