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.

25 lines
981 B

  1. # Copyright 2020 Onestein (<https://www.onestein.eu>)
  2. # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
  3. from odoo import api, models
  4. class IrActionsReport(models.Model):
  5. _inherit = "ir.actions.report"
  6. @api.model
  7. def _prepare_account_financial_report_context(self, data):
  8. lang = data and data.get("account_financial_report_lang") or ""
  9. return dict(self.env.context or {}, lang=lang) if lang else False
  10. @api.model
  11. def render_qweb_html(self, docids, data=None):
  12. context = self._prepare_account_financial_report_context(data)
  13. obj = self.with_context(context) if context else self
  14. return super(IrActionsReport, obj).render_qweb_html(docids, data)
  15. @api.model
  16. def render_xlsx(self, docids, data):
  17. context = self._prepare_account_financial_report_context(data)
  18. obj = self.with_context(context) if context else self
  19. return super(IrActionsReport, obj).render_xlsx(docids, data)