vbt
vbt

Reputation: 805

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

I want to check the values of two selection field and then make a button invisible.I tried like this :

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>

Here od_dms and state are the two selection fields.I want to make the button action_cancel visible only when both od_dms = sale and state = sale

Upvotes: 1

Views: 302

Answers (1)

Vinh VO
Vinh VO

Reputation: 703

In your button, attrs should be:

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

Upvotes: 2

Related Questions