Skip to content

Commit 8e2707e

Browse files
committed
[FIX] report_async: Incorrect definition report id
1 parent bfca132 commit 8e2707e

3 files changed

Lines changed: 3 additions & 2 deletions

File tree

report_async/models/ir_report.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ class Report(models.Model):
1313
def report_action(self, docids, data=None, config=True):
1414
res = super().report_action(docids, data=data, config=config)
1515
if res["context"].get("async_process", False):
16-
rpt_async_id = res["context"]["active_id"]
16+
rpt_async_id = res["context"]["report_async_id"]
1717
report_async = self.env["report.async"].browse(rpt_async_id)
1818
if res["report_type"] in REPORT_TYPES:
1919
report_async.with_delay().run_report(

report_async/models/report_async.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ def run_async(self):
115115
raise UserError(self.env._("Background process not allowed."))
116116
result = self.env[self.action_id.type]._for_xml_id(self.action_id.xml_id)
117117
ctx = safe_eval(result.get("context", {}))
118-
ctx.update({"async_process": True})
118+
ctx.update({"async_process": True, "report_async_id": self.id})
119119
result["context"] = ctx
120120
return result
121121

report_async/tests/test_report_async.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ def _print_wizard(self, res):
2727
active_model=self.print_doc._name,
2828
active_id=self.print_doc.id,
2929
async_process=res["context"].get("async_process"),
30+
report_async_id=res["context"].get("report_async_id"),
3031
)
3132
) as form:
3233
form.reference = f"{self.test_rec._name},{self.test_rec.id}"

0 commit comments

Comments
 (0)