mirror of
https://github.com/OCA/reporting-engine.git
synced 2025-02-16 16:30:38 +02:00
[13.0][MIG] report_async
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
# Copyright 2019 Ecosoft Co., Ltd (http://ecosoft.co.th/)
|
||||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html)
|
||||
|
||||
from odoo import api, models
|
||||
from odoo import models
|
||||
|
||||
# Define all supported report_type
|
||||
REPORT_TYPES = ["qweb-pdf", "qweb-text", "qweb-xml", "csv", "excel", "xlsx"]
|
||||
@@ -10,7 +10,6 @@ REPORT_TYPES = ["qweb-pdf", "qweb-text", "qweb-xml", "csv", "excel", "xlsx"]
|
||||
class Report(models.Model):
|
||||
_inherit = "ir.actions.report"
|
||||
|
||||
@api.noguess
|
||||
def report_action(self, docids, data=None, config=True):
|
||||
res = super(Report, self).report_action(docids, data=data, config=config)
|
||||
if res["context"].get("async_process", False):
|
||||
|
||||
@@ -67,7 +67,6 @@ class ReportAsync(models.Model):
|
||||
help="List all files created by this report background process",
|
||||
)
|
||||
|
||||
@api.multi
|
||||
def _compute_job(self):
|
||||
for rec in self:
|
||||
rec.job_ids = (
|
||||
@@ -84,7 +83,6 @@ class ReportAsync(models.Model):
|
||||
rec.job_status = rec.job_ids[0].sudo().state if rec.job_ids else False
|
||||
rec.job_info = rec.job_ids[0].sudo().exc_info if rec.job_ids else False
|
||||
|
||||
@api.multi
|
||||
def _compute_file(self):
|
||||
files = self.env["ir.attachment"].search(
|
||||
[
|
||||
@@ -106,7 +104,6 @@ class ReportAsync(models.Model):
|
||||
result["context"] = ctx
|
||||
return result
|
||||
|
||||
@api.multi
|
||||
def run_async(self):
|
||||
self.ensure_one()
|
||||
if not self.allow_async:
|
||||
@@ -118,7 +115,6 @@ class ReportAsync(models.Model):
|
||||
result["context"] = ctx
|
||||
return result
|
||||
|
||||
@api.multi
|
||||
def view_files(self):
|
||||
self.ensure_one()
|
||||
action = self.env.ref("report_async.action_view_files")
|
||||
@@ -126,7 +122,6 @@ class ReportAsync(models.Model):
|
||||
result["domain"] = [("id", "in", self.file_ids.ids)]
|
||||
return result
|
||||
|
||||
@api.multi
|
||||
def view_jobs(self):
|
||||
self.ensure_one()
|
||||
action = self.env.ref("queue_job.action_queue_job")
|
||||
@@ -152,7 +147,6 @@ class ReportAsync(models.Model):
|
||||
{
|
||||
"name": out_name,
|
||||
"datas": out_file,
|
||||
"datas_fname": out_name,
|
||||
"type": "binary",
|
||||
"res_model": "report.async",
|
||||
"res_id": self.id,
|
||||
|
||||
Reference in New Issue
Block a user