Skip to Content
Menu
This question has been flagged

At random times, the qweb report  header content is shown blank. 

Even after trying out various options like adding report.url and other general solutions, it still gave the same blank header at frequent times. 

After doing an extensive code walk through we found that report header is loading below java script through the file report_templates.xml.

function subst() {...} 

Further debugging lead us to the ir_actions_report.py where it controls the addition of this script in the header and footer html. 

header = layout._render(dict(subst=True, body=lxml.html.tostring(header_node), base_url=base_url))

We gave this subst=False in order not to generate the java script content and it did not load the script as expected. 

How ever the issue still persisted and it gave us the though that, it is indeed the java script loading issue at wkhtmltopdf module. 

So we went through the wkhtmltopdf documentation and identified that there is a parameter '--javascript-delay' which can be used to control the loading of javascript.

Hence we added below line of code in ir_action_report.py file  to add this parameter to the wkhtml argument list. 

command_args.extend(['--javascript-delay', str(1000)])

This gave us the perfect solution for this issue. 

But we are curious to know why odoo load the above java script in the report html as it simply take the back up of the header text and append it back. 

Please let me know if any alternative solution for this issue. 

Avatar
Discard

Try posting the same in odoo github for better response and discussion: https://github.com/odoo/odoo/issues

Related Posts Replies Views Activity
2
Jun 22
6780
0
Jun 15
7206
7
Feb 19
5356
1
Feb 24
1825
1
Jul 23
10053