我想检查两个选择字段的值,然后使按钮不可见

I want to check the values of two selection field and then make a button invisible

我想检查两个选择字段的值,然后制作一个按钮 invisible.I 试过这样:

Code

<?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':['&amp;',('od_dms','!=','sale'),('state','!=','sale')]}"/>
             </button>
        </field>
    </record>
</odoo>

这里od_dmsstate是两个选择fields.I想让按钮action_cancel只有在od_dms=[=15=时才可见] 和 state = sale

在您的按钮中,attrs 应该是:

attrs="{'invisible':['|',('od_dms','!=','sale'),('state','!=','sale')]}"