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.

25 lines
812 B

  1. # -*- coding: utf-8 -*-
  2. # Copyright (C) 2014-2015 Grupo ESOC <www.grupoesoc.es>
  3. # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
  4. import logging
  5. from odoo import api, models
  6. _logger = logging.getLogger(__name__)
  7. class ReportGenerator(models.Model):
  8. _inherit = "report"
  9. @api.model
  10. def _get_report_from_name(self, report_name):
  11. res = super(ReportGenerator, self)._get_report_from_name(report_name)
  12. if res:
  13. return res
  14. report_obj = self.env['ir.actions.report.xml']
  15. qwebtypes = ['qweb-xml']
  16. conditions = [('report_type', 'in', qwebtypes),
  17. ('report_name', '=', report_name)]
  18. context = self.env['res.users'].context_get()
  19. return report_obj.with_context(context).search(conditions, limit=1)