跳至內容
選單
此問題已被標幟
1 回覆
30704 瀏覽次數

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.

頭像
捨棄
最佳答案

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>
頭像
捨棄
作者

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

相關帖文 回覆 瀏覽次數 活動
3
4月 19
5902
1
3月 15
4462
1
10月 22
15901
6
4月 22
42862
0
3月 24
3893