From 00d36d14fb20103956f9391842d6c7e6d8bb0cf3 Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Fri, 5 Jan 2024 15:56:04 +0530 Subject: [PATCH] refactor: allow sales invoice in Bank Reconciliation tool (cherry picked from commit b69cdeb4a6c881642fd2e3a081f13b65191d44bc) --- .../bank_transaction/bank_transaction.py | 18 ++++++++++-------- erpnext/hooks.py | 1 + 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/erpnext/accounts/doctype/bank_transaction/bank_transaction.py b/erpnext/accounts/doctype/bank_transaction/bank_transaction.py index 629ed1cf751a..57f7c0eca338 100644 --- a/erpnext/accounts/doctype/bank_transaction/bank_transaction.py +++ b/erpnext/accounts/doctype/bank_transaction/bank_transaction.py @@ -366,15 +366,17 @@ def set_voucher_clearance(doctype, docname, clearance_date, self): and len(get_reconciled_bank_transactions(doctype, docname)) < 2 ): return - frappe.db.set_value(doctype, docname, "clearance_date", clearance_date) - elif doctype == "Sales Invoice": - frappe.db.set_value( - "Sales Invoice Payment", - dict(parenttype=doctype, parent=docname), - "clearance_date", - clearance_date, - ) + if doctype == "Sales Invoice": + frappe.db.set_value( + "Sales Invoice Payment", + dict(parenttype=doctype, parent=docname), + "clearance_date", + clearance_date, + ) + return + + frappe.db.set_value(doctype, docname, "clearance_date", clearance_date) elif doctype == "Bank Transaction": # For when a second bank transaction has fixed another, e.g. refund diff --git a/erpnext/hooks.py b/erpnext/hooks.py index 78bb2d2c270f..d5cb6f5b9813 100644 --- a/erpnext/hooks.py +++ b/erpnext/hooks.py @@ -494,6 +494,7 @@ "Payment Entry", "Journal Entry", "Purchase Invoice", + "Sales Invoice", ] accounting_dimension_doctypes = [