1

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.

Ancient
  • 3,007
  • 14
  • 55
  • 104
  • your answer is correct, please check if 'AC; and 'IPPO' are the correct key of selection field. (ex:field.selection([('key','value1').....],string='')),check if in your condition you are given the key not the value. – S T Mohammed Jun 16 '17 at 23:19

2 Answers2

5

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'))]}"/>
1

try it

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