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

3

10

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

Verdellverderer answered 1/11, 2017 at 12:43 Comment(8)
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.Banzai
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 printedVerdellverderer
By clicking on which button this reprot is generated ? Means from which model's tree/form view this reported is generated ?Banzai
@KevalMehta it's from print button in sales => quotation moduleVerdellverderer
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)?Audiophile
yes @Audiophile that's was the problem i solved it by specifying the port in Web.base.url "serverIP:8069"Verdellverderer
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 wellAudiophile
@Audiophile thank you so much Man and sorry for the lateVerdellverderer
A
19

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

Audiophile answered 18/12, 2017 at 19:55 Comment(4)
How it is in 11.0? I can see report.url in the system parameters, and I have this issue too.Desiderata
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.Audiophile
I have checked that the line where the base_url is got still exists in Odoo 11. Check this line. CSS files are working for me even without the report.url parameter. So make sure you are setting the right url to the parametersAudiophile
web.base.url is working for mail templates, but it is not working for reports.Desiderata
O
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

Obituary answered 16/6, 2021 at 11:2 Comment(0)
N
1

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.

Negrete answered 26/1, 2023 at 19:26 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.