Skip to content
Snippets Groups Projects
Commit 509ce618 authored by Goffin Simon's avatar Goffin Simon
Browse files

[FIX] account: unlink account journal

The bank account linked to a journal cannot be systematicaly deleted
with its journal because this bank account can be linked to several
journals.

opw:676374
parent 0d929dc8
No related branches found
No related tags found
No related merge requests found
......@@ -293,7 +293,11 @@ class AccountJournal(models.Model):
@api.multi
def unlink(self):
bank_accounts = self.mapped('bank_account_id')
bank_accounts = self.env['res.partner.bank'].browse()
for bank_account in self.mapped('bank_account_id'):
accounts = self.search([('bank_account_id', '=', bank_account.id)])
if accounts <= self:
bank_accounts += bank_account
ret = super(AccountJournal, self).unlink()
bank_accounts.unlink()
return ret
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment