Skip to content

Commit 5fc49f8

Browse files
committed
[FIX] base: decode wkhtmltopdf errors
In some cases, wkhtmltopdf might exit with an error (e.g.: a memory limit). In such cases, we want to show to the user the error returned by wkhtmltopdf. Previously, this message was only displayed in binary format (displayed as "Message: b'My error\n'") which is not user-friendly. We want this message to be decoded so that it is a bare string (displayed as "Message: My error"). closes odoo#114586 X-original-commit: 40212c1 Signed-off-by: Vincent Schippefilt (vsc) <vsc@odoo.com> Signed-off-by: Desausoi Laurent (lade) <lade@odoo.com>
1 parent b978854 commit 5fc49f8

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

odoo/addons/base/models/ir_actions_report.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
from odoo import api, fields, models, tools, SUPERUSER_ID, _
66
from odoo.exceptions import UserError, AccessError
77
from odoo.tools.safe_eval import safe_eval, time
8-
from odoo.tools.misc import find_in_path
8+
from odoo.tools.misc import find_in_path, ustr
99
from odoo.tools import check_barcode_encoding, config, is_html_empty, parse_version
1010
from odoo.http import request
1111
from odoo.osv.expression import NEGATIVE_TERM_OPERATORS, FALSE_DOMAIN
@@ -453,6 +453,7 @@ def _run_wkhtmltopdf(
453453
wkhtmltopdf = [_get_wkhtmltopdf_bin()] + command_args + files_command_args + paths + [pdf_report_path]
454454
process = subprocess.Popen(wkhtmltopdf, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
455455
out, err = process.communicate()
456+
err = ustr(err)
456457

457458
if process.returncode not in [0, 1]:
458459
if process.returncode == -11:

0 commit comments

Comments
 (0)