[IMP] report_async 14.0

This commit is contained in:
KKamaa
2022-04-13 18:40:55 +03:00
parent d717791082
commit 6c5cf35974
12 changed files with 452 additions and 131 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 models
from odoo import fields, models
# Define all supported report_type
REPORT_TYPES = ["qweb-pdf", "qweb-text", "qweb-xml", "csv", "excel", "xlsx"]
@@ -10,6 +10,18 @@ REPORT_TYPES = ["qweb-pdf", "qweb-text", "qweb-xml", "csv", "excel", "xlsx"]
class Report(models.Model):
_inherit = "ir.actions.report"
async_report = fields.Boolean(default=False)
async_no_records = fields.Integer(
string="Min of Records",
default=100,
help="Min no of records to use async report functionality; e.g 100+",
)
async_mail_recipient = fields.Char(
string="Mail Recipient",
help="The email that will receive the async report",
default=lambda self: self.env.user.email,
)
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):