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
This commit is contained in:
Pranav Nachnekar 2019-11-25 06:34:00 +00:00 committed by Anurag Mishra
parent c9203a1bee
commit 04e3a506e4
2 changed files with 2 additions and 14 deletions

View File

@ -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
}
}
})

View File

@ -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
})