[FIX] all: add missing encoding for the templates
following the change 7df343dd1b
closes odoo/odoo#74768
Related: odoo/enterprise#20098
Signed-off-by: Xavier Morel (xmo) <xmo@odoo.com>
This commit is contained in:
@@ -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)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user