fix: Primary address not being fetched for customer (#19667)

* fix: priamry address not being fetched

* add doctype to filter for customer_primary_address

* remove get_customer_primary_address_method
diff --git a/erpnext/selling/doctype/customer/customer.js b/erpnext/selling/doctype/customer/customer.js
index 458a56c..cca8efe 100644
--- a/erpnext/selling/doctype/customer/customer.js
+++ b/erpnext/selling/doctype/customer/customer.js
@@ -49,9 +49,9 @@
 		})
 		frm.set_query('customer_primary_address', function(doc) {
 			return {
-				query: "erpnext.selling.doctype.customer.customer.get_customer_primary_address",
 				filters: {
-					'customer': doc.name
+					'link_doctype': 'Customer',
+					'link_name': doc.name
 				}
 			}
 		})
diff --git a/erpnext/selling/doctype/customer/customer.py b/erpnext/selling/doctype/customer/customer.py
index a8e3ce4..67e20b1 100644
--- a/erpnext/selling/doctype/customer/customer.py
+++ b/erpnext/selling/doctype/customer/customer.py
@@ -397,15 +397,3 @@
 			'customer': customer,
 			'txt': '%%%s%%' % txt
 		})
-
-def get_customer_primary_address(doctype, txt, searchfield, start, page_len, filters):
-	customer = frappe.db.escape(filters.get('customer'))
-	return frappe.db.sql("""
-		select `tabAddress`.name from `tabAddress`, `tabDynamic Link`
-			where `tabAddress`.name = `tabDynamic Link`.parent and `tabDynamic Link`.link_name = %(customer)s
-			and `tabDynamic Link`.link_doctype = 'Customer'
-			and `tabAddress`.name like %(txt)s
-		""", {
-			'customer': customer,
-			'txt': '%%%s%%' % txt
-		})