Fix PDF filename for data-driven wizard reports

Override report_download controller to evaluate print_report_name
for wizard reports where Odoo 16 JS passes active_ids in context
query params instead of URL path. Use report.name field for
translated base filename instead of _() which fails in safe_eval.

🤖 assisted by claude
This commit is contained in:
Ernad Husremovic 2026-03-12 14:45:01 +01:00
parent bb0a9f3925
commit 93c22b7e58
4 changed files with 314 additions and 1 deletions

View file

@ -18,7 +18,11 @@ class AccountPartnerLedger(models.TransientModel):
help="Show previous balance before the start date.")
def _get_report_base_filename(self):
base = _('Partner Ledger').replace(' ', '_')
report = self.env.ref(
'accounting_pdf_reports.action_report_partnerledger',
raise_if_not_found=False,
)
base = (report.name if report else _('Partner Ledger')).replace(' ', '_')
if self.partner_ids:
names = '_'.join(
name.replace(' ', '_').replace('/', '_').replace('\\', '_')