Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
4 Trả lời
48270 Lượt xem

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



Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

Hi,

You try:

<t t-if="'SUM' in p.name">
    <span>OK</span>
</t>
Ảnh đại diện
Huỷ bỏ
Tác giả

Exactly what I needed! Thanks a lot.

Câu trả lời hay nhất

Would this work (have not tested)?

<div t-if="p.name like '%SUM%'">
<p>bla bla bla</p>
</div>
Ảnh đại diện
Huỷ bỏ
Tác giả

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

Tác giả

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

Bài viết liên quan Trả lời Lượt xem Hoạt động
0
thg 8 16
4297
1
thg 3 15
20791
0
thg 6 24
17
0
thg 2 24
1765
0
thg 6 21
4018