Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
1 Trả lời
30773 Lượt xem

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.

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

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>
Ảnh đại diện
Huỷ bỏ
Tác giả

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

Bài viết liên quan Trả lời Lượt xem Hoạt động
3
thg 4 19
5962
1
thg 3 15
4494
1
thg 10 22
15964
6
thg 4 22
42981
0
thg 3 24
3975