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
836 B

  1. # -*- coding: utf-8 -*-
  2. # Copyright 2017 Akretion (http://www.akretion.com/)
  3. # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
  4. from odoo import api, models
  5. class Report(models.Model):
  6. _inherit = 'report'
  7. @api.model
  8. def _get_report_from_name(self, report_name):
  9. """Get the first record of ir.actions.report.xml having the
  10. ``report_name`` as value for the field report_name.
  11. """
  12. res = super(Report, self)._get_report_from_name(report_name)
  13. if res:
  14. return res
  15. # maybe a py3o report
  16. report_obj = self.env['ir.actions.report.xml']
  17. context = self.env['res.users'].context_get()
  18. return report_obj.with_context(context).search(
  19. [('report_type', '=', 'py3o'),
  20. ('report_name', '=', report_name)], limit=1)