[fix] warehouse query fixes https://github.com/frappe/erpnext/issues/10537 (#10538)
This commit is contained in:
parent
2d2b12c800
commit
7e506af0b9
@ -370,28 +370,27 @@ def warehouse_query(doctype, txt, searchfield, start, page_len, filters):
|
|||||||
bin_conditions=get_filters_cond(doctype, filter_dict.get("Bin"),
|
bin_conditions=get_filters_cond(doctype, filter_dict.get("Bin"),
|
||||||
bin_conditions, ignore_permissions=True))
|
bin_conditions, ignore_permissions=True))
|
||||||
|
|
||||||
response = frappe.db.sql("""select `tabWarehouse`.name,
|
query = """select `tabWarehouse`.name,
|
||||||
CONCAT_WS(" : ", "Actual Qty", ifnull( ({sub_query}), 0) ) as actual_qty
|
CONCAT_WS(" : ", "Actual Qty", ifnull( ({sub_query}), 0) ) as actual_qty
|
||||||
from `tabWarehouse`
|
from `tabWarehouse`
|
||||||
where
|
where
|
||||||
`tabWarehouse`.`{key}` like %(txt)s
|
`tabWarehouse`.`{key}` like '{txt}'
|
||||||
{fcond} {mcond}
|
{fcond} {mcond}
|
||||||
order by
|
order by
|
||||||
`tabWarehouse`.name desc
|
`tabWarehouse`.name desc
|
||||||
limit
|
limit
|
||||||
%(start)s, %(page_len)s
|
{start}, {page_len}
|
||||||
""".format(
|
""".format(
|
||||||
sub_query=sub_query,
|
sub_query=sub_query,
|
||||||
key=frappe.db.escape(searchfield),
|
key=frappe.db.escape(searchfield),
|
||||||
fcond=get_filters_cond(doctype, filter_dict.get("Warehouse"), conditions),
|
fcond=get_filters_cond(doctype, filter_dict.get("Warehouse"), conditions),
|
||||||
mcond=get_match_cond(doctype)
|
mcond=get_match_cond(doctype),
|
||||||
),
|
start=start,
|
||||||
{
|
page_len=page_len,
|
||||||
"txt": "%%%s%%" % frappe.db.escape(txt),
|
txt=frappe.db.escape('%{0}%'.format(txt))
|
||||||
"start": start,
|
)
|
||||||
"page_len": page_len
|
|
||||||
})
|
return frappe.db.sql(query)
|
||||||
return response
|
|
||||||
|
|
||||||
|
|
||||||
def get_doctype_wise_filters(filters):
|
def get_doctype_wise_filters(filters):
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user