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.


How to emulate radio button using checkboxes in OpenERP7?

on 8/26/14, 4:58 PM 1,296 views

Hi there:

I want to show two options in a form (OpenERP7). User can only select one of the options. I know OpenERP7 doesn't have radio buttons, so I thought I could try using checkboxes (boolean fields). The idea was define an onchange method for a checkbox (i.e. for the boolean field), and in that event I wanted to return the value for the other checkbox (boolean field). I was debugging the onchange event: it never was hit!!

So, how to unmark one checkbox when the other was marked?


Thanks in advance.


Hi Yuly!

In order to emulate radio buttons, an easy way would be to use "attrs" with"readonly" attributes to force select only one of the 2 options.

You can add to your model 2 boolean fields representing the 2 exclusive options then create an inherited form view as follows:

                            <field name="x_option1" attrs="{'readonly': [('x_option2','=', True)]}"/>
                            <field name="x_option2" attrs="{'readonly': [('x_option1','=', True)]}"/>

Now when you try to select an option in the form view, the other one is made readonly and vice-versa.

Hope it helps.


Hi buddy. First, thanks for your solution. It is not exactly what I was looking for, but I like it. I wanted to uncheck the checkbox, not hide it. Thanks for your replay.

on 8/27/14, 12:26 PM

Please try this instead then:

Patrick Kasongo Lukusa (klp)
on 8/27/14, 7:53 PM
On 12/10/15, 6:48 PM

In Odoo 9:

i need create a field like check boxes:

what is your favorite color?  ☐ Blue  ☐Pink  ☐Yellow <--The user only can choice one favorite color, if the user select  ☐Blue then the  ☐Pink or  ☐Yellow field can not be selected, if the user select  ☐Pink, then  ☐Blue or  ☐Yellow can not be selected....

any idea how to create this type of field and function...

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/26/14, 4:58 PM
Seen: 1296 times
Last updated: 12/10/15, 6:48 PM