Odoo Help

Welcome!

This community 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.

0

How to hide button in Header

By
Maik Steinfeld
on 8/7/13, 12:47 PM 6,747 views

Hello,

i am trying to hide a button in the header section of a form view:

<field name="arch" type="xml">
            <form string="Collect Order" version="7.0">
            <header>
                <button name="become_interested" states="draft, confirmed" string="Interest" type="object" attrs="{'invisible':[('interested','=',True)]}" class="oe_highlight" />
                <button name="lost_interested" states="draft, confirmed, price, pending" string="Lost Interest" type="object" class="oe_higlhight" attrs="{'invisible': [('interested','=',False)]}" />
                <button name="interest_to_buy" states="pending" string="Order" type="object" class="oe_highlight"/>
                <field name="state" widget="statusbar" nolabel="1" />
            </header>

Under attrs Tag the invisible doesn't work. Does i have a typo or programming error, i don't see?

how about modifying the CSS stylesheet?

Gustavo
on 8/7/13, 3:02 PM

but shouldn't it work this way? i had a look at accounting module, and there are also buttons made invisible this way...

Maik Steinfeld
on 8/7/13, 7:14 PM
5

Atchuthan - Technical Consultant, Sodexis Inc

--Atchuthan - Technical Consultant, Sodexis Inc--
3883
| 5 3 8
Puducherry, India
--Atchuthan - Technical Consultant, Sodexis Inc--
Passionate coder in Python/Odoo(formerly known as OpenERP).

Contact me via GMail: atchuthantu@gmail.com via Skype: atchuthan_skype
via Linkedin: http://in.linkedin.com/in/atchuthantu
Atchuthan - Technical Consultant, Sodexis Inc
On 8/8/13, 2:44 AM

Use either states or attrs:

Your code:

<button name="become_interested" states="draft, confirmed" string="Interest" type="object" attrs="{'invisible':[('interested','=',True)]}" class="oe_highlight" />

Try using this code:

<button name="become_interested" string="Interest" type="object" attrs="{'invisible':['|','|',('interested','=',True),('state','!=','draft'),('state','!=','confirmed')]}" class="oe_highlight" />

will have a try this evening and answer. typo failure: type="object should be closed with " , right?

Maik Steinfeld
on 8/10/13, 6:03 AM

@Steinfeld, just add a double quotation at the end object like type="object"

Atchuthan - Technical Consultant, Sodexis Inc
on 8/12/13, 3:45 AM

Tried and verify with a little modification: <button name="become_interested" string="Interested" type="object" attrs="{'invisible':['|',('interested','=',True),('state','not in',['draft','confirmed'])]}" class="oe_highlight" />

Maik Steinfeld
on 8/16/13, 2:30 PM
2

Anas Taji

--Anas Taji--
2203
| 6 7 8
Amman, Jordan
--Anas Taji--

Skype: anas.taji-sw

Email: anas.taji@smartway-jo.com

Anas Taji
On 8/8/13, 1:00 AM

Try to add invisible="1" to the button you want to hide permanently. .%

1
Vikram
On 8/12/13, 7:40 AM

Hello Maik, I come to same problem for hiding a button in header button, Now i get solution, Here i share you. My scenario is to hide a print button in header when state is draft & sent. So i use attributes tag for this. Again i inherit button print once again. In base module already to 2 lines Please refer below, so i hide that 2 lines for my customized one.

    <button name="print_quotation" position = "attributes" > 
        <attribute name = "invisible">1</attribute>
    </button>

To Hide and Inherit a print button :

<xpath expr="//form/header/button[@name='action_quotation_send']" position="after"> <button name="print_quotation" string="Print" type="object" states="draft" class="oe_highlight" groups="base.group_user" invisible="1"/> <button name="print_quotation" string="Print" type="object" states="sent" groups="base.group_user" invisible="1"/> <button name="print_quotation" string="Print" type="object" class="oe_highlight" attrs="{'invisible': [('state','not in',('manual','progress'))]}" groups="base.group_user"/> </xpath>

I hope you may get some idea.. Thanks for your time

Vikram.V

did you see, that i marked the question as solved?

Maik Steinfeld
on 8/28/13, 10:52 AM

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 community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

0 follower(s)

Stats

Asked: 8/7/13, 12:47 PM
Seen: 6747 times
Last updated: 3/16/15, 8:10 AM