odoo hide field标签

odoo hide field标签

使用invisible来hide fields标签内容

<field name="per" invisible="1"/> // 不显示

<field name="bili" invisible="0"/> // 显示

// Model

per = fields.Integer()

jiabili = fields.Integer()

yibili = fields.Integer()

summary = fields.Selection([

(True,'Token calculation for each transaction'),

(False,'Account Division')],default=True)

// xml

<field name="summary" widget="radio"/>

<field name="per" attrs="{'invisible': [('summary','!=', False)]}"/>

<field name="jiabili" attrs="{'invisible': [('summary','!=', True)]}"/>

<field name="yibili" attrs="{'invisible': [('summary','!=', True)]}"/>