Skip to Content
Menu
This question has been flagged
1 Reply
3843 Views

Hi, I have a button in the invoice form view.  I wish to hide it if a condition is meet.  The button is defined as  follows; 







I wish to hide it if the fiscal_position_id is set to NR.   I use odoo 10

Avatar
Discard
Best Answer

Hi,

For hiding a button based on some conditions , first of all we should inherit the view of the button and in its xpath we can provide the attribute tag , inside that we can provide the 'attrs ' condition as given below.
Here i just hiding the confirm button based on some condition.

<xpath expr="//button[@name='action_confirm'][1]" position="attributes">


    <attribute name="attrs">{'invisible': ['|',('is_warning', '=', True),('state', 'not in', ['draft'])]}</attribute>


</xpath>


<xpath expr="//button[@name='action_confirm'][2]" position="attributes">


    <attribute name="attrs">{'invisible': [('state', 'not in', ['sent'])]}</attribute>


</xpath>


Regards

Avatar
Discard