[IMP] report_async: pre-commit auto fixes

This commit is contained in:
Sakthivel
2024-05-10 13:32:07 +05:30
committed by Atchuthan, Sodexis
parent ae6b4cc924
commit 21310d51a7
12 changed files with 133 additions and 104 deletions

View File

@@ -11,7 +11,7 @@ class Report(models.Model):
_inherit = "ir.actions.report"
def report_action(self, docids, data=None, config=True):
res = super(Report, self).report_action(docids, data=data, config=config)
res = super().report_action(docids, data=data, config=config)
if res["context"].get("async_process", False):
rpt_async_id = res["context"]["active_id"]
report_async = self.env["report.async"].browse(rpt_async_id)

View File

@@ -98,7 +98,7 @@ class ReportAsync(models.Model):
order="id desc",
)
for rec in self:
rec.file_ids = files.filtered(lambda l: l.res_id == rec.id)
rec.file_ids = files.filtered(lambda file, rec=rec: file.res_id == rec.id)
def run_now(self):
self.ensure_one()
@@ -142,7 +142,7 @@ class ReportAsync(models.Model):
# Run report
out_file, file_ext = getattr(report, func)(report.xml_id, docids, data)
out_file = base64.b64encode(out_file)
out_name = "{}.{}".format(report.name, file_ext)
out_name = f"{report.name}.{file_ext}"
# Save report to attachment
attachment = (
self.env["ir.attachment"]