Odoo Help


two check box

on 12/12/14, 5:08 AM 715 views

hi all,

I have two check box(boolean). If i click one "check box1". second "check box2" should hide and vice verse should happen.

Or if i click "check box1" and if i try to click on "check box2" it should call onchange method/pop-up error message should show. 

How to do this. Please help.

Thanks in advance



| 6 5 7
Lodz, Poland

On 12/12/14, 5:19 AM

<div attrs="{'invisible': [('bbb', '=', True)]}>
    <field name="aaa"/>
<div attrs="{'invisible': [('aaa', '=', True)]}">
    <field name="bbb"/>

Thank you zbik it worked

on 12/12/14, 5:26 AM

Please do not take this as an offence. This is correct and should work perfectly but imho this is not a great solution to the problem, since it only works on the view level. Anyone importing data for example will still be able on the database to set both fields to true. If there is only one value ever valid, then I would suggest going for a list or something similar. This only ever allows you to select 1 of the values.

21south, Ludo - 21South
on 12/12/14, 5:58 AM

thanks ludo i got your point. can we show a pop-up error message when we select another check box. how to write that "onchange" method. please help. thanks

on 12/12/14, 6:17 AM

This link should help you: https://www.odoo.com/forum/help-1/question/raise-an-error-in-odoo-8-70152#answer-70159 You replace def FOO(self) by: def onchange_FOO(self,aaa,bbb) and return result like this: result = {'value': { 'aaa': True, 'bbb': False, }}

on 12/12/14, 6:41 AM

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: 12/12/14, 5:08 AM
Seen: 715 times
Last updated: 3/16/15, 8:10 AM