Merge pull request #16207 from Zlash65/fix-qi

[Minor] Make Quality Inspection in query configurable
This commit is contained in:
rohitwaghchaure 2018-12-17 13:55:26 +05:30 committed by GitHub
commit 37d7d25018
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

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