Odoo Help

Welcome!

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.

0

two check box

By
supreeth
on 12/12/14, 5:08 AM 447 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

1

zbik

--zbik--
5951
| 6 4 7
Lodz, Poland
--zbik--


zbik
On 12/12/14, 5:19 AM

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

Thank you zbik it worked

supreeth
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.

Ludo - Neobis
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

supreeth
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, }}

zbik
on 12/12/14, 6:41 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)

Stats

Asked: 12/12/14, 5:08 AM
Seen: 447 times
Last updated: 3/16/15, 8:10 AM