8

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

ChesuCR
  • 9,352
  • 5
  • 51
  • 114
Samoox
  • 176
  • 1
  • 2
  • 9
  • In solution of your case either you have to create a custom template and design like what you want or else you have to find from where this report is getting printed and only edit that xml file. – Keval Mehta Nov 02 '17 at 04:32
  • thank you @KevalMehta , if you can help me where do i put my new custom design because that's the probleme i didn't find until now the file where this report is printed – Samoox Nov 02 '17 at 10:31
  • By clicking on which button this reprot is generated ? Means from which model's tree/form view this reported is generated ? – Keval Mehta Nov 02 '17 at 10:43
  • @KevalMehta it's from print button in sales => quotation module – Samoox Nov 08 '17 at 16:40
  • Have you solved this @Samoox? It seems that the application is not taking the CSS styles. Is this happening only to your custom report (maybe you didn't use the correct layout) or to any other report (maybe you need to specify the `report.url` or the `web.base.url` system parameters)? – ChesuCR Dec 06 '17 at 11:02
  • yes @ChesuCR that's was the problem i solved it by specifying the port in Web.base.url "serverIP:8069" – Samoox Dec 12 '17 at 10:57
  • Nice @samoox, I have write it into an answer. So, please mark it as accepted. I have added another parameter that maybe is useful as well – ChesuCR Dec 18 '17 at 19:56
  • @ChesuCR thank you so much Man and sorry for the late – Samoox Dec 28 '17 at 10:16

3 Answers3

16

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">

ChesuCR
  • 9,352
  • 5
  • 51
  • 114
  • How it is in `11.0`? I can see `report.url` in the system parameters, and I have this issue too. – SalahAdDin Nov 08 '18 at 14:30
  • 1
    Uhmm try using the ip `127.0.0.1` in the `report.url` parameter. I did not work much with the version 11. I will tell you something tomorrow if I remember to check it. – ChesuCR Nov 08 '18 at 17:34
  • I have checked that the line where the base_url is got still exists in Odoo 11. Check this [line](https://github.com/OCA/OCB/blob/11.0/odoo/addons/base/ir/ir_actions_report.py#L280). CSS files are working for me even without the `report.url` parameter. So make sure you are setting the right url to the parameters – ChesuCR Nov 09 '18 at 10:26
  • `web.base.url` is working for mail templates, but it is not working for reports. – SalahAdDin Nov 09 '18 at 10:34
1

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

Yasmine
  • 123
  • 8
0

One more. If you are using a server and the ssl certificate is no longer valid, the web.base.url parameter will still be something like https:// and styles may not load correctly.

David RC
  • 1
  • 1