Merge pull request #39329 from frappe/mergify/bp/version-15-hotfix/pr-38974

fix: unreconciled Bank Transaction on cancel of payment voucher (#38974)
This commit is contained in:
Deepesh Garg
2024-01-14 17:55:32 +05:30
committed by GitHub
7 changed files with 74 additions and 7 deletions

View File

@@ -1414,11 +1414,16 @@ class AccountsController(TransactionBase):
reconcile_against_document(lst)
def on_cancel(self):
from erpnext.accounts.doctype.bank_transaction.bank_transaction import (
remove_from_bank_transaction,
)
from erpnext.accounts.utils import (
cancel_exchange_gain_loss_journal,
unlink_ref_doc_from_payment_entries,
)
remove_from_bank_transaction(self.doctype, self.name)
if self.doctype in ["Sales Invoice", "Purchase Invoice", "Payment Entry", "Journal Entry"]:
# Cancel Exchange Gain/Loss Journal before unlinking
cancel_exchange_gain_loss_journal(self)