2020-07-13odoo13 记录解决 wkhtmltopdf 生成的PDF 格式不正确的问题

在本地开发测试时,样式是没有问题的,将其部署到服务器后,发现转出的PDF格式不对,

在 odoo  doc/howtos/backend.rst 文件中,看到提示

If it appears that your PDF report is missing the styles (i.e. the text

    appears but the style/layout is different from the html version), probably

    your wkhtmltopdf_ process cannot reach your web server to download them.

    If you check your server logs and see that the CSS styles are not being

    downloaded when generating a PDF report, most surely this is the problem.

    The wkhtmltopdf_ process will use the ``web.base.url`` system parameter as

    the *root path* to all linked files, but this parameter is automatically

    updated each time the Administrator is logged in. If your server resides

    behind some kind of proxy, that could not be reachable. You can fix this by

    adding one of these system parameters:

    - ``report.url``, pointing to an URL reachable from your server

      (probably ``http://localhost:8069`` or something similar). It will be

      used for this particular purpose only.

    - ``web.base.url.freeze``, when set to ``True``, will stop the

      automatic updates to ``web.base.url``.

如果发现生成的pdf样式不对,那可能是wkhtmltopdf没办法访问web服务器导致的。

wkhtmltopdf进程使用web.base.url作为根url来生成对应文件路径,但这个地址是每次管理员登录都会自动更新的

如果使用了代理,可能就出现访问不了的情况,

可以通过添加一个系统参数来解决:report.url指向一个可访问的地址如localhost:8069等,这个是报表打印专用参数

或者用web.base.url.freeze,设置为True时会停止自动更新。

进入线上部署后的odoo,找到 技术- 参数 -系统参数,增加一条记录,8067 是我的端口号,各位按需求改


你可能感兴趣的:(2020-07-13odoo13 记录解决 wkhtmltopdf 生成的PDF 格式不正确的问题)