Initial commit: Odoo 18.0-20251222 extra-addons
This commit is contained in:
1
report_xlsx_helper/models/__init__.py
Normal file
1
report_xlsx_helper/models/__init__.py
Normal file
@@ -0,0 +1 @@
|
||||
from . import ir_actions_report
|
||||
19
report_xlsx_helper/models/ir_actions_report.py
Normal file
19
report_xlsx_helper/models/ir_actions_report.py
Normal file
@@ -0,0 +1,19 @@
|
||||
# Copyright 2009-2018 Noviat.
|
||||
# License AGPL-3.0 or later (https://www.gnuorg/licenses/agpl.html).
|
||||
|
||||
from odoo import _, api, models
|
||||
from odoo.exceptions import UserError
|
||||
|
||||
|
||||
class IrActionsReport(models.Model):
|
||||
_inherit = "ir.actions.report"
|
||||
|
||||
@api.model
|
||||
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(report_ref, docids, data)
|
||||
Reference in New Issue
Block a user