Fixes in link field queries
diff --git a/erpnext/controllers/queries.py b/erpnext/controllers/queries.py
index b876a2b..4547276 100644
--- a/erpnext/controllers/queries.py
+++ b/erpnext/controllers/queries.py
@@ -37,7 +37,7 @@
%(mcond)s
order by
if(locate("%(_txt)s", name), locate("%(_txt)s", name), 99999),
- if(locate("%(_txt)s", employee_name), locate("%(_txt)s", item_name), 99999),
+ if(locate("%(_txt)s", employee_name), locate("%(_txt)s", employee_name), 99999),
name, employee_name
limit %(start)s, %(page_len)s""" % {'key': searchfield, 'txt': "%%%s%%" % txt,
'_txt': txt.replace("%", ""),
@@ -54,8 +54,8 @@
%(mcond)s
order by
if(locate("%(_txt)s", name), locate("%(_txt)s", name), 99999),
- if(locate("%(_txt)s", lead_name), locate("%(_txt)s", name), 99999),
- if(locate("%(_txt)s", company_name), locate("%(_txt)s", name), 99999),
+ if(locate("%(_txt)s", lead_name), locate("%(_txt)s", lead_name), 99999),
+ if(locate("%(_txt)s", company_name), locate("%(_txt)s", company_name), 99999),
name, lead_name
limit %(start)s, %(page_len)s""" % {'key': searchfield, 'txt': "%%%s%%" % txt,
'_txt': txt.replace("%", ""),
@@ -79,7 +79,7 @@
%(mcond)s
order by
if(locate("%(_txt)s", name), locate("%(_txt)s", name), 99999),
- if(locate("%(_txt)s", customer_name), locate("%(_txt)s", name), 99999),
+ if(locate("%(_txt)s", customer_name), locate("%(_txt)s", customer_name), 99999),
name, customer_name
limit %(start)s, %(page_len)s""" % {'field': fields,'key': searchfield,
'txt': "%%%s%%" % txt, '_txt': txt.replace("%", ""),
@@ -102,7 +102,7 @@
%(mcond)s
order by
if(locate("%(_txt)s", name), locate("%(_txt)s", name), 99999),
- if(locate("%(_txt)s", supplier_name), locate("%(_txt)s", name), 99999),
+ if(locate("%(_txt)s", supplier_name), locate("%(_txt)s", supplier_name), 99999),
name, supplier_name
limit %(start)s, %(page_len)s """ % {'field': fields,'key': searchfield,
'txt': "%%%s%%" % txt, '_txt': txt.replace("%", ""),