[FIX] account: Payment cancelled when cancelling statement line

Steps to reproduce:

1. Create a payment of 999 with bank
2. Create a statement line of 1000 on bank journal
3. Go to reconcile interface, choose the 999 line and make an adjustment of 1
4. The payment has been reconciled with the statement line, and one new journal
entry has been created for adjustment of "1"
5. Cancel statement line (you need to enable this functionality on bank journal)

Bug:The payment journal entry of 999 is deleted and payment remains confirmed

After the fix: The payment journal entry of 999 is UNRECONCILED and the payment
entry still exists.

opw:741619
This commit is contained in:
Goffin Simon
2017-05-10 15:10:02 +02:00
parent 7a9d57bd1f
commit a1aed26d52
@@ -424,7 +424,7 @@ class AccountBankStatementLine(models.Model):
payment_to_unreconcile |= line.payment_id
if st_line.move_name and line.payment_id.payment_reference == st_line.move_name:
#there can be several moves linked to a statement line but maximum one created by the line itself
moves_to_cancel |= st_line.journal_entry_ids
moves_to_cancel |= move
payment_to_cancel |= line.payment_id
moves_to_unbind = moves_to_unbind - moves_to_cancel