[13.0][MIG] report_async

This commit is contained in:
Saran440
2020-09-03 11:39:23 +07:00
committed by Kitti U
parent d4afffff27
commit 359e8f359c
10 changed files with 14 additions and 21 deletions

View File

@@ -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):

View File

@@ -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,