From 126f198a31c0189bfee88dc110594ef07b2acec3 Mon Sep 17 00:00:00 2001 From: Rodrigo Date: Thu, 6 Oct 2022 18:39:34 +0200 Subject: [PATCH] [MIG] report_xlsx_helper: Migration to 16.0 --- report_xlsx_helper/__manifest__.py | 2 +- report_xlsx_helper/controllers/main.py | 4 +++- report_xlsx_helper/models/ir_actions_report.py | 4 ++-- report_xlsx_helper/tests/test_report_xlsx_helper.py | 2 +- 4 files changed, 7 insertions(+), 5 deletions(-) diff --git a/report_xlsx_helper/__manifest__.py b/report_xlsx_helper/__manifest__.py index 3342e540a..2a75e33b7 100644 --- a/report_xlsx_helper/__manifest__.py +++ b/report_xlsx_helper/__manifest__.py @@ -6,7 +6,7 @@ "author": "Noviat, Odoo Community Association (OCA)", "website": "https://github.com/OCA/reporting-engine", "category": "Reporting", - "version": "15.0.1.0.1", + "version": "16.0.1.0.0", "license": "AGPL-3", "depends": ["report_xlsx"], "development_status": "Mature", diff --git a/report_xlsx_helper/controllers/main.py b/report_xlsx_helper/controllers/main.py index 0658e858e..d9536fb7d 100644 --- a/report_xlsx_helper/controllers/main.py +++ b/report_xlsx_helper/controllers/main.py @@ -32,7 +32,9 @@ class ReportController(ReportController): context.update(data["context"]) context["report_name"] = reportname - xlsx = report.with_context(**context)._render_xlsx(docids, data=data)[0] + xlsx = report.with_context(**context)._render_xlsx( + reportname, docids, data=data + )[0] report_file = context.get("report_file") if not report_file: active_model = context.get("active_model", "export") diff --git a/report_xlsx_helper/models/ir_actions_report.py b/report_xlsx_helper/models/ir_actions_report.py index 7f6cf8d8d..01f7d615b 100644 --- a/report_xlsx_helper/models/ir_actions_report.py +++ b/report_xlsx_helper/models/ir_actions_report.py @@ -9,11 +9,11 @@ class IrActionsReport(models.Model): _inherit = "ir.actions.report" @api.model - def _render_xlsx(self, docids, data): + def _render_xlsx(self, report_ref, docids, data): if not self and self.env.context.get("report_name"): report_model_name = "report.{}".format(self.env.context["report_name"]) report_model = self.env.get(report_model_name) if report_model is None: raise UserError(_("%s model was not found") % report_model_name) return report_model.create_xlsx_report(docids, data) - return super()._render_xlsx(docids, data) + return super()._render_xlsx(report_ref, docids, data) diff --git a/report_xlsx_helper/tests/test_report_xlsx_helper.py b/report_xlsx_helper/tests/test_report_xlsx_helper.py index 25c384edb..76eb71643 100644 --- a/report_xlsx_helper/tests/test_report_xlsx_helper.py +++ b/report_xlsx_helper/tests/test_report_xlsx_helper.py @@ -23,5 +23,5 @@ class TestReportXlsxHelper(TransactionCase): self.report = self.env["ir.actions.report"].with_context(**ctx) def test_report_xlsx_helper(self): - report_xls = self.report._render_xlsx(None, None) + report_xls = self.report._render_xlsx(None, None, None) self.assertEqual(report_xls[1], "xlsx")