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

Hello. I'm trying to understand how to get a record.some_model_field defined in QWeb template.

If I do something like this:

<t t-if="record.bolean_field.raw_value == true">

    <!-- Other Fields -->

</t>

I get "TypeError: ctx.record.boolen_field is undefined" since it is not loaded in the context.

But this will work.

<field name="bolean_field" invisible="1"/>

<t t-if="record.bolean_field.raw_value == true">

    <!-- Other Fields -->

</t>

To me this seams like a hacky solution. 
I don't need to show the field to the user. I only use it to decide whether to show other fields. Is there a better or "correct" way to achieve this?

Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
0
thg 4 24
2985
1
thg 8 23
6017
1
thg 6 23
4659
1
thg 6 23
2618
0
thg 4 23
103