From 023748f6ccd928c8c4253247adf7b5bbf66616b4 Mon Sep 17 00:00:00 2001 From: "duc.tdm" Date: Fri, 16 Aug 2024 16:31:25 +0700 Subject: [PATCH] [FIX]report_xlsx: field print_report_name should be taken into account --- report_xlsx/models/ir_report.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/report_xlsx/models/ir_report.py b/report_xlsx/models/ir_report.py index 13484f0544..5e4eac407f 100644 --- a/report_xlsx/models/ir_report.py +++ b/report_xlsx/models/ir_report.py @@ -77,3 +77,15 @@ def save_xlsx_report_attachment(self, docids, report_contents): attachment_values["name"], ) return attachment, record + + def report_action(self, docids, data=None, config=True): + self.ensure_one() + res = super().report_action(docids, data=data, config=config) + if self.report_type == "xlsx" and len(docids) == 1: + # We have to do this, Otherwise, the Excel report will never get field + # print_report_name. + # Check code in file oca-reporting-engine/report_xlsx/controllers/main.py + # in report_download function to see that the report_name need to + / + id + # to get the value of print_report_name. + res.update({"report_name": self.report_name + "/" + str(docids[0])}) + return res