Odoo Help


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.


OpenERP How to make a button invisible on button click event

on 8/23/13, 2:31 AM 2,379 views

In python, I have the following field:

'permit':fields.selection([('new', 'New'),
            ('applied', 'Applied'),
            ('received','Received')], 'Permit', select=True), 

def apply_permit(self, cr, uid, ids, context=None):
        data = {'value': {'permit':'applied'}}
        return data

In XML, I have the following:

 <field name="permit" readonly="True"/>
 <button name="apply_permit" string="Apply" type="action" class="oe_highlight" attrs="{'invisible':[('permit','=','applied')]}" />

The attrs code above doesn't currently work but what I want to do is: when click on the button 'permit' field value will be set to 'applied' and then hide the button.All these done before the form save. The button is inside the form.


AJ Schrafel Paper Corp

--AJ Schrafel Paper Corp--
| 4 5 8
Bronx, United States
--AJ Schrafel Paper Corp--

Exploring OpenERP for business

AJ Schrafel Paper Corp
On 8/23/13, 3:21 AM

Your code just returns the value, which your don't necessarily need to do. You need to write the value to the database.

something like: self.write(cr, uid, ids, {'value': 'applied'}, context=context)

thank you

on 8/23/13, 4:57 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

1 follower(s)


Asked: 8/23/13, 2:31 AM
Seen: 2379 times
Last updated: 3/16/15, 8:10 AM