How to use starts with condtion in qweb xml in odoo

928 Views Asked by At

I would like to check if the variable is starts with the given string in qweb xml in odoo 9

Ex:

<t t-if="'CGST' in taxdetail.name ">
     <t t-esc="taxdetail.name" />
    </t>

 " like method"

<t t-if="'CGST' like '%taxdetail.name%' ">
    <t t-esc="taxdetail.name" />
 </t>

I have tried these methods. but i am getting qweb error meassage. Thanks, Anand.

1

There are 1 best solutions below

2
On

Just try below code

<t t-if="'CGST' == taxdetail.name[:4]" >
  <t t-esc="taxdetail.name" />
</t>