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

I was trying to implement an if-then-else with q-web span and I realize that: 

<t t-if="company.rpt_rbox_contactinfo" >
  <span t-field="doc.partner_id" t-field-options="...option specs #1..."/>
</t>
<t t-if="not company.rpt_rbox_contactinfo" >
<span t-field="doc.partner_id" t-field-options="...option specs #2..."/>
</t>

was not the same that: (this one doesn't work)

<span t-if="company.rpt_rbox_contactinfo" t-field="doc.partner_id" t-field-options="...option specs #1..."/>
<span t-if="not company.rpt_rbox_contactinfo" t-field="doc.partner_id" t-field-options="...option specs #2..."/>

This works instead:

<span t-if="company.rpt_rbox_contactinfo == true" t-field="doc.partner_id" t-field-options="...option specs #1..."/>
<span t-if="company.rpt_rbox_contactinfo == false" t-field="doc.partner_id" t-field-options="...option specs #2..."/>

Does anybody knows why ?

I'm using v9. Is this also the v8 behaviour ?

According to the section "conditionals" of:

https://www.odoo.com/documentation/9.0/reference/qweb.html

That should be the same.

Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
0
thg 2 24
857
1
thg 3 15
20343
0
thg 6 24
17
4
thg 6 18
47528
1
thg 5 25
558