Reputation: 26768
I have one2many
field with one2many_list tag
, and I want to hide qty
field which is not needed if I choose for example service
.
I have this code in my view:
<field name='type'/>
<field name="products" nolabel="1" widget="one2many_list">
<tree editable="bottom" >
<field name='description'/>
<field name='qty'/>
<field name='total'/>
</tree>
</field>
How can i do that using type
field?
Upvotes: 0
Views: 146
Reputation: 702
You probably want to use the attr
tag.
attrs="{'invisible': [('type','=','service')]}"
this will hide the field when the chosen type equals service
Since the field isn't on the same model you could create a functional field on the model of the one2many field where you check if you need to hide the qty field or not
Upvotes: 1