[FIX] account: delete attachment
When an invoice is cancelled, the attachments (including the printed invoice) are not deleted. If the users resets the invoice to draft, modify it, then print it again, the previously generated document will be used instead. opw-674678
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user