Skip ke Konten
Menu
Pertanyaan ini telah diberikan tanda
4 Replies
48412 Tampilan

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
Buang
Jawaban Terbai

Hi,

You try:

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

Exactly what I needed! Thanks a lot.

Jawaban Terbai

Would this work (have not tested)?

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

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

Penulis

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

Post Terkait Replies Tampilan Aktivitas
0
Agu 16
4396
1
Mar 15
20908
0
Jun 24
17
0
Feb 24
1834
0
Jun 21
4122