minot fix in material request

This commit is contained in:
Nabin Hait 2014-08-18 15:38:53 +05:30
parent 32a3a86a00
commit 448c9b71c1

View File

@ -287,6 +287,7 @@ def make_purchase_order_based_on_supplier(source_name, target_doc=None):
def get_material_requests_based_on_supplier(supplier): def get_material_requests_based_on_supplier(supplier):
supplier_items = [d[0] for d in frappe.db.get_values("Item", supplier_items = [d[0] for d in frappe.db.get_values("Item",
{"default_supplier": supplier})] {"default_supplier": supplier})]
if supplier_items:
material_requests = frappe.db.sql_list("""select distinct mr.name material_requests = frappe.db.sql_list("""select distinct mr.name
from `tabMaterial Request` mr, `tabMaterial Request Item` mr_item from `tabMaterial Request` mr, `tabMaterial Request Item` mr_item
where mr.name = mr_item.parent where mr.name = mr_item.parent
@ -296,6 +297,8 @@ def get_material_requests_based_on_supplier(supplier):
and mr.docstatus = 1 and mr.docstatus = 1
and mr.status != 'Stopped'""" % ', '.join(['%s']*len(supplier_items)), and mr.status != 'Stopped'""" % ', '.join(['%s']*len(supplier_items)),
tuple(supplier_items)) tuple(supplier_items))
else:
material_requests = []
return material_requests, supplier_items return material_requests, supplier_items
@frappe.whitelist() @frappe.whitelist()