Odoo Help


How to make Readonly Button?

on 5/27/15, 9:25 AM 1,018 views

hi ,

How to make readonly button based on condition?

I have two Button

  • Button 1

  • Button 2

 and my condition is if database filed text is "po" then allow Button 1 and filed text "os" then Button 2.

How to apply condition on button based on Database field.

hi Temur,

I already did this step attrs="{'readonly': [('field_name','=','po')]}".

it's not working dear.

on 5/29/15, 1:17 AM
On 6/4/15, 1:46 AM

it's not work attrs="{'readonly': [('field_name','=','po')]}" or

attrs="{'readonly': [('field_name','=','so')]}".

My button code line is

<button name="button1" states="approve" string="Button 1" type="object" attrs="{'readonly': [('field_name','=','po')]}" icon="gtk-ok" /> 

I am using openerp v5.

Kinner Vachhani
On 5/28/15, 10:09 AM

Best to make button invisible rather than readonly. It will save space on your view and look more user friendly. 

On 5/27/15, 10:16 AM

add to "Button 2" in xml:

attrs="{'readonly': [('field_name','=','po')]}" 

similar for "Button 1"

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

0 follower(s)


Asked: 5/27/15, 9:25 AM
Seen: 1018 times
Last updated: 8/17/15, 6:25 AM