Odoo - Multiple Conditions with OR in attrs

6.6k Views Asked by At

I am trying to create multiple condition in attrs to make a field invisible based on selection of another field

<field name="pickup_date" string="Pick up Datetime" attrs="{'invisible':['|',('metal_movement_type','!=','AC'),('metal_movement_type','!=','IPPU')]}"/>

What i want to do i want to make this field invisible in all case other then user select AC OR IPPU in metal_movement_type selection field. I think i wrote this correct but its not working.

2

There are 2 best solutions below

0
On BEST ANSWER

You can use "in" or "not in" operator for multiple values, for attrs you can write as following :

"attrs"="{'invisible':[('field','not in',(values))]}"

You should try this :

<field name="pickup_date" string="Pick up Datetime" attrs="{'invisible':[('metal_movement_type','not in',('AC','IPPU'))]}"/>
0
On

try it

<field name="pickup_date" string="Pick up Datetime" attrs="{'invisible':[('metal_movement_type','not in',['AC','IPPU'])]}"/>