diff --git a/erpnext/selling/doctype/customer/customer.js b/erpnext/selling/doctype/customer/customer.js index 458a56c9e7..cca8efeca4 100644 --- a/erpnext/selling/doctype/customer/customer.js +++ b/erpnext/selling/doctype/customer/customer.js @@ -49,9 +49,9 @@ frappe.ui.form.on("Customer", { }) 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 a8e3ce4eae..67e20b1e89 100644 --- a/erpnext/selling/doctype/customer/customer.py +++ b/erpnext/selling/doctype/customer/customer.py @@ -397,15 +397,3 @@ def get_customer_primary_contact(doctype, txt, searchfield, start, page_len, fil '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 - })