Skip to Content
Menu
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
To pytanie dostało ostrzeżenie
4 Odpowiedzi
48206 Widoki

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



Awatar
Odrzuć
Najlepsza odpowiedź

Hi,

You try:

<t t-if="'SUM' in p.name">
    <span>OK</span>
</t>
Awatar
Odrzuć
Autor

Exactly what I needed! Thanks a lot.

Najlepsza odpowiedź

Would this work (have not tested)?

<div t-if="p.name like '%SUM%'">
<p>bla bla bla</p>
</div>
Awatar
Odrzuć
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.

Powiązane posty Odpowiedzi Widoki Czynność
0
sie 16
4252
1
mar 15
20759
0
cze 24
17
0
lut 24
1715
0
cze 21
3957