KbiR
KbiR

Reputation: 4174

How to deal with single quotes in xpath in odoo 15?

I am trying to replace a <t> element using xpath, but it contains a single quote inside the condition. here is what I tried.

      <xpath expr="//t[@t-if='receipt.client and env.pos.company.country and env.pos.company.country.code == 'IN'']" position="replace"/>

How can I do it?

Upvotes: 1

Views: 914

Answers (2)

Ahrimann Steiner
Ahrimann Steiner

Reputation: 1314

Consider using this form instead :

   <xpath expr="//t[@t-if][1]" position="replace"/>

Upvotes: 0

Siddharth Tarpada
Siddharth Tarpada

Reputation: 130

There are two solutions for this.

First :

<xpath expr="//t[@t-if=&quot;receipt.client and env.pos.company.country and env.pos.company.country.code == 'IN'&quot;]" position="replace"/>

Second :

<xpath expr="//t[contains(@t-if,&quot;receipt.client and env.pos.company.country and env.pos.company.country.code == 'IN'&quot;)]" position="replace"/>

Upvotes: 4

Related Questions