Merge pull request #39161 from ruthra-kumar/allow_sales_invoice_in_bank_reconciliation

refactor: allow sales invoice in Bank Reconciliation tool
diff --git a/erpnext/accounts/doctype/bank_transaction/bank_transaction.py b/erpnext/accounts/doctype/bank_transaction/bank_transaction.py
index 629ed1c..57f7c0e 100644
--- a/erpnext/accounts/doctype/bank_transaction/bank_transaction.py
+++ b/erpnext/accounts/doctype/bank_transaction/bank_transaction.py
@@ -366,15 +366,17 @@
 			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 0f80d5e..6efb893 100644
--- a/erpnext/hooks.py
+++ b/erpnext/hooks.py
@@ -489,6 +489,7 @@
 	"Payment Entry",
 	"Journal Entry",
 	"Purchase Invoice",
+	"Sales Invoice",
 ]
 
 accounting_dimension_doctypes = [