Odoo Help

0

How to use t-if condition in qweb to detect a field contains a string?

By
Pascal Tremblay
on 8/9/16, 10:10 PM 1,630 views

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



2
Vo Tri
On 8/10/16, 2:59 AM

Hi,

You try:

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

Exactly what I needed! Thanks a lot.

Pascal Tremblay
on 8/10/16, 8:44 AM
0

Ray Carnes

--Ray Carnes--
16818
| 9 7 9
Atlanta, United States
--Ray Carnes--

Senior Odoo Analyst

OpenERP 6.1, 7.0; Odoo 8.0, 9.0, 10.0.

Completed Odoo Functional and Technical Training.

Major Skills:

  • User Needs and GAP Analysis;

  • Functional and Technical Design;

  • Prototyping and Proof of Concepts;

  • Requirements Specifications;

  • Agile Implementation;

  • Data Migration;

  • Configuration & Customization (UI and code);

  • Integration - Odoo and non Odoo Applications and Services;

  • Training and Knowledge Transfer;

  • Go Live Support;

  • Helpdesk;

  • Version Upgrades and Migration.

  • Accounting Expert.

I have over 20 years of experience empowering and enabling users with enterprise information systems that make a real and measurable difference in their ability to proactively manage their businesses and organizations. 

I am a skilled Communicator and I only take the serious things seriously!

Ray Carnes
On 8/9/16, 11:40 PM

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.

Pascal Tremblay
on 8/9/16, 11:41 PM

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

Pascal Tremblay
on 8/9/16, 11:50 PM

About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

Register

Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

1 follower(s)

Stats

Asked: 8/9/16, 10:10 PM
Seen: 1630 times
Last updated: 8/10/16, 8:44 AM