Odoo 10 - Qweb t-if t-else syntax

24,251

Solution 1

You have to use <t t-else=""><td>bar</td></t>, take a look the documentation.

Solution 2

In above lines you have closed else tag <t t-else/>

You should write as following :

<t t-if="origin != l.origin">
  <td>foo</td>
</t>
<t t-else="">
  <td>bar</td>
</t>

Solution 3

You also try t-elif :

<t t-if="origin != l.origin">
    <td>foo</td>
</t>
<t t-elif="">
    <td>bar</td>
</t>
Share:
24,251
M.E.
Author by

M.E.

I am a life-long learner and I have been programming computers occasionally since 1987. I use stack overflow to learn and solve doubts, mainly around my job in quantitative finance.

Updated on July 26, 2020

Comments

  • M.E.
    M.E. almost 4 years

    I do not know which is the right syntax for if-else in qweb.

    <t t-if="origin != l.origin">
      <td>foo</td>
    <t t-else/>
      <td>bar</td>
    </t>
    

    What is wrong here?