minot fix in material request
diff --git a/erpnext/stock/doctype/material_request/material_request.py b/erpnext/stock/doctype/material_request/material_request.py
index 89121e3..10b5114 100644
--- a/erpnext/stock/doctype/material_request/material_request.py
+++ b/erpnext/stock/doctype/material_request/material_request.py
@@ -287,15 +287,18 @@
def get_material_requests_based_on_supplier(supplier):
supplier_items = [d[0] for d in frappe.db.get_values("Item",
{"default_supplier": supplier})]
- material_requests = frappe.db.sql_list("""select distinct mr.name
- from `tabMaterial Request` mr, `tabMaterial Request Item` mr_item
- where mr.name = mr_item.parent
- and mr_item.item_code in (%s)
- and mr.material_request_type = 'Purchase'
- and ifnull(mr.per_ordered, 0) < 99.99
- and mr.docstatus = 1
- and mr.status != 'Stopped'""" % ', '.join(['%s']*len(supplier_items)),
- tuple(supplier_items))
+ if supplier_items:
+ material_requests = frappe.db.sql_list("""select distinct mr.name
+ from `tabMaterial Request` mr, `tabMaterial Request Item` mr_item
+ where mr.name = mr_item.parent
+ and mr_item.item_code in (%s)
+ and mr.material_request_type = 'Purchase'
+ and ifnull(mr.per_ordered, 0) < 99.99
+ and mr.docstatus = 1
+ and mr.status != 'Stopped'""" % ', '.join(['%s']*len(supplier_items)),
+ tuple(supplier_items))
+ else:
+ material_requests = []
return material_requests, supplier_items
@frappe.whitelist()