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.

28 lines
1014 B

  1. # Copyright 2019 Ecosoft Co., Ltd (http://ecosoft.co.th/)
  2. # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html)
  3. from odoo import api, models
  4. # Define all supported report_type
  5. REPORT_TYPES = ['qweb-pdf', 'qweb-text',
  6. 'qweb-xml', 'csv',
  7. 'excel', 'xlsx']
  8. class Report(models.Model):
  9. _inherit = 'ir.actions.report'
  10. @api.noguess
  11. def report_action(self, docids, data=None, config=True):
  12. res = super(Report, self).report_action(docids, data=data,
  13. config=config)
  14. if res['context'].get('async_process', False):
  15. rpt_async_id = res['context']['active_id']
  16. report_async = self.env['report.async'].browse(rpt_async_id)
  17. if res['report_type'] in REPORT_TYPES:
  18. report_async.with_delay().run_report(
  19. res['context'].get('active_ids', []), data,
  20. self.id, self._uid)
  21. return {}
  22. return res