La Page PT
La Page PT

Reputation: 621

How to use t-if condition in qweb to detect a field contains a string?

I'm working in Odoo 8.

In a qweb report, does it exist a operator to detect if a field contains a particular string?

Example :

<div t-if="p.name **contains** 'SUM'">
    <p>bla bla bla</p>
</div>

Thanks to help!

Upvotes: 2

Views: 7334

Answers (1)

You can use 'in' operator to check whether field contains a particular string or not.

<div t-if="'SUM' in p.name">
    <p>bla bla bla</p>
</div>

p.name == 'SUM' will check exact name = SUM, to check portion of string in field 'in' operator is useful.

Upvotes: 3

Related Questions