Passa al contenuto
Menu
È necessario essere registrati per interagire con la community.
La domanda è stata contrassegnata
1 Rispondi
30718 Visualizzazioni

I don't understand, why I can't use boolean field to hide/show another field. If I try this:

<field name="my_field"

attrs="{'invisible': [('boolean_field','=','False')]}"
 />

Nothing happens. I can check boolean field and uncheck, , 'my_field' do not disappear.

But if try for example this:

<field name="my_field"

attrs="{'invisible': [('selection_field','=','2')]}"
 />

Then hide/show functionality of 'my_field' works fine. It disappears when I choose selection '2', and appears otherwise. I both selection and boolean fields from standard modules and from my modules. At both scenarios, if I use any selection field, it works, if I use boolean field, it does not.

Avatar
Abbandona
Risposta migliore

You are comparing the value of boolean_field to the string 'False' which it will never be.

Do this instead:

<field name="my_field"
    attrs="{'invisible': [('boolean_field','=',False)]}"
</field>
Avatar
Abbandona
Autore

Thanks. I don't know how I didn't see that :)

Post correlati Risposte Visualizzazioni Attività
3
apr 19
5904
1
mar 15
4463
1
ott 22
15913
6
apr 22
42869
0
mar 24
3904