Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
4 ตอบกลับ
48192 มุมมอง

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



อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

Hi,

You try:

<t t-if="'SUM' in p.name">
    <span>OK</span>
</t>
อวตาร
ละทิ้ง
ผู้เขียน

Exactly what I needed! Thanks a lot.

คำตอบที่ดีที่สุด

Would this work (have not tested)?

<div t-if="p.name like '%SUM%'">
<p>bla bla bla</p>
</div>
อวตาร
ละทิ้ง
ผู้เขียน

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

ผู้เขียน

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

Related Posts ตอบกลับ มุมมอง กิจกรรม
0
ส.ค. 16
4240
1
มี.ค. 15
20754
0
มิ.ย. 24
17
0
ก.พ. 24
1710
0
มิ.ย. 21
3940