使用超过2个参数或使用!=隐藏的attrs

时间:2013-04-09 09:39:24

标签: python xml openerp

这是我的源代码和 当我从选择框中选择!=银行值时,我需要知道隐藏 bank_id 字段? 我试过

attrs="{'invisible': [('special_deduction_type', '!=', 'bank')]}"

也适用于所有字段。但是,布局中显示了许多2个字段。请参阅图像

![<page string="Special Deductions">
<field name='special_deduction_ids' nolabel='1'>
<tree string='List' editable='bottom'>
<field name='deduction_id' invisible="1" />
<field name='special_deduction_type' />
<field name='bank_id'
attrs="{'invisible': \[('special_deduction_type', '=', 'bank')\]}" />
<field name='union_id'
attrs="{'invisible': \[('special_deduction_type', '=', 'union')\]}" />
<field name='insurance_id'
attrs="{'invisible': \[('special_deduction_type', '=', 'insurance')\]}" />
<field name='loan_id'
attrs="{'invisible': \[('special_deduction_type', '=', 'loan')\]}" />
</tree>
</field>]

enter image description here

1 个答案:

答案 0 :(得分:0)

<page string="Special Deductions">
<field name='special_deduction_ids' nolabel='1'>
<tree string='List' editable='bottom'>
<field name='deduction_id' invisible="1" />
<field name='special_deduction_type' />
<field name='bank_id'
attrs="{'invisible': [('special_deduction_type','in',('loan','union','insurance'))]}"/>
<field name='union_id'
attrs="{'invisible': [('special_deduction_type','in',('bank','loan','insurance'))]}"/>
<field name='insurance_id'
attrs="{'invisible': [('special_deduction_type','in',('loan','union','bank'))]}"/>
<field name='loan_id'
attrs="{'invisible': [('special_deduction_type','in',('bank','union','insurance'))]}"/>

</tree>
</field>
<br />
<br />
</page>