Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why my pdf report is not taking the CSS styles well in Odoo?

I am using Odoo 10 in Ubuntu Server. I am trying to print my quotation report in pdf format using wkhtmltopdf. But the design doesn't look nice. It looks like the CSS is not working

I have tried to change some XML file inside mypath/addons but it doesn't work

Here's my quotation pdf file:

enter image description here

like image 935
Samoox Avatar asked Nov 01 '17 12:11

Samoox


People also ask

What is QWEB report in Odoo?

Qweb is a reporting engine or template engine used by odoo. By using this (qweb) we can create reports in odoo. It uses XML to create design of reports as per your need. We can also say that qweb is XML based reporting engine for OpenERP/Odoo.By using Qweb, we can manipulate the data very easily.

What is Odoo report?

Odoo Qweb Report is also an OpenERP/Odoo XML based reporting engine. It allows us to manipulate data easily by using XML. In Odoo, to render PDFs from the Qweb templates, we used Wkhtmltopdf. Since the templates are defined in HTML format in the previous section, wkhtmltopdf will render the PDF report from Qweb.


2 Answers

1st Possible Reason

If your report doesn't have styles try to add some of these parameters in Settings > Parameters > System parameters:

  • web.base.url: <IP address>:<Port>
  • web.base.url.freeze: True. If this parameter is not used then if the administrator log in Odoo the web.base.url parameter is updated with the current addres that's in the address bar.
  • report.url: <IP address>:<Port>. This should be used if web.base.url parameter is not enough to make it work. Usually this url should be: http://127.0.0.1:8069

2nd Possible Reason

Also it is possible that the package wkhtmltopdf is not well installed or it has not the correct version. Here you can check the release 0.12.5 that works well with Odoo v10 and later versions.

3rd Possible Reason

As it is suggested here, the report contents must be inside this element with that specific class: <div class="page">

like image 72
ChesuCR Avatar answered Oct 19 '22 09:10

ChesuCR


Go to Configurations/Technical/System parameters and add a new parameter :

Key : report.url , Value : http://0.0.0.0:8069

it should be working

like image 1
Yasmine Avatar answered Oct 19 '22 08:10

Yasmine