Filters is not working

I am trying to enter value manually form the drop down list for example - if i type number or anything in letters then drop down list does not filter according to what i typed…(i mentioned in screenshot)I am using ERPNext: v10.1.53 (master) any idea to filter

i am stuck in this issue is there any idea? y it is not filtering in drop down based on what i type in the field…

TIA,
Nivedha

do you add the field Batch No manually on Material Request Item ?

yes Batch No is a link field in material request…here i am trying to enter the number or letters the drop down is not filtering based on what i typed in the field.

hi all any idea about this case?

you have to add search fields in doctype where your batch no is linked

i tried what u said but still it is not filtering based on what i typed from the drop down in the field

i have wrote a query for this filter based on item list of approved batches will be displayed in this ‘Batch No’ field according to filter query it is getting displayed in the drop down but from that drop down if i type number or letters it is not getting filtered…

hi all still i stuck in this problem is there any possiblities to solve this ?

kindly share js and py code that you have written

if you are using set_query then you can use this
in py

def get_custom_query_(doctype, txt, searchfield, start, page_len, filters):

return frappe.db.sql(“”" select name from tabSupplier a where a.{key} LIKE %(txt)s “”".format(key=searchfield), {
‘txt’: “%%%s%%” % frappe.db.escape(txt)})

each time you type in link field set query will be called from js so python method will get hit each time

2 Likes

hi @AkshayJadhao thanks a lot now it is executing :grinning::+1:

This type of filter not working for me …pls anyone help. i tried like,

def item_group_query(doctype, txt, searchfield, start, page_len, filters):
cond = “”
cond = " is_group = 0 and role in (‘" + "’,‘".join(frappe.get_roles(frappe.session.user)) + "’)"

    return frappe.db.sql("""select name from `tabItem Group` a where a.{key} LIKE %(txt)s and {cond}""".format(key=searchfield,cond=cond),{
                    'txt': "%%%s%%" % frappe.db.escape(txt)})