From 03c3f8c15dcc192abd73d138e8e01060b8b34f68 Mon Sep 17 00:00:00 2001 From: Florian da Costa Date: Thu, 10 Oct 2024 09:12:48 +0200 Subject: [PATCH] [FIX] account_invoice_update_wizard : avoid stacktrace when no pdf is found --- account_invoice_update_wizard/wizard/account_move_update.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/account_invoice_update_wizard/wizard/account_move_update.py b/account_invoice_update_wizard/wizard/account_move_update.py index 40cbdfe..873829f 100644 --- a/account_invoice_update_wizard/wizard/account_move_update.py +++ b/account_invoice_update_wizard/wizard/account_move_update.py @@ -229,7 +229,10 @@ class AccountMoveUpdate(models.TransientModel): 'wizard.')) # Purge existing PDF report = self.env.ref("account.account_invoices") - report.retrieve_attachment(inv).unlink() + attachment = report.retrieve_attachment(inv) + # attachment may be None + if attachment: + attachment.unlink() return True