Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
6 ตอบกลับ
22601 มุมมอง

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.

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

คำตอบที่ดีที่สุด

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.

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. :)

ผู้เขียน

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

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.

ผู้เขียน

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

I tried this but it is still not working:(

คำตอบที่ดีที่สุด

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 ;)

คำตอบที่ดีที่สุด

PDF generation too long and faulty on Odoo12 - solution!
1) Go to the Backend part of your Odoo12 and activate the developer mode.
2) Go to the "Configuration" section. Then the "Technical" tab and click on "System Settings" at the bottom of the drop-down menu.
3) Click on the "Create" button
4) In the "Key" field, put "report.url" and in the "Value" field, "http://0.0.0.0:8069". Then save.
5) Re-click the "Create" button
6) In the "Key" field, put "web.base.url.freeze" and in the "Value" field, "True". Then save.
7) Go to the terminal of your Odoo 12 server
8) Start this command "service odoo restart"
9) Test the PDF generation of Odoo 12. (by printing an article, an estimate or an invoice ...)

อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

In my case I had to is change report.url to main database URL - with web.base.url and web.base.url.freeze 

อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

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

อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

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