diff --git a/odoo/addons/base/models/ir_actions_report.py b/odoo/addons/base/models/ir_actions_report.py index ec3803fd0f4..3d38c37b69d 100644 --- a/odoo/addons/base/models/ir_actions_report.py +++ b/odoo/addons/base/models/ir_actions_report.py @@ -395,7 +395,7 @@ class IrActionsReport(models.Model): res_ids.append(None) if not bodies: - body = b''.join(lxml.html.tostring(c, encoding='utf-8') for c in body_parent.getchildren()) + body = ''.join(lxml.html.tostring(c, encoding='unicode') for c in body_parent.getchildren()) bodies.append(body) # Get paperformat arguments set in the root html tag. They are prioritized over @@ -452,13 +452,13 @@ class IrActionsReport(models.Model): if header: head_file_fd, head_file_path = tempfile.mkstemp(suffix='.html', prefix='report.header.tmp.') with closing(os.fdopen(head_file_fd, 'wb')) as head_file: - head_file.write(header) + head_file.write(header.encode()) temporary_files.append(head_file_path) files_command_args.extend(['--header-html', head_file_path]) if footer: foot_file_fd, foot_file_path = tempfile.mkstemp(suffix='.html', prefix='report.footer.tmp.') with closing(os.fdopen(foot_file_fd, 'wb')) as foot_file: - foot_file.write(footer) + foot_file.write(footer.encode()) temporary_files.append(foot_file_path) files_command_args.extend(['--footer-html', foot_file_path]) @@ -467,7 +467,7 @@ class IrActionsReport(models.Model): prefix = '%s%d.' % ('report.body.tmp.', i) body_file_fd, body_file_path = tempfile.mkstemp(suffix='.html', prefix=prefix) with closing(os.fdopen(body_file_fd, 'wb')) as body_file: - body_file.write(body) + body_file.write(body.encode()) paths.append(body_file_path) temporary_files.append(body_file_path)