Odoo Help


How to make a button visible in odoo

Michael Marroquin
on 11/8/16, 10:59 AM 156 views

Create a new status in quotation, but when I change the quotation in my new status, the confirm sales button disappears.

Add these lines to my view by inheriting from sale.order

<xpath expr="//button[@name='action_confirm']" position="attributes"> <attribute name="visible"> [('state', '=', 'pending')]</attribute> </xpath>

But it does not work.

Ameera PP
On 11/8/16, 10:34 PM

Hi Michael,

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}"/>

Replace it like:

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

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



Techno-Functional Associate with 6+ years of experience in Odoo (formerly known as OpenERP).

On 11/9/16, 1:58 AM

 When states property is added to a button, you cannot use invisible or attrs to control the visibility, because it simply doesn't work, instead try to add convenient property i.e either stick to states or go with attrs, but not both to a button. 

So if want to change the states, then  try this below one

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

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.


Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

1 follower(s)


Asked: 11/8/16, 10:59 AM
Seen: 156 times
Last updated: 11/9/16, 1:58 AM