summaryrefslogtreecommitdiff
path: root/addons
diff options
context:
space:
mode:
authorMartin Trigaux <mat@odoo.com>2016-12-07 11:41:18 +0100
committerMartin Trigaux <mat@odoo.com>2016-12-07 11:58:32 +0100
commit3642f1194244c66faa8dabb4be6abcfff789cda4 (patch)
treed62f9aad95d5a0610612537dfb7a81eace69c4d6 /addons
parent7ccf4e60c86d80ce38e8e7f33d1d42940384306c (diff)
[FIX] report: catch missing wkhtml error
If wkhtmltopdf is missing, a call to a report will be catched to warn the user. In case of a report generated indirectly (e.g. via an attachment on an email template), the rendering would crash. As warning the user is better than returning a traceback, raise a UserError. Closes #14535
Diffstat (limited to 'addons')
-rw-r--r--addons/report/i18n/report.pot12
-rw-r--r--addons/report/models/report.py8
2 files changed, 17 insertions, 3 deletions
diff --git a/addons/report/i18n/report.pot b/addons/report/i18n/report.pot
index a47f3d4e516..d1d4b22a840 100644
--- a/addons/report/i18n/report.pot
+++ b/addons/report/i18n/report.pot
@@ -6,8 +6,8 @@ msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 9.0c\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2016-06-09 11:58+0000\n"
-"PO-Revision-Date: 2016-06-09 11:58+0000\n"
+"POT-Creation-Date: 2016-12-07 10:39+0000\n"
+"PO-Revision-Date: 2016-12-07 10:39+0000\n"
"Last-Translator: <>\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
@@ -462,12 +462,18 @@ msgid "Unable to find Wkhtmltopdf on this \n"
msgstr ""
#. module: report
+#: code:addons/report/models/report.py:164
+#, python-format
+msgid "Unable to find Wkhtmltopdf on this system. The PDF can not be created."
+msgstr ""
+
+#. module: report
#: model:ir.ui.view,arch_db:report.external_layout_footer
msgid "Website:"
msgstr ""
#. module: report
-#: code:addons/report/models/report.py:430
+#: code:addons/report/models/report.py:464
#, python-format
msgid "Wkhtmltopdf failed (error code: %s). Message: %s"
msgstr ""
diff --git a/addons/report/models/report.py b/addons/report/models/report.py
index 3a3f7ff2459..3e14f1dffca 100644
--- a/addons/report/models/report.py
+++ b/addons/report/models/report.py
@@ -155,6 +155,14 @@ class Report(osv.Model):
def get_pdf(self, cr, uid, ids, report_name, html=None, data=None, context=None):
"""This method generates and returns pdf version of a report.
"""
+
+ if self._check_wkhtmltopdf() == 'install':
+ # wkhtmltopdf is not installed
+ # the call should be catched before (cf /report/check_wkhtmltopdf) but
+ # if get_pdf is called manually (email template), the check could be
+ # bypassed
+ raise UserError(_("Unable to find Wkhtmltopdf on this system. The PDF can not be created."))
+
if context is None:
context = {}