diff --git a/addons/account/models/account_invoice.py b/addons/account/models/account_invoice.py index c428b8ba5719581093b4bbe5a78e251462d4839a..5f415d71b4bdb1b2781cfd1cbbb9433a2962baca 100644 --- a/addons/account/models/account_invoice.py +++ b/addons/account/models/account_invoice.py @@ -495,6 +495,8 @@ class AccountInvoice(models.Model): self.write({'state': 'draft', 'date': False}) self.delete_workflow() self.create_workflow() + # Delete attachments now since an invoice can also be generated when the invoice is cancelled + self.env['ir.attachment'].search([('res_model', '=', self._name), ('res_id', 'in', self.ids)]).unlink() return True @api.multi