Merge pull request #222 from akretion/14-fix-invoice-update-pdf-unlink

[FIX] account_invoice_update_wizard : avoid stacktrace when no pdf is…
This commit is contained in:
Florian
2024-10-10 09:18:57 +02:00
committed by GitHub

View File

@@ -229,7 +229,10 @@ class AccountMoveUpdate(models.TransientModel):
'wizard.')) 'wizard.'))
# Purge existing PDF # Purge existing PDF
report = self.env.ref("account.account_invoices") 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 return True