Se rendre au contenu
Menu
Cette question a été signalée
4 Réponses
48187 Vues

Hello there,

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!


EDIT #1

After the tip of mister Ray Carnes, I have try this one. No success. Syntax error.

                            <tr t-foreach="get_payslip_lines(o.line_ids)" t-as="p">
<td t-if="p.name like '%SUM%'">
<span>IT WORKS!!!!</span>
</td>
    
.......



Avatar
Ignorer
Meilleure réponse

Hi,

You try:

<t t-if="'SUM' in p.name">
    <span>OK</span>
</t>
Avatar
Ignorer
Auteur

Exactly what I needed! Thanks a lot.

Meilleure réponse

Would this work (have not tested)?

<div t-if="p.name like '%SUM%'">
<p>bla bla bla</p>
</div>
Avatar
Ignorer
Auteur

I test it right now. I come back soon. Thanks a lot.

Auteur

It doesn't seem to work. It is not the first time I meet this problem with t-if in qweb.

Publications associées Réponses Vues Activité
0
août 16
4240
1
mars 15
20754
0
juin 24
17
0
févr. 24
1710
0
juin 21
3940