我想检查两个选择字段的值,然后使按钮不可见。我试着这样:
代码
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<record id="orchid_sale_order_cancel_request_inherit" model="ir.ui.view">
<field name="name">sale_order_cancel_request</field>
<field name="model">sale.order</field>
<field name="inherit_id" ref="sale.view_order_form"/>
<field name="arch" type="xml">
<button name="action_cancel" position="after">
<button string="Cancel Request" type="object" name="cancel_request" attrs="{'invisible':['&',('od_dms','!=','sale'),('state','!=','sale')]}"/>
</button>
</field>
</record>
</odoo>
此处od_dms
和state
是两个选择字段。我想仅在action_cancel
= od_dms
和{{sale
时显示按钮state
1}} = sale
答案 0 :(得分:2)
在按钮中,attrs
应为:
attrs="{'invisible':['|',('od_dms','!=','sale'),('state','!=','sale')]}"