Skip to Content
Menú
This question has been flagged
4 Respostes
48233 Vistes

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
Descartar
Best Answer

Hi,

You try:

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

Exactly what I needed! Thanks a lot.

Best Answer

Would this work (have not tested)?

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

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

Autor

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

Related Posts Respostes Vistes Activitat
0
d’ag. 16
4271
1
de març 15
20768
0
de juny 24
17
0
de febr. 24
1740
0
de juny 21
3985