From 75e9cd9e8f2296b6df64349d94b75f85b4f7061d Mon Sep 17 00:00:00 2001 From: Khushi Rawat <142375893+khushi8112@users.noreply.github.com> Date: Thu, 28 May 2026 15:19:42 +0530 Subject: [PATCH] Revert "fix: block cancellation if reconciled with a Bank Transaction" --- .../bank_transaction/test_bank_transaction.py | 8 +++---- .../doctype/payment_entry/payment_entry.py | 24 ------------------- 2 files changed, 3 insertions(+), 29 deletions(-) diff --git a/erpnext/accounts/doctype/bank_transaction/test_bank_transaction.py b/erpnext/accounts/doctype/bank_transaction/test_bank_transaction.py index c2aeda697df..c7668a5a592 100644 --- a/erpnext/accounts/doctype/bank_transaction/test_bank_transaction.py +++ b/erpnext/accounts/doctype/bank_transaction/test_bank_transaction.py @@ -97,14 +97,12 @@ class TestBankTransaction(ERPNextTestSuite): ] ) reconcile_vouchers(bank_transaction.name, vouchers) - bank_transaction.reload() - bank_transaction.remove_payment_entries() - bank_transaction.reload() - self.assertEqual(bank_transaction.unallocated_amount, 1700) - self.assertEqual(bank_transaction.payment_entries, []) payment.reload() payment.cancel() + bank_transaction.reload() self.assertEqual(bank_transaction.docstatus, DocStatus.submitted()) + self.assertEqual(bank_transaction.unallocated_amount, 1700) + self.assertEqual(bank_transaction.payment_entries, []) # Check if ERPNext can correctly filter a linked payments based on the debit/credit amount def test_debit_credit_output(self): diff --git a/erpnext/accounts/doctype/payment_entry/payment_entry.py b/erpnext/accounts/doctype/payment_entry/payment_entry.py index 8bface5db11..357df56c5e9 100644 --- a/erpnext/accounts/doctype/payment_entry/payment_entry.py +++ b/erpnext/accounts/doctype/payment_entry/payment_entry.py @@ -292,30 +292,6 @@ class PaymentEntry(AccountsController): alert=True, ) - def before_cancel(self): - from erpnext.accounts.doctype.bank_transaction.bank_transaction import ( - get_reconciled_bank_transactions, - ) - - linked_bank_transactions = get_reconciled_bank_transactions(self.doctype, self.name) - - active_bank_transactions = [] - if linked_bank_transactions: - active_bank_transactions = frappe.get_all( - "Bank Transaction", - filters={"name": ("in", linked_bank_transactions), "docstatus": 1}, - pluck="name", - ) - if active_bank_transactions: - frappe.throw( - _( - "Payment Entry {0} is reconciled with Bank Transaction(s): {1}. Please unreconcile it before cancelling." - ).format( - frappe.bold(self.name), - ", ".join(frappe.bold(bt) for bt in active_bank_transactions), - ) - ) - def on_cancel(self): self.ignore_linked_doctypes = ( "GL Entry",