mirror of
https://github.com/frappe/erpnext.git
synced 2026-06-03 12:19:12 +00:00
Merge pull request #55385 from frappe/revert-55360-validate-pe-cancel-on-bank-reconciliation
Revert "fix: block cancellation if reconciled with a Bank Transaction"
This commit is contained in:
@@ -97,14 +97,12 @@ class TestBankTransaction(ERPNextTestSuite):
|
|||||||
]
|
]
|
||||||
)
|
)
|
||||||
reconcile_vouchers(bank_transaction.name, vouchers)
|
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.reload()
|
||||||
payment.cancel()
|
payment.cancel()
|
||||||
|
bank_transaction.reload()
|
||||||
self.assertEqual(bank_transaction.docstatus, DocStatus.submitted())
|
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
|
# Check if ERPNext can correctly filter a linked payments based on the debit/credit amount
|
||||||
def test_debit_credit_output(self):
|
def test_debit_credit_output(self):
|
||||||
|
|||||||
@@ -292,30 +292,6 @@ class PaymentEntry(AccountsController):
|
|||||||
alert=True,
|
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):
|
def on_cancel(self):
|
||||||
self.ignore_linked_doctypes = (
|
self.ignore_linked_doctypes = (
|
||||||
"GL Entry",
|
"GL Entry",
|
||||||
|
|||||||
Reference in New Issue
Block a user