From 2709bf2fa9b5096eb2db53d8270e86f062352033 Mon Sep 17 00:00:00 2001 From: Sergi Almacellas Abellana Date: Fri, 29 Nov 2019 15:16:11 +0100 Subject: [PATCH] Adapt file mode depending on data type in soffice conversion issue8848 review278211002 --- trytond/report/report.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/trytond/report/report.py b/trytond/report/report.py index 88710b9507..3355061759 100644 --- a/trytond/report/report.py +++ b/trytond/report/report.py @@ -320,7 +320,8 @@ class Report(URLMixin, PoolBase): path = os.path.join( dtemp, report.report_name + os.extsep + input_format) oext = FORMAT2EXT.get(output_format, output_format) - with open(path, 'wb+') as fp: + mode = 'w+' if isinstance(data, str) else 'wb+' + with open(path, mode) as fp: fp.write(data) try: cmd = ['soffice',