コンテンツへスキップ
メニュー
この質問にフラグが付けられました
4 返信
48212 ビュー

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.

関連投稿 返信 ビュー 活動
0
8月 16
4255
1
3月 15
20761
0
6月 24
17
0
2月 24
1722
0
6月 21
3961