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.

1

Missing headers in webkit/mako report PDFs

By
Timo Talvitie
on 6/19/13, 9:48 AM 5,399 views

Hello, I'm having a bit of a problem with the webkit reports. When creating the report PDF, the contents show up fine, but the header is missing (just an empty white area fills top of the page).

What makes this interesting is that when I view the HTML version of the report (by switching on the developer mode and going to Settings -> Technical -> Actions -> Reports and enabling the debug mode for the report), the header is visible. So there is some kind of issue that happens when doing the PDF conversion.

The same problem occurs both when viewing a webkit report in my own module and in the sale_order_webkit module. The base_headers_webkit module has been installed, and the wkhtmltopdf library as well

The report is invoked like this:

<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<report id="sale.report_sale_order"
        name="sale.order.webkit"
        auto="False"
        model="sale.order"
        file="sale_order_webkit/report/sale_order.mako"
        string="Quotation - Order"
        webkit_header="base_headers_webkit.base_reports_portrait_header"
        report_type="webkit"/>
</data>
</openerp>

Anyone encountered similar issues? The webkit_header attribute should be valid since it does not throw a ValueError.

Hi ! I've the same issue. What do you mean by "The report is invoked like this:", and where is the report.py file ? The code of Ghanshyam Prajapati have fixed this ? Thanks :)

yann
on 6/21/13, 7:41 AM

Hi, the problem remains also after trying Ghanshyam's suggestions. I'm beginning to think the issue has something to do with my installation or server config, not the python/xml code itself, because for me, the header is missing also in Camptocamp's sale_order_webkit module, and the module apparently works just fine for other people. I will post here what I find when I get the chance to look into the issue in more detail.

Vizucom Oy, Timo Talvitie
on 6/25/13, 7:05 AM
6
Arthur Vuillard
On 7/12/13, 7:18 AM

I've met the same problem. In fact, I was using wkhtmltopdf 0.9.9. An update to 0.11.0 RC1 made it run correctly : both headers and footers !

This did the trick! Many thanks, the version I had pulled with apt-get was indeed 0.9.9, and 0.11.0 RC1 seems to work flawlessly. Just a note to anyone who might have the same problem: when you download the wkhtmltopdf tarball, after extracting it you will also need to tell OpenErp where it can find the executable. This is done from settings -> parameters -> system parameters. Add a new line with "webkit_path" as key, and the executable location as value.

Vizucom Oy, Timo Talvitie
on 7/12/13, 10:00 AM

It still doesn't work for me. I tried 0.9.9, 0.11.0 RC1, and 0.11.2, and my headers are still blank. The module of interest is sale_order_webkit from Serpent CS, and a few custom reports I created. All exhibit the same behaviour. Playing with paper sizes and margins work, but the content remains empty.

Alexandre Boily
on 12/27/13, 10:53 AM
1

Ghanshyam Prajapati

--Ghanshyam Prajapati--
1377
| 4 4 8
Pune, India
--Ghanshyam Prajapati--
OpenERP Developer
Ghanshyam Prajapati
On 6/19/13, 10:46 AM

Try Following code,

    <record id="sale.report_sale_order" model="ir.actions.report.xml">
        <field name="report_type">webkit</field>
        <field name="report_name">sale.order.webkit</field>
        <field eval="0" name="multi"/>
        <field eval="0" name="auto"/>
        <field eval="1" name="header"/>
        <field eval="1" name="menu"/>
        <field name="model">sale.order</field>
        <field name="type">ir.actions.report.xml</field>
        <field name="name">Quotation - Order</field>
        <field name="report_rml">sale_order_webkit/report/sale_order.mako</field>
        <field name="report_file">sale_order_webkit/report/sale_order.mako</field>
        <field name="webkit_header" ref="base_headers_webkit.base_reports_portrait_header"/>
    </record>

and in your report.py file,

report_sxw.report_sxw('report.sale.order.webkit', 'sale.order', 'sale_order_webkit/report/sale_order.mako', parser=sale_order_webkit_report, header="external")

Hope it work for you,

Thank you for the reply, but the problem seems to be the same also with this code, i.e. the HTML headers work fine but the PDF headers do not.

Vizucom Oy, Timo Talvitie
on 6/19/13, 11:12 AM

PDF headers means..???

Ghanshyam Prajapati
on 6/19/13, 11:15 AM

I mean the header (company name, email, phone etc) is visible in the HTML output produced by the debug mode, but not visible in the PDF output.

Vizucom Oy, Timo Talvitie
on 6/19/13, 11:24 AM

Please see my updated answer.

Ghanshyam Prajapati
on 6/19/13, 11:34 AM
1
Anand
On 12/2/14, 1:34 AM

Me too faced the problem... 

Just and upgrade and changing the path is system parameter works good for me...

try it,...

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: 6/19/13, 9:48 AM
Seen: 5399 times
Last updated: 3/16/15, 8:10 AM