From 75f2a771b484f7a5dedb58c407d1f09cd1d922fe Mon Sep 17 00:00:00 2001 From: "Laurent Mignon (ACSONE)" Date: Tue, 8 Jan 2019 10:12:26 +0100 Subject: [PATCH] [FIX] report_py3o: Use the right naming convention for the render method To determine the method to use to render a recport according to its type, the generic method 'render' defined into ir.action.report check if a method name is defined on the model. https://github.com/odoo/odoo/blob/12.0/odoo/addons/base/models/ir_actions_report.py#L734 Therefore, we must provide this method to be compliant with what's expected by Odoo. This change will also allows the usage of py3o template with mail_template once https://github.com/odoo/odoo/pull/30013 will be merged --- report_py3o/controllers/main.py | 2 +- report_py3o/models/ir_actions_report.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/report_py3o/controllers/main.py b/report_py3o/controllers/main.py index e18a1871..1a819f27 100644 --- a/report_py3o/controllers/main.py +++ b/report_py3o/controllers/main.py @@ -44,7 +44,7 @@ class ReportController(main.ReportController): raise exceptions.HTTPException( description='Py3o action report not found for report_name ' '%s' % reportname) - res, filetype = action_py3o_report._render_py3o(docids, data) + res, filetype = action_py3o_report.render_py3o(docids, data) filename = action_py3o_report.gen_report_download_filename( docids, data) if not filename.endswith(filetype): diff --git a/report_py3o/models/ir_actions_report.py b/report_py3o/models/ir_actions_report.py index a5b63bfc..de0bac36 100644 --- a/report_py3o/models/ir_actions_report.py +++ b/report_py3o/models/ir_actions_report.py @@ -81,12 +81,12 @@ class IrActionsReport(models.Model): def render_report(self, res_ids, name, data): action_py3o_report = self.get_from_report_name(name, "py3o") if action_py3o_report: - return action_py3o_report._render_py3o(res_ids, data) + return action_py3o_report.render_py3o(res_ids, data) return super(IrActionsReport, self).render_report( res_ids, name, data) @api.multi - def _render_py3o(self, res_ids, data): + def render_py3o(self, res_ids, data): self.ensure_one() if self.report_type != "py3o": raise RuntimeError(