Skip to content

Commit

Permalink
[FIX] report_xlsx: Preserve custom context by using context from repo…
Browse files Browse the repository at this point in the history
…rt instead of user context
  • Loading branch information
DucTruongKomit committed Oct 4, 2024
1 parent b69c1d7 commit 9c6d789
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions report_xlsx/models/ir_report.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,3 +77,15 @@ def save_xlsx_report_attachment(self, docids, report_contents):
attachment_values["name"],
)
return attachment, record

def report_action(self, docids, data=None, config=True):
self.ensure_one()
res = super().report_action(docids, data=data, config=config)
if self.report_type == "xlsx" and len(docids) == 1:
# We have to do this, Otherwise, the Excel report will never get field
# print_report_name.
# Check code in file oca-reporting-engine/report_xlsx/controllers/main.py
# in report_download function to see that the report_name need to + / + id
# to get the value of print_report_name.
res.update({"report_name": self.report_name + "/" + str(docids[0])})

Check warning on line 90 in report_xlsx/models/ir_report.py

View check run for this annotation

Codecov / codecov/patch

report_xlsx/models/ir_report.py#L90

Added line #L90 was not covered by tests
return res

0 comments on commit 9c6d789

Please sign in to comment.