Odoo Help


xpath errors in customise Qweb Report of odoo-9

on 12/10/15, 3:38 AM 2,293 views


i am working on sale order. i just repace the page of

report_saleorder_document .  and i added my customized page. when i tried to get install that module there are some xpath problems. I trying to digging to find out what was the real problem.at last i find out there are some modules related to sale order report.

1:- module: website_quote using xpath of sale order report -

a)<xpath expr="//div[@class='page']/div[@id='informations']"

b)<xpath expr="//div[@class='page']/p[@id='fiscal_position_remark']"

2:- sale_stock is using

<xpath expr="//div[@name='payment_term']" position="after">

3:- website_sale is using

<xpath expr="//div[@name='total']" position="after">

these are inherit that template ,and using the xpath to adding some extra values. Is there is any way to print my own custom sales order?

thanking you,






| 6 5 7
Tbilisi, Georgia
On 12/10/15, 4:11 AM

Odoo v9  no more supports named attributes of Xpath (like @class='page', etc.). So, you'll need to rewrite Xpath expressions and use equivalent expressions without usage of named attributes.


Try to use indexes, like:

 a)< xpath expr="//div[2]/div[5]", 

( indexes 2 and 5 are indicating position numbers. "//div[2]" should be second div in a parent view, accordingly "//div[2]/div[5]" - fifth child div of the second div in the parent view, etc... adapt it to your case)

Note: I've not tried it in v9, please report back if it'll work.

I still feel bad about the fact that they removed this ability though. It was so handy.

on 12/10/15, 4:14 AM

I have not tried this way, but indexes should still work, for example, instead of named attributes: a) <xpath expr="//div[@class='page']/div[@id='informations']" use indexes: a)< xpath expr="//div[2]/div[5]", of course you'll need to use index numbers adapted to your case.

on 12/10/15, 4:18 AM

Agree, it was very handy

on 12/10/15, 4:19 AM

And not to forget that those indexes are risky. When somewhere along the line you add the same elements again the numbering will remove the incorrect items. So not very stable.

on 12/10/15, 5:49 AM

actuall i given the xpaths inside the base module of website_quote,website_sale,sale_stock. i want to create sale order , its fully customised . if i want to make it, entire page i need to replace , in this situation when i was trying to install the these base module arise the errors" particular xpath can't be located on sale order report" . Is there is any other solution to solve it rahter than create new one?

on 12/10/15, 8:31 AM

excuse for interruption, but this xpath expression do works in odoo 9 too, as i have tried it in one of my template.. ah... that might be exception in my scenario..... but it did worked...

on 1/7/16, 1:11 AM

Please try looking for the path you are giving, does it really exist, you can take the help of HTML inspector for getting the right path, if its a pdf report, then first change the report type to HTML from settings -> Report -> Report, browse to your report and then change type to HTML for debugging, after wards you can make it back to pdf

on 1/7/16, 1:16 AM

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.


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)


Asked: 12/10/15, 3:38 AM
Seen: 2293 times
Last updated: 12/10/15, 4:11 AM