Odoo Help

Welcome!

This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

0

Q-Web t-if expression doesn't match the same in "t" and "span" elements

By
Yurdik Cervantes Mendoza
on 8/10/16, 9:12 AM 196 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.

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

Asked: 8/10/16, 9:12 AM
Seen: 196 times
Last updated: 8/10/16, 9:33 AM