[FIX] account: reconcile each account only once when reversing an entry

Before that, when reversing an account.move, if two lines of the move shared the same account, we tried reconciling them once for each line: it worked the first time but triggered an error message the second, since the lines had already been reconciled.
This commit is contained in:
Olivier Colson
2018-11-05 12:29:08 +01:00
parent c552e368b3
commit 714bf1b0ab
+1 -1
View File
@@ -254,7 +254,7 @@ class AccountMove(models.Model):
aml = ac_move.line_ids.filtered(lambda x: x.account_id.reconcile or x.account_id.internal_type == 'liquidity')
aml.remove_move_reconcile()
#reconcile together the reconciliable and the liquidity aml and their newly created counterpart
for account in [x.account_id for x in aml]:
for account in set([x.account_id for x in aml]):
to_rec = aml.filtered(lambda y: y.account_id == account)
to_rec |= reversed_move.line_ids.filtered(lambda y: y.account_id == account)
to_rec.reconcile()