Skip to Content
Menu
This question has been flagged
3322 Views

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
Discard
Related Posts Replies Views Activity
0
Feb 24
311
1
Mar 15
19743
0
Jun 24
16
4
Jun 18
45641
0
Oct 24
117