Skip to content

Commit

Permalink
[FIX] base_report_to_printer: Fix access error when printing product …
Browse files Browse the repository at this point in the history
…label from product.product because IDs are used on the wrong model
  • Loading branch information
fkantelberg committed Jan 2, 2025
1 parent 97b7315 commit 9b4af7f
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion base_report_to_printer/models/ir_actions_report.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,9 +166,10 @@ def print_document(self, record_ids, data=None):
if not printer:
raise exceptions.UserError(_("No printer configured to print this report."))
if self.print_report_name:
model = (data or {}).get("active_model", self.model)

Check warning on line 169 in base_report_to_printer/models/ir_actions_report.py

View check run for this annotation

Codecov / codecov/patch

base_report_to_printer/models/ir_actions_report.py#L169

Added line #L169 was not covered by tests
report_file_names = [
safe_eval(self.print_report_name, {"object": obj, "time": time})
for obj in self.env[self.model].browse(record_ids)
for obj in self.env[model].browse(record_ids)
]
title = " ".join(report_file_names)
if len(title) > 80:
Expand Down

0 comments on commit 9b4af7f

Please sign in to comment.