OCA reporting engine fork for dev and update.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

19 lines
739 B

  1. # Copyright 2009-2018 Noviat.
  2. # License AGPL-3.0 or later (https://www.gnuorg/licenses/agpl.html).
  3. from odoo import _, api, models
  4. from odoo.exceptions import UserError
  5. class IrActionsReport(models.Model):
  6. _inherit = "ir.actions.report"
  7. @api.model
  8. def _render_xlsx(self, docids, data):
  9. if not self and self.env.context.get("report_name"):
  10. report_model_name = "report.{}".format(self.env.context["report_name"])
  11. report_model = self.env.get(report_model_name)
  12. if report_model is None:
  13. raise UserError(_("%s model was not found" % report_model_name))
  14. return report_model.create_xlsx_report(docids, data)
  15. return super()._render_xlsx(docids, data)