Skip to Content
Menu
This question has been flagged
3853 Zobrazenia

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.

Avatar
Zrušiť
Related Posts Replies Zobrazenia Aktivita
0
feb 24
977
1
mar 15
20391
0
jún 24
17
4
jún 18
47615
1
máj 25
672