[fix] do not escape % while using clause (#13677)

This commit is contained in:
Saurabh 2018-04-17 11:56:46 +05:30 committed by Nabin Hait
parent ea1408f2e0
commit 9fbb8192e1
2 changed files with 5 additions and 5 deletions

View File

@ -104,7 +104,7 @@ def get_stock_ledger_entries(filters, items):
item_conditions_sql = ''
if items:
item_conditions_sql = ' and sle.item_code in ({})'\
.format(', '.join(['"' + frappe.db.escape(i) + '"' for i in items]))
.format(', '.join(['"' + frappe.db.escape(i, percent=False) + '"' for i in items]))
conditions = get_conditions(filters)
@ -205,7 +205,7 @@ def get_item_details(items, sle, filters):
select name, item_name, description, item_group, brand, stock_uom
from `tabItem`
where name in ({0})
""".format(', '.join(['"' + frappe.db.escape(i) + '"' for i in items])), as_dict=1):
""".format(', '.join(['"' + frappe.db.escape(i, percent=False) + '"' for i in items])), as_dict=1):
item_details.setdefault(item.name, item)
if filters.get('show_variant_attributes', 0) == 1:
@ -219,7 +219,7 @@ def get_item_reorder_details(items):
select parent, warehouse, warehouse_reorder_qty, warehouse_reorder_level
from `tabItem Reorder`
where parent in ({0})
""".format(', '.join(['"' + frappe.db.escape(i) + '"' for i in items])), as_dict=1)
""".format(', '.join(['"' + frappe.db.escape(i, percent=False) + '"' for i in items])), as_dict=1)
return dict((d.parent + d.warehouse, d) for d in item_reorder_details)

View File

@ -56,7 +56,7 @@ def get_stock_ledger_entries(filters, items):
item_conditions_sql = ''
if items:
item_conditions_sql = 'and sle.item_code in ({})'\
.format(', '.join(['"' + frappe.db.escape(i) + '"' for i in items]))
.format(', '.join(['"' + frappe.db.escape(i,percent=False) + '"' for i in items]))
return frappe.db.sql("""select concat_ws(" ", posting_date, posting_time) as date,
item_code, warehouse, actual_qty, qty_after_transaction, incoming_rate, valuation_rate,
@ -97,7 +97,7 @@ def get_item_details(items, sl_entries):
select name, item_name, description, item_group, brand, stock_uom
from `tabItem`
where name in ({0})
""".format(', '.join(['"' + frappe.db.escape(i) + '"' for i in items])), as_dict=1):
""".format(', '.join(['"' + frappe.db.escape(i,percent=False) + '"' for i in items])), as_dict=1):
item_details.setdefault(item.name, item)
return item_details