[FIX] account_invoice_update_wizard : avoid stacktrace when no pdf is found

This commit is contained in:
Florian da Costa
2024-10-10 09:12:48 +02:00
parent 4c067fef09
commit db33820a57

View File

@@ -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