Remove clearing move before unreconcile

The unreconciliation and deletion can trigger event that could try to use the
clearing move via the link on payment before it is deleted.

issue6786
review42661002
This commit is contained in:
Cédric Krier committed 2017-09-28 23:43:27 +02:00
1 parent 54bbb5b323
commit 780d1c7d4f
1 file changed
+5 -2
+5 -2
View File
@@ -202,6 +202,11 @@ class Payment:
if line.account.reconcile:
to_reconcile[payment.party][line.account].append(
line)
# Remove clearing_move before delete in case reconciliation triggers
# would use it.
cls.write(payments, {'clearing_move': None})
if to_unreconcile:
Reconciliation.delete(to_unreconcile)
if to_delete:
@@ -210,8 +215,6 @@ class Payment:
for lines in to_reconcile[party].itervalues():
Line.reconcile(lines)
cls.write(payments, {'clearing_move': None})
class Succeed(Wizard):
"Succeed Payment"