Skip to Content
Menu
This question has been flagged

Hello everybody,


In manufacturing module version 14 in manufacturing order form view in the standard odoo code we have 2 button with the same function but different name, this button visible in some states based on conditions.


I need to set this button invisible in some cases but when i did this, the other button become visible.


When make the second button invisible as the first one button, both of them become visible.



How to remove duplicated buttons without delete some code form the standard ?






Avatar
Discard
Best Answer

You can use this

Multiple condition:

attrs="{'invisible': ['|',('yourfieldscondition1, '=', False),(' yourfieldscondition2', '!=', True)]}"

Ex:

<button name="action_sent_sms" type="object" string="Sent SMS" attrs="{'invisible': ['|',('models', '=', False),('contact_type', '=', True)]}"/>


Single condition:

attrs="{'invisible': [('yourfieldscondition, '=', False)]}"

Ex:

<button name="action_sent_sms" type="object" string="Sent SMS" attrs="{'invisible': [('models', '=', False)]}"/>





Avatar
Discard
Author

Can u explain what models= false do ?

models is the name of my field that I used to make the conditions

Best Answer

Hi loay elhaj,

please check Example in Comment. 

I hope this will help you.

Thanks & Regards,
Email: odoo@aktivsoftware.com
Skype: kalpeshmaheshwari

Avatar
Discard

please check this eg:

if button is defined like this:

<button name="action_confirm" states="draft" string="Confirm Sale" type="object" context="{'show_sale': True}"/>

Inherit like This:

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

or

<button string="Reset to Processing"
name="button_reprocess" type="object"
attrs="{'invisible': [('state', '!=', 'confirm')]}"/>

Related Posts Replies Views Activity
2
Nov 22
3299
4
Dec 23
35087
1
Jun 24
816
2
Jun 24
3001
1
Jan 18
3861