diff --git a/erpnext/stock/doctype/quality_inspection/quality_inspection.py b/erpnext/stock/doctype/quality_inspection/quality_inspection.py index 36f6405ae4..e0b738202c 100644 --- a/erpnext/stock/doctype/quality_inspection/quality_inspection.py +++ b/erpnext/stock/doctype/quality_inspection/quality_inspection.py @@ -61,7 +61,7 @@ def item_query(doctype, txt, searchfield, start, page_len, filters): if filters.get("from"): from frappe.desk.reportview import get_match_cond mcond = get_match_cond(filters["from"]) - cond = "" + cond, qi_condition = "", "and (quality_inspection is null or quality_inspection = '')" if filters.get('from') in ['Purchase Invoice Item', 'Purchase Receipt Item']: cond = """and item_code in (select name from `tabItem` where @@ -72,9 +72,13 @@ def item_query(doctype, txt, searchfield, start, page_len, filters): elif filters.get('from') == 'Stock Entry Detail': cond = """and s_warehouse is null""" + if filters.get('from') in ['Supplier Quotation Item']: + qi_condition = "" + return frappe.db.sql(""" select item_code from `tab{doc}` where parent=%(parent)s and docstatus < 2 and item_code like %(txt)s - and (quality_inspection is null or quality_inspection = '') - {cond} {mcond} order by item_code limit {start}, {page_len}""".format(doc=filters.get('from'), - parent=filters.get('parent'), cond=cond, mcond=mcond, start=start, page_len = page_len), + {qi_condition} {cond} {mcond} + order by item_code limit {start}, {page_len}""".format(doc=filters.get('from'), + parent=filters.get('parent'), cond = cond, mcond = mcond, start = start, + page_len = page_len, qi_condition = qi_condition), {'parent': filters.get('parent'), 'txt': "%%%s%%" % txt})