[FIX] account: preview not displayed when uploading a pdf

Steps to reproduce:
1. Customer invoices
2. Upload button
3. Choose a PDF
4. The created invoice does not display the pdf preview

Related commits: a644766 and 0ab0a92

closes odoo/odoo#109166

X-original-commit: 7cf3f11d5072c2655802e38757b63293a9cf9d48
Signed-off-by: Laurent Smet <las@odoo.com>
Signed-off-by: Ricardo Gomes Rodrigues (rigr) <rigr@odoo.com>
This commit is contained in:
Ricardo Gomes Rodrigues (rigr)
2023-01-05 15:37:37 +01:00
parent bc1b242021
commit 8726fcf822
+1
View File
@@ -717,6 +717,7 @@ class AccountJournal(models.Model):
if not invoice:
invoice = self.env['account.move'].create({})
invoice.with_context(no_new_invoice=True).message_post(attachment_ids=[attachment.id])
attachment.write({'res_model': 'account.move', 'res_id': invoice.id})
invoices += invoice
return invoices