可见/隐藏布尔字段的域

问题描述 投票:2回答:2

我定义了一个boolean场和两个selection场。

*的.py

type = fields.Selection([('remove','Remove'),('business_task','Task')])
input = fields.Selection([('1','Yes'),('0','No')])
provide = fields.Boolean('Provide?')

如果boolean,我需要看不见的type != 'remove' or 'type != 'task' and input != 1字段

* .XML

我试过下面的代码,但没有运气

<field name="air_ticket" attrs="{'invisible':['|',('type','!=','remove'),('type','!=','business_task'),('input','!=',1)],'readonly':[('state','!=','draft')]}"/>

<field name="air_ticket" attrs="{'invisible':[('type','!=','remove'),'|',('type','!=','business_task'),('input','!=',1)],'readonly':[('state','!=','draft')]}"/>

我怎样才能做到这一点?

编辑根据Cherif我试过下面的代码:

<field name="air_ticket" attrs="{'invisible':['|',('type','!=','remove'),'&amp;',('type','!=','business_task'),('inside_outside','!=',1)],'readonly':[('state','!=','draft')]}"/>

现在的问题是,该领域是完全不可见的。

openerp odoo-10
2个回答
0
投票

对于此域名:

       type ! =  'remove' or ('type != 'task' and input != 1)

用这个

            ['|', ('type', '! =', 'remove), '&',  ('type', '=', 'task'), ('input', '! =', 1)]

希望这对你有所帮助


0
投票

请尝试以下方法:

如果type ='business_task'且输入不是'1',则make field不可见。

attrs="{'invisible':[('type','=','business_task'),('input','!=','1')],'readonly':[('state','!=','draft')]}"
© www.soinside.com 2019 - 2024. All rights reserved.