Skip to content

[FIX] account: distinct fallback names for dynamic reports#264841

Closed
evlin-odoo wants to merge 1 commit into
odoo:19.0from
odoo-dev:19.0-opw-6207518-evlin
Closed

[FIX] account: distinct fallback names for dynamic reports#264841
evlin-odoo wants to merge 1 commit into
odoo:19.0from
odoo-dev:19.0-opw-6207518-evlin

Conversation

@evlin-odoo
Copy link
Copy Markdown
Contributor

Problem:
When adding additional dynamic reports to the “Invoice: Send by Email” template, reports without a configured print_report_name incorrectly use the invoice filename. This is an issue because multiple attachments can have the same exact filename.

Example from related ticket: the user attached timesheets to their template and both the invoice PDF and timesheet attachment used the same filename.

Expected:
The additional report should use its own fallback filename (ex: timesheets_INV_XXX.pdf) or its configured
print_report_name.

Actual:
The additional report uses the invoice filename instead.

To fix this, reports without print_report_name now fallback to: <report name>_<invoice name>.pdf as done in v18.0

Related Ticket: 6207518 and 6175376

@robodoo
Copy link
Copy Markdown
Contributor

robodoo commented May 15, 2026

Pull request status dashboard

@evlin-odoo evlin-odoo marked this pull request as ready for review May 15, 2026 23:39
@evlin-odoo evlin-odoo requested a review from svfu-odoo May 15, 2026 23:39
@C3POdoo C3POdoo requested a review from a team May 15, 2026 23:41
@evlin-odoo
Copy link
Copy Markdown
Contributor Author

Hi @svfu-odoo ! Would you mind taking another look at this one when you have a chance?

It turned out there was a side effect from the previous fix: #259975

Since I didn’t modify the helper function in the 19.0 forward-port, I didn’t realize the existing fallback with self.name would cause additional dynamic reports without print_report_name to use the invoice filename.

Thanks

Comment thread addons/account/models/account_move.py Outdated
@evlin-odoo evlin-odoo force-pushed the 19.0-opw-6207518-evlin branch from 3f53595 to 09715b0 Compare May 18, 2026 14:37
Comment on lines +275 to +277
filename = move._get_invoice_report_filename(report=extra_mail_template)
if not extra_mail_template.print_report_name:
filename = f'{extra_mail_template.name.lower()}_{move.name}.pdf'
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not if / else? It seem unnecessary to compute the filename just to override it

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, good point

Problem:
When adding additional dynamic reports to the “Invoice: Send by Email”
template, reports without a configured `print_report_name`
incorrectly use the invoice filename. This is an issue because
multiple attachments can have the same exact filename.

Example from related ticket: the user attached timesheets to their
template and both the invoice PDF and timesheet attachment used the
same filename.

Expected:
The additional report should use its own fallback filename
(ex: `timesheets_INV_XXX.pdf`) or its configured
`print_report_name`.

Actual:
The additional report uses the invoice filename instead.

To fix this, reports without `print_report_name` now fallback to:
`<report name>_<invoice name>.pdf` as done in v18.0

Related Ticket: 6207518 and 6175376
@evlin-odoo evlin-odoo force-pushed the 19.0-opw-6207518-evlin branch from 09715b0 to fb9fe32 Compare May 19, 2026 13:22
Copy link
Copy Markdown
Contributor

@svfu-odoo svfu-odoo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!
@robodoo r+

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants