From 095f7105177f332add6b88abe021cfcdee63cbde Mon Sep 17 00:00:00 2001 From: Holger Brunn Date: Thu, 22 Mar 2018 00:29:59 +0100 Subject: [PATCH] [FIX] fallback to libreoffice conversion when no server is configured fixes #200 --- report_py3o/models/py3o_report.py | 3 +++ report_py3o_fusion_server/models/py3o_report.py | 12 ++++++++++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/report_py3o/models/py3o_report.py b/report_py3o/models/py3o_report.py index 66198f20..fce767cf 100644 --- a/report_py3o/models/py3o_report.py +++ b/report_py3o/models/py3o_report.py @@ -253,6 +253,9 @@ class Py3oReport(models.TransientModel): out_stream.seek(0) tmpl_data = out_stream.read() + if self.env.context.get('report_py3o_skip_conversion'): + return result_path + result_path = self._convert_single_report( result_path, model_instance, data ) diff --git a/report_py3o_fusion_server/models/py3o_report.py b/report_py3o_fusion_server/models/py3o_report.py index dd0381f0..86bd26dd 100644 --- a/report_py3o_fusion_server/models/py3o_report.py +++ b/report_py3o_fusion_server/models/py3o_report.py @@ -32,8 +32,16 @@ class Py3oReport(models.TransientModel): self.ensure_one() report_xml = self.ir_actions_report_xml_id filetype = report_xml.py3o_filetype - if report_xml.py3o_is_local_fusion: - result_path = super(Py3oReport, self)._create_single_report( + if not report_xml.py3o_server_id: + return super(Py3oReport, self)._create_single_report( + model_instance, data, save_in_attachment, + ) + elif report_xml.py3o_is_local_fusion: + result_path = super( + Py3oReport, self.with_context( + report_py3o_skip_conversion=True, + ) + )._create_single_report( model_instance, data, save_in_attachment, ) with closing(open(result_path, 'r')) as out_stream: