From 8726fcf82208d352580eeaffa2c91960331bbd8e Mon Sep 17 00:00:00 2001 From: "Ricardo Gomes Rodrigues (rigr)" Date: Thu, 5 Jan 2023 08:25:35 +0000 Subject: [PATCH] [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 Signed-off-by: Ricardo Gomes Rodrigues (rigr) --- addons/account/models/account_journal.py | 1 + 1 file changed, 1 insertion(+) diff --git a/addons/account/models/account_journal.py b/addons/account/models/account_journal.py index 640741b5665..9133d8c9f15 100644 --- a/addons/account/models/account_journal.py +++ b/addons/account/models/account_journal.py @@ -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