From 50c950deae17ea218b46e5adef37d79c26bdee76 Mon Sep 17 00:00:00 2001 From: Pierrick Muller Date: Thu, 18 Jul 2024 13:24:42 +0200 Subject: [PATCH 1/3] Fix lang translation error on reports --- base_report_to_printer/models/ir_actions_report.py | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/base_report_to_printer/models/ir_actions_report.py b/base_report_to_printer/models/ir_actions_report.py index 029d3ca25f5..d09c639a9e1 100644 --- a/base_report_to_printer/models/ir_actions_report.py +++ b/base_report_to_printer/models/ir_actions_report.py @@ -125,9 +125,17 @@ def print_document(self, record_ids, data=None): % str(self.report_type) ) method_name = "_render_qweb_%s" % (report_type) - document, doc_format = getattr( - self.with_context(must_skip_send_to_printer=True), method_name - )(record_ids, data=data) + + if data["lang"]: + document, doc_format = getattr( + self.with_context(must_skip_send_to_printer=True, + lang=data["lang"]), method_name + )(record_ids, data=data) + else: + document, doc_format = getattr( + self.with_context(must_skip_send_to_printer=True), method_name + )(record_ids, data=data) + behaviour = self.behaviour() printer = behaviour.pop("printer", None) From 67e88bf88cb014e122457046de270c9f42cb0a19 Mon Sep 17 00:00:00 2001 From: Pierrick Muller Date: Thu, 18 Jul 2024 13:45:58 +0200 Subject: [PATCH 2/3] Fix lang error check --- base_report_to_printer/models/ir_actions_report.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/base_report_to_printer/models/ir_actions_report.py b/base_report_to_printer/models/ir_actions_report.py index d09c639a9e1..0b43e75d994 100644 --- a/base_report_to_printer/models/ir_actions_report.py +++ b/base_report_to_printer/models/ir_actions_report.py @@ -126,7 +126,7 @@ def print_document(self, record_ids, data=None): ) method_name = "_render_qweb_%s" % (report_type) - if data["lang"]: + if "lang" in data and data["lang"]: document, doc_format = getattr( self.with_context(must_skip_send_to_printer=True, lang=data["lang"]), method_name From 0fcc13a9aab39761ca94820ce1dad6114b47ae4c Mon Sep 17 00:00:00 2001 From: Pierrick Muller Date: Thu, 18 Jul 2024 14:10:34 +0200 Subject: [PATCH 3/3] First fix precommit --- base_report_to_printer/models/ir_actions_report.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/base_report_to_printer/models/ir_actions_report.py b/base_report_to_printer/models/ir_actions_report.py index 0b43e75d994..96604036047 100644 --- a/base_report_to_printer/models/ir_actions_report.py +++ b/base_report_to_printer/models/ir_actions_report.py @@ -128,8 +128,8 @@ def print_document(self, record_ids, data=None): if "lang" in data and data["lang"]: document, doc_format = getattr( - self.with_context(must_skip_send_to_printer=True, - lang=data["lang"]), method_name + self.with_context(must_skip_send_to_printer=True, lang=data["lang"]), + method_name, )(record_ids, data=data) else: document, doc_format = getattr(