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,15 +287,18 @@ def make_purchase_order_based_on_supplier(source_name, target_doc=None):
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()