Odoo Help


Qweb's comparison expression

on 5/11/15, 6:37 AM 2,649 views


I want to write a simple comparison expression in qweb (if age<16 then do something). But unfortunately, i can't use a smaller symbol "<".

 <t t-if="student.age < 16">
do something .......

Please help!!!

On 5/11/15, 7:00 AM

XML has just five special characters, all they has corresponding codes:

 &lt; (<), &amp; (&), &gt; (>), &quot; ("), and &apos; (').

you've to use &lt; xml code of <, from above list:

<t t-if="student.age &lt; 16">
do something .......

Quite strange though, I can use the normal characters without encoding them. I know its best practice to encode so but still strange that this doesn't work for thavorac.

on 5/11/15, 8:57 AM

maybe it works without encoding in some cases. I tried once to use in odoo domain statement in XML a & symbol as AND operator, it doesn't worked, then reverted back to encoded version: & amp ; and it started working. since I'm using only encoded versions of these 5 characters, to be sure...

on 5/11/15, 9:46 AM

Guess I'll always use encoding from now on then!

on 5/14/15, 12:17 PM

About This Community

This platform 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.


Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

2 follower(s)


Asked: 5/11/15, 6:37 AM
Seen: 2649 times
Last updated: 5/7/17, 8:55 PM