Odoo Help

2

wkhtmltopdf report generation problem - report is generated incorrectly

By
devza
on 10/12/14, 10:30 AM 4,125 views

Hi all, I have a wierd problem. On my vps I've installed Odoo and on clear db with just a sale module report is generated correct. But when I've installed more addons, added some product, created website w/ shop etc. (normal using of odoo) the report ist genereted incorrectly. Here is an example:

http://pl.rghost.net/58485634

So it looks like wkhtmltopdf problem, but I've got 0.12.1 version and as I said on a new db report is generated correctly. Any ideas what might be wrong? Also on my local pc Odoo prints reports always correctly. So maybe it's problem with VPS?

I think you could add more information about your problem... I have some problem with report generation, but in my case I have some empty sale orders. I'm searching for a solution, if I find any useful information for you I'll post here.

Rui Andrada
on 10/12/14, 4:29 PM

Maybe it's help you: https://github.com/odoo/odoo/issues/364#issuecomment-47309589 https://www.odoo.com/forum/help-1/question/openerp-v8-wkhtmltopdf-0-12-0-error-bug-52041

Rui Andrada
on 10/12/14, 5:07 PM
4

Yenthe

--Yenthe--
7155
| 7 7 8
Turnhout, Belgium
--Yenthe--

My Odoo blog: http://www.odoo.yenthevg.com/

My Twitter: https://twitter.com/Yenthe666

Yenthe
On 10/13/14, 1:59 AM

This is a VPS/networking problem that I also had. Is your PDF delayed (taking more time then normal) and is your shop slow when clicking on pay now?
Your problem is coming from the Odoo itself. It cannot find the correct routing to its CSS resources etc and this causes a delay.
The problem is easy to fix..
Go to settings > Parameters > System parameters and edit your web.base.url to have the value http://0.0.0.0:8069/
Now create a new parameter with the name web.base.url.freeze and as value True.

Reload your whole Odoo and you will see the problem is fixed.

Great, it works now. Thank you. But if a delay is obvious, I wonder why the PDF file was corrupted? Anyway, thanks for help.

devza
on 10/13/14, 4:33 AM

No problem. The delay is caused because your Odoo serer is looking for the resources but can not find them. Because of not finding this CSS & resources you get a corrupted view, what really is a document with no styling to it. Please upvote or mark my answer as valid if this helped you. :)

Yenthe
on 10/13/14, 5:45 AM

It's sad but I have no karma to upvote your answer :(

devza
on 10/13/14, 5:49 AM

Now you do! The karma system is very annoying in the first posts. I've upvoted your question since I'm sure more people will run into this anyways. You should now be able to accept/upvote it.

Yenthe
on 10/13/14, 5:52 AM

Yup, so I did. I hope that your answer will help anyone who's facing same problem as mine.

devza
on 10/13/14, 5:55 AM
2
Robin Chatfield
On 7/30/15, 9:26 AM

Resurrecting this post because it was the first hit on google.

Yenthe's answer works, but it will break a lot of other features. A fix to this issue was added shortly after this question was asked. The correct solution to this problem is to add a parameter named report.url with the address that the report module should use (probably http://0.0.0.0:8069/).

Upvoted because this is absolutely true! I've lost track of this post otherwise I would've updated it. I won't edit my answer since you posted this though. Thanks for the heads up ;)

Yenthe
on 7/30/15, 9:31 AM
0
thompsonn
On 3/23/17, 1:04 AM

As Robin Chatfield noticed Yenthe's fix will break a lot of features, e.g. e-mail recipients will get broken links with the wrong base. I've tried to add the report.url parameter using v. 10.0 but still faced problems with website_sale reports renderings that customers receive after finishing a purchase because the corresponding default method was seeking CSS at the wrong path. So I left the created 'report.url' system parameter and overrode the built-in method like this:

from odoo import models, fields, api
from odoo.http import request
import time

class ReportGenerationFix(models.Model):
_inherit = 'report'

@api.multi
def render(self, template, values=None):
if values is None:
values = {}

context = dict(self.env.context, inherit_branding=True)
user = self.env['res.users'].browse(self.env.uid)
website = None
if request and hasattr(request, 'website'):
if request.website is not None:
website = request.website
context = dict(context, translatable=context.get('lang') != request.website.default_lang_code)

view_obj = self.env['ir.ui.view'].with_context(context)
values.update(
time=time,
context_timestamp=lambda t: fields.Datetime.context_timestamp(self.with_context(tz=user.tz), t),
editable=True,
user=user,
res_company=user.company_id,
website=website,
web_base_url=self.env['ir.config_parameter'].get_param('report.url', default='')
)
return view_obj.render_template(template, values)


Thanks

-1
Jim Tambling
On 2/12/17, 6:01 AM

I am using Odoo 10 and report generation either takes a long time or just fails. Is there a patch I need to apply or a setting I need to change?


Regards

Jim

This platform 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.

https://www.odoo.com/forum/help-1/faq

Rui Andrada
on 2/12/17, 12:35 PM

About This Community

This platform 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.

Register

Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

3 follower(s)

Stats

Asked: 10/12/14, 10:30 AM
Seen: 4125 times
Last updated: 3/23/17, 1:04 AM