Odoo Help


invisible elements on button click

Shaumyadeep Chaudhuri
on 10/7/13, 5:48 AM 2,538 views

Hi, I need to make hide some elements on a button click. How can i do that? currently i tried using 2 functional fields and a character field which doesn't seem to work. here is the xml snippet of what i'm trying to hide.

<sheet attrs="{'invisible':[('historical_concept','=','True')]}">.......</sheet>

and here's the python code

def _historical_concept(self,cr,uid,ids,field_name,argus,context):
    for record in self.browse(cr,uid,ids,context):
        if (record.historical_state is not False and record.historical_state == 'concept') or record.state in ['concept']:
    return ret_val

def historical_stage_concept(self,cr,uid,ids,context=None):
    return self.write(cr,uid,ids,{'historical_state':'concept'})

EDIT 1: Button code

<button name="historical_stage_concept" type="object"/>

EDIT 2: _coloumns and _defaults _column is too long so i paste only the relevant part if more is needed please ask.

_columns = {
                                     ('concept', 'Concept'),
                                     ('develop', 'Develop'),
                                     ('market', 'Market'),
                                    'Stage', readonly=True), 
            'historical_concept':fields.function(_historical_concept, type='boolean', method=True, string='Historical Concept'),
            'historical_develop':fields.function(_historical_develop, type='boolean', method=True, string='Historical Develop'),

_defaults = {

What does the button do? can you paste its XML line.

odoo.ma by IBS Group
on 10/7/13, 11:40 AM

The button is just a button at the moment, i tried to make it an object and hence the python code above but that didn't work. My primary goal is making something invisible or visible on the button click but there are more than one buttons and the invisibility or visibility should not be stored to the database. those are the only requirements and doesn't matter how they are implemented

Shaumyadeep Chaudhuri
on 10/7/13, 11:56 AM

Can you paste the _columns declaration of your model.

odoo.ma by IBS Group
on 10/7/13, 11:59 AM

i just pasted what i felt was relevant since the full thing is too long

Shaumyadeep Chaudhuri
on 10/7/13, 12:07 PM

I don't think that this can be done with some python code, you have to write a JS file to do it.

GH Mediacloud, Grover Menacho
on 10/7/13, 12:29 PM

odoo.ma by IBS Group

--odoo.ma by IBS Group--
| 4 5 8
Tétouan, Morocco
--odoo.ma by IBS Group--

For more informations about IBS, please visit our website at www.ibs-na.com.

For a specific questions, collaboration or help, please send us an email to support@ibs-na.com

odoo.ma by IBS Group
On 10/7/13, 1:12 PM

These are the changes you must do :

if record.historical_state == 'concept':


<!-- The quotes are removed -->
<sheet attrs="{'invisible':[('historical_concept','=',True)]}">.......</sheet>

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: 10/7/13, 5:48 AM
Seen: 2538 times
Last updated: 3/16/15, 8:10 AM