Ridha
Ridha

Reputation: 11

How can we hide a column in an one2many tree view?

Does someone know how we can hide a column in an one2many tree view ?

XML snippet:

 <field name="bom_line_ids" widget="one2many_list">
     <tree string="Components" editable="bottom" > 
        <field name="sequence"    widget="handle"/>
        <field name="usd_cost" attrs="{'invisible' :[('simulation_currency', '!=', False)]}"/>
    </tree>
</field>

The value of the field usd_cost becomes invisible but it still shows the column usd_cost

Upvotes: 1

Views: 2010

Answers (2)

Sargz
Sargz

Reputation: 11

The Attribute attrs doesnt work for onetomany fields,it could only hide the data in column.But this could work if you replace the onetomany field based on condition.Create a similar onetomany field and in its tree view just avoid the field you want to hide.

Upvotes: 1

ChesuCR
ChesuCR

Reputation: 9670

You can't do that. You can only hide the column permanently like this:

<field name="bom_line_ids" widget="one2many_list">
    <tree string="Components" editable="bottom" > 
        <field name="sequence" widget="handle"/>
        <field name="usd_cost" invisible="1" />
    </tree>
</field>

Or you can hide the content of the column in some fields as you have done

Upvotes: 2

Related Questions