This filter does not work. It will always display all the customer even I put this filter. I already tried to reload. There is no error in JS Console. Any idea why?
@rmehta@anand as I dig deeper I have found out that when a field is link to a customer doctyype it will used a standard query which is erpnext.selling.doctype.customer.customer.get_customer_list and when I look at get_customer_list erpnext/customer.py at develop · frappe/erpnext · GitHub
filter parameter is not used. Is this intentional? How will I filter a link column to a customer doctype?
def get_customer_list(doctype, txt, searchfield, start, page_len, filters):
if frappe.db.get_default("cust_master_name") == "Customer Name":
fields = ["name", "customer_group", "territory"]
else:
fields = ["name", "customer_name", "customer_group", "territory"]
match_conditions = build_match_conditions("Customer")
match_conditions = "and {}".format(match_conditions) if match_conditions else ""
return frappe.db.sql("""select %s from `tabCustomer` where docstatus < 2
and (%s like %s or customer_name like %s)
{match_conditions}
order by
case when name like %s then 0 else 1 end,
case when customer_name like %s then 0 else 1 end,
name, customer_name limit %s, %s""".format(match_conditions=match_conditions) %
(", ".join(fields), searchfield, "%s", "%s", "%s", "%s", "%s", "%s"),
("%%%s%%" % txt, "%%%s%%" % txt, "%%%s%%" % txt, "%%%s%%" % txt, start, page_len))
i understand
1 residences is AppName
2 residences is module name
3 doctype for doctype reference
4 payment is doctype
5 payment is fieldname (?)
6 get_active_tenant — I CAN NOT UNDERSTAND IT.
(how get_active_tenant to be define)
i got partial idea from your refernce :
erpnext.selling.doctype.customer.customer.get_customer_list
Please give detail explaination as it is very useful for all…