Odoo - 在 attrs 中使用 OR 的多个条件
Odoo - Multiple Conditions with OR in attrs
我正在尝试在 attrs 中创建多个条件,以根据 select另一个字段的离子
使一个字段不可见
<field name="pickup_date" string="Pick up Datetime" attrs="{'invisible':['|',('metal_movement_type','!=','AC'),('metal_movement_type','!=','IPPU')]}"/>
我想做什么 我想让这个字段在所有情况下都不可见,除了 select AC OR IPPU
在 metal_movement_type
selection 字段中。我想我写的是正确的,但它不起作用。
您可以使用 "in" 或 "not in" 运算符来表示多个值,对于属性,您可以这样写:
"attrs"="{'invisible':[('field','not in',(values))]}"
你应该试试这个:
<field name="pickup_date" string="Pick up Datetime" attrs="{'invisible':[('metal_movement_type','not in',('AC','IPPU'))]}"/>
试一试
<field name="pickup_date" string="Pick up Datetime" attrs="{'invisible':[('metal_movement_type','not in',['AC','IPPU'])]}"/>
我正在尝试在 attrs 中创建多个条件,以根据 select另一个字段的离子
使一个字段不可见<field name="pickup_date" string="Pick up Datetime" attrs="{'invisible':['|',('metal_movement_type','!=','AC'),('metal_movement_type','!=','IPPU')]}"/>
我想做什么 我想让这个字段在所有情况下都不可见,除了 select AC OR IPPU
在 metal_movement_type
selection 字段中。我想我写的是正确的,但它不起作用。
您可以使用 "in" 或 "not in" 运算符来表示多个值,对于属性,您可以这样写:
"attrs"="{'invisible':[('field','not in',(values))]}"
你应该试试这个:
<field name="pickup_date" string="Pick up Datetime" attrs="{'invisible':[('metal_movement_type','not in',('AC','IPPU'))]}"/>
试一试
<field name="pickup_date" string="Pick up Datetime" attrs="{'invisible':[('metal_movement_type','not in',['AC','IPPU'])]}"/>