Odoo Help

Welcome!

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

0

xpath errors in customise Qweb Report of odoo-9

By
Logicious
on 12/10/15, 3:38 AM 1,366 views

Hello,

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,

Logicious

 


1

Temur

--Temur--
2894
| 6 5 7
Tbilisi, Georgia
--Temur--
Programmer
Temur
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.

UPDATE:

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.

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

Temur
on 12/10/15, 4:18 AM

Agree, it was very handy

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

Yenthe
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?

Logicious
on 12/10/15, 8:31 AM

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

Pawan
on 1/7/16, 1:11 AM

Logicious,
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

Pawan
on 1/7/16, 1:16 AM

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

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