Skip to content
Snippets Groups Projects
Commit ba32244c authored by Goffin Simon's avatar Goffin Simon
Browse files

[FIX] account: Printing journal entries


Steps to reproduce the bug:

- Accounting - Journal Entries - form view - Print - Invoices

Bug:

A UserError was raised 'Only invoices could be printed.' but in the attachment,
the PDF was generated.

opw:2452278

closes odoo/odoo#65446

Signed-off-by: default avatarLaurent Smet <smetl@users.noreply.github.com>
parent 9df7ff52
No related branches found
No related tags found
No related merge requests found
......@@ -12,6 +12,8 @@ class IrActionsReport(models.Model):
if record.message_main_attachment_id.mimetype == 'application/pdf' or \
record.message_main_attachment_id.mimetype.startswith('image'):
return record.message_main_attachment_id
if self.report_name in ('account.report_invoice_with_payments', 'account.report_invoice') and not record.is_invoice():
raise UserError(_("Only invoices could be printed."))
return super(IrActionsReport, self).retrieve_attachment(record)
def _post_pdf(self, save_in_attachment, pdf_content=None, res_ids=None):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment