diff --git a/erpnext/manufacturing/doctype/production_plan/production_plan.py b/erpnext/manufacturing/doctype/production_plan/production_plan.py
index f57a911..1ad6e64 100644
--- a/erpnext/manufacturing/doctype/production_plan/production_plan.py
+++ b/erpnext/manufacturing/doctype/production_plan/production_plan.py
@@ -9,7 +9,7 @@
 from erpnext.manufacturing.doctype.bom.bom import validate_bom_no
 from frappe.utils import cstr, flt, cint, nowdate, add_days, comma_and, now_datetime, ceil
 from erpnext.manufacturing.doctype.work_order.work_order import get_item_details
-from six import string_types
+from six import string_types, iteritems
 from erpnext.setup.doctype.item_group.item_group import get_item_group_defaults
 
 class ProductionPlan(Document):
@@ -372,9 +372,9 @@
 		else :
 			msgprint(_("No material request created"))
 
-def get_exploded_items(bom_wise_item_details, company, bom_no, include_non_stock_items):
+def get_exploded_items(item_details, company, bom_no, include_non_stock_items, planned_qty=1):
 	for d in frappe.db.sql("""select bei.item_code, item.default_bom as bom,
-			ifnull(sum(bei.stock_qty/ifnull(bom.quantity, 1)), 0) as qty, item.item_name,
+			ifnull(sum(bei.stock_qty/ifnull(bom.quantity, 1)), 0)*%s as qty, item.item_name,
 			bei.description, bei.stock_uom, item.min_order_qty, bei.source_warehouse,
 			item.default_material_request_type, item.min_order_qty, item_default.default_warehouse,
 			item.purchase_uom, item_uom.conversion_factor
@@ -390,15 +390,16 @@
 			bei.docstatus < 2
 			and bom.name=%s and item.is_stock_item in (1, {0})
 		group by bei.item_code, bei.stock_uom""".format(0 if include_non_stock_items else 1),
-		(company, bom_no), as_dict=1):
-			bom_wise_item_details.setdefault(d.get('item_code'), d)
-	return bom_wise_item_details
+		(planned_qty, company, bom_no), as_dict=1):
+			item_details.setdefault(d.get('item_code'), d)
+	return item_details
 
-def get_subitems(doc, data, bom_wise_item_details, bom_no, company, include_non_stock_items, include_subcontracted_items, parent_qty):
+def get_subitems(doc, data, item_details, bom_no, company, include_non_stock_items,
+	include_subcontracted_items, parent_qty, planned_qty=1):
 	items = frappe.db.sql("""
 		SELECT
 			bom_item.item_code, default_material_request_type, item.item_name,
-			ifnull(%(parent_qty)s * sum(bom_item.stock_qty/ifnull(bom.quantity, 1)), 0) as qty,
+			ifnull(%(parent_qty)s * sum(bom_item.stock_qty/ifnull(bom.quantity, 1)) * %(planned_qty)s, 0) as qty,
 			item.is_sub_contracted_item as is_sub_contracted, bom_item.source_warehouse,
 			item.default_bom as default_bom, bom_item.description as description,
 			bom_item.stock_uom as stock_uom, item.min_order_qty as min_order_qty,
@@ -418,25 +419,27 @@
 		group by bom_item.item_code""".format(0 if include_non_stock_items else 1),{
 			'bom': bom_no,
 			'parent_qty': parent_qty,
+			'planned_qty': planned_qty,
 			'company': company
 		}, as_dict=1)
 
 	for d in items:
 		if not data.get('include_exploded_items') or not d.default_bom:
-			if d.item_code in bom_wise_item_details:
-				bom_wise_item_details[d.item_code].qty = bom_wise_item_details[d.item_code].qty + d.qty
+			if d.item_code in item_details:
+				item_details[d.item_code].qty = item_details[d.item_code].qty + d.qty
 			else:
-				bom_wise_item_details[d.item_code] = d
+				item_details[d.item_code] = d
 
 		if data.get('include_exploded_items') and d.default_bom:
 			if ((d.default_material_request_type in ["Manufacture", "Purchase"] and
 				not d.is_sub_contracted) or (d.is_sub_contracted and include_subcontracted_items)):
 				if d.qty > 0:
-					get_subitems(doc, data, bom_wise_item_details, d.default_bom, company, include_non_stock_items, include_subcontracted_items, d.qty)
-	return bom_wise_item_details
+					get_subitems(doc, data, item_details, d.default_bom, company,
+						include_non_stock_items, include_subcontracted_items, d.qty)
+	return item_details
 
-def add_item_in_material_request_items(doc, planned_qty, ignore_existing_ordered_qty, item, row, data, warehouse, company):
-	total_qty = row['qty'] * planned_qty
+def get_material_request_items(row, sales_order, company, ignore_existing_ordered_qty, warehouse):
+	total_qty = row['qty']
 	projected_qty, actual_qty = get_bin_details(row)
 
 	requested_qty = 0
@@ -446,27 +449,31 @@
 		requested_qty = total_qty - projected_qty
 	if requested_qty > 0 and requested_qty < row['min_order_qty']:
 		requested_qty = row['min_order_qty']
-	item_group_defaults = get_item_group_defaults(item, company)
+	item_group_defaults = get_item_group_defaults(row.item_code, company)
 
 	if not row['purchase_uom']:
 		row['purchase_uom'] = row['stock_uom']
 
 	if row['purchase_uom'] != row['stock_uom']:
 		if not row['conversion_factor']:
-			frappe.throw(_("UOM Conversion factor ({0} -> {1}) not found for item: {2}").format(row['purchase_uom'], row['stock_uom'], item))
+			frappe.throw(_("UOM Conversion factor ({0} -> {1}) not found for item: {2}")
+				.format(row['purchase_uom'], row['stock_uom'], item))
 		requested_qty = requested_qty / row['conversion_factor']
+
 	if frappe.db.get_value("UOM", row['purchase_uom'], "must_be_whole_number"):
 		requested_qty = ceil(requested_qty)
+
 	if requested_qty > 0:
-		doc.setdefault('mr_items', []).append({
-			'item_code': item,
-			'item_name': row['item_name'],
+		return {
+			'item_code': row.item_code,
+			'item_name': row.item_name,
 			'quantity': requested_qty,
-			'warehouse': warehouse or row.get('source_warehouse') or row.get('default_warehouse') or item_group_defaults.get("default_warehouse"),
+			'warehouse': warehouse or row.get('source_warehouse') \
+				or row.get('default_warehouse') or item_group_defaults.get("default_warehouse"),
 			'actual_qty': actual_qty,
 			'min_order_qty': row['min_order_qty'],
-			'sales_order': data.get('sales_order')
-		})
+			'sales_order': sales_order
+		}
 
 def get_sales_orders(self):
 	so_filter = item_filter = ""
@@ -525,74 +532,84 @@
 	return item_projected_qty and item_projected_qty[0] or (0,0)
 
 @frappe.whitelist()
-def get_items_for_material_requests(doc, company=None):
+def get_items_for_material_requests(doc, sales_order=None, company=None):
 	if isinstance(doc, string_types):
 		doc = frappe._dict(json.loads(doc))
 
 	doc['mr_items'] = []
 	po_items = doc.get('po_items') if doc.get('po_items') else doc.get('items')
+	company = doc.get('company')
 
+	so_item_details = frappe._dict()
 	for data in po_items:
-		warehouse = None
-		bom_wise_item_details = {}
+		warehouse = data.get('for_warehouse')
+		ignore_existing_ordered_qty = data.get('ignore_existing_ordered_qty') or doc.get('ignore_existing_ordered_qty')
+		planned_qty = data.get('required_qty') or data.get('planned_qty')
+		item_details = {}
 		if data.get("bom"):
 			if data.get('required_qty'):
-				planned_qty = data.get('required_qty')
 				bom_no = data.get('bom')
-				ignore_existing_ordered_qty = data.get('ignore_existing_ordered_qty')
 				include_non_stock_items = 1
-				warehouse = data.get('for_warehouse')
-				if data.get('include_exploded_items'):
-					include_subcontracted_items = 1
-				else:
-					include_subcontracted_items = 0
+				include_subcontracted_items = 1 if data.get('include_exploded_items') else 0
 			else:
-				planned_qty = data.get('planned_qty')
 				bom_no = data.get('bom_no')
 				include_subcontracted_items = doc.get('include_subcontracted_items')
-				company = doc.get('company')
 				include_non_stock_items = doc.get('include_non_stock_items')
-				ignore_existing_ordered_qty = doc.get('ignore_existing_ordered_qty')
+
 			if not planned_qty:
 				frappe.throw(_("For row {0}: Enter Planned Qty").format(data.get('idx')))
 
-			if data.get('include_exploded_items') and bom_no and include_subcontracted_items:
-				# fetch exploded items from BOM
-				bom_wise_item_details = get_exploded_items(bom_wise_item_details, company, bom_no, include_non_stock_items)
-			else:
-				bom_wise_item_details = get_subitems(doc, data, bom_wise_item_details, bom_no, company,
-					include_non_stock_items, include_subcontracted_items, 1)
-			for item, item_details in bom_wise_item_details.items():
-				if item_details.qty > 0:
-					add_item_in_material_request_items(doc, planned_qty, ignore_existing_ordered_qty,
-						item, item_details, data, warehouse, company)
+			if bom_no:
+				if data.get('include_exploded_items') and include_subcontracted_items:
+					# fetch exploded items from BOM
+					item_details = get_exploded_items(item_details,
+						company, bom_no,include_non_stock_items, planned_qty=planned_qty)
+				else:
+					item_details = get_subitems(doc, data, item_details, bom_no, company,
+						include_non_stock_items, include_subcontracted_items, 1, planned_qty=planned_qty)
 		else:
 			item_master = frappe.get_doc('Item', data['item_code']).as_dict()
-			planned_qty = data.get('required_qty')
-
 			purchase_uom = item_master.purchase_uom or item_master.stock_uom
 			conversion_factor = 0
 			for d in item_master.get("uoms"):
 				if d.uom == purchase_uom:
 					conversion_factor = d.conversion_factor
 
-			item_details = frappe._dict({
-				'item_name' : item_master.item_name,
-				'default_bom' : doc.bom,
-				'purchase_uom' : purchase_uom,
-				'default_warehouse': item_master.default_warehouse,
-				'min_order_qty' : item_master.min_order_qty,
-				'default_material_request_type' : item_master.default_material_request_type,
-				'qty': 1,
-				'is_sub_contracted' : item_master.is_subcontracted_item,
-				'item_code' : item_master.name,
-				'description' : item_master.description,
-				'stock_uom' : item_master.stock_uom,
-				'conversion_factor' : conversion_factor,
-			})
+			item_details[item_master.name] = frappe._dict(
+				{
+					'item_name' : item_master.item_name,
+					'default_bom' : doc.bom,
+					'purchase_uom' : purchase_uom,
+					'default_warehouse': item_master.default_warehouse,
+					'min_order_qty' : item_master.min_order_qty,
+					'default_material_request_type' : item_master.default_material_request_type,
+					'qty': planned_qty or 1,
+					'is_sub_contracted' : item_master.is_subcontracted_item,
+					'item_code' : item_master.name,
+					'description' : item_master.description,
+					'stock_uom' : item_master.stock_uom,
+					'conversion_factor' : conversion_factor,
+				}
+			)
 
-			if item_details['qty'] > 0:
-				add_item_in_material_request_items(doc, planned_qty, data.get('ignore_existing_ordered_qty'), item_master.name,
-					item_details, data, data.get('for_warehouse'), company)
+		if not sales_order:
+			sales_order = doc.get("sales_order")
 
-	return doc['mr_items']
+		for item_code, details in iteritems(item_details):
+			so_item_details.setdefault(sales_order, frappe._dict())
+			if item_code in so_item_details.get(sales_order, {}):
+				so_item_details[sales_order][item_code]['qty'] = so_item_details[sales_order][item_code].get("qty", 0) + flt(details.qty)
+			else:
+				so_item_details[sales_order][item_code] = details
+
+	mr_items = []
+	for sales_order, item_code in iteritems(so_item_details):
+		item_dict = so_item_details[sales_order]
+		for details in item_dict.values():
+			if details.qty > 0:
+				items = get_material_request_items(details, sales_order, company,
+					ignore_existing_ordered_qty, warehouse)
+				if items:
+					mr_items.append(items)
+
+	return mr_items
diff --git a/erpnext/manufacturing/doctype/production_planning_tool/production_planning_tool.py b/erpnext/manufacturing/doctype/production_planning_tool/production_planning_tool.py
deleted file mode 100644
index 323aaf9..0000000
--- a/erpnext/manufacturing/doctype/production_planning_tool/production_planning_tool.py
+++ /dev/null
@@ -1,552 +0,0 @@
-# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
-# License: GNU General Public License v3. See license.txt
-
-from __future__ import unicode_literals
-import frappe
-from frappe.utils import cstr, flt, cint, nowdate, add_days, comma_and
-
-from frappe import msgprint, _
-
-from frappe.model.document import Document
-from erpnext.manufacturing.doctype.bom.bom import validate_bom_no
-from erpnext.manufacturing.doctype.work_order.work_order import get_item_details
-
-class ProductionPlanningTool(Document):
-	def clear_table(self, table_name):
-		self.set(table_name, [])
-
-	def validate_company(self):
-		if not self.company:
-			frappe.throw(_("Please enter Company"))
-
-	def get_open_sales_orders(self):
-		""" Pull sales orders  which are pending to deliver based on criteria selected"""
-		so_filter = item_filter = ""
-		if self.from_date:
-			so_filter += " and so.transaction_date >= %(from_date)s"
-		if self.to_date:
-			so_filter += " and so.transaction_date <= %(to_date)s"
-		if self.customer:
-			so_filter += " and so.customer = %(customer)s"
-		if self.project:
-			so_filter += " and so.project = %(project)s"
-
-		if self.fg_item:
-			item_filter += " and so_item.item_code = %(item)s"
-
-		open_so = frappe.db.sql("""
-			select distinct so.name, so.transaction_date, so.customer, so.base_grand_total
-			from `tabSales Order` so, `tabSales Order Item` so_item
-			where so_item.parent = so.name
-				and so.docstatus = 1 and so.status not in ("Stopped", "Closed")
-				and so.company = %(company)s
-				and so_item.qty > so_item.delivered_qty {0} {1}
-				and (exists (select name from `tabBOM` bom where bom.item=so_item.item_code
-						and bom.is_active = 1)
-					or exists (select name from `tabPacked Item` pi
-						where pi.parent = so.name and pi.parent_item = so_item.item_code
-							and exists (select name from `tabBOM` bom where bom.item=pi.item_code
-								and bom.is_active = 1)))
-			""".format(so_filter, item_filter), {
-				"from_date": self.from_date,
-				"to_date": self.to_date,
-				"customer": self.customer,
-				"project": self.project,
-				"item": self.fg_item,
-				"company": self.company
-			}, as_dict=1)
-
-		self.add_so_in_table(open_so)
-
-	def add_so_in_table(self, open_so):
-		""" Add sales orders in the table"""
-		self.clear_table("sales_orders")
-
-		so_list = []
-		for r in open_so:
-			if cstr(r['name']) not in so_list:
-				pp_so = self.append('sales_orders', {})
-				pp_so.sales_order = r['name']
-				pp_so.sales_order_date = cstr(r['transaction_date'])
-				pp_so.customer = cstr(r['customer'])
-				pp_so.grand_total = flt(r['base_grand_total'])
-
-	def get_pending_material_requests(self):
-		""" Pull Material Requests that are pending based on criteria selected"""
-		mr_filter = item_filter = ""
-		if self.from_date:
-			mr_filter += " and mr.transaction_date >= %(from_date)s"
-		if self.to_date:
-			mr_filter += " and mr.transaction_date <= %(to_date)s"
-		if self.warehouse:
-			mr_filter += " and mr_item.warehouse = %(warehouse)s"
-
-		if self.fg_item:
-			item_filter += " and mr_item.item_code = %(item)s"
-
-		pending_mr = frappe.db.sql("""
-			select distinct mr.name, mr.transaction_date
-			from `tabMaterial Request` mr, `tabMaterial Request Item` mr_item
-			where mr_item.parent = mr.name
-				and mr.material_request_type = "Manufacture"
-				and mr.docstatus = 1
-				and mr_item.qty > ifnull(mr_item.ordered_qty,0) {0} {1}
-				and (exists (select name from `tabBOM` bom where bom.item=mr_item.item_code
-					and bom.is_active = 1))
-			""".format(mr_filter, item_filter), {
-				"from_date": self.from_date,
-				"to_date": self.to_date,
-				"warehouse": self.warehouse,
-				"item": self.fg_item
-			}, as_dict=1)
-
-		self.add_mr_in_table(pending_mr)
-
-	def add_mr_in_table(self, pending_mr):
-		""" Add Material Requests in the table"""
-		self.clear_table("material_requests")
-
-		mr_list = []
-		for r in pending_mr:
-			if cstr(r['name']) not in mr_list:
-				mr = self.append('material_requests', {})
-				mr.material_request = r['name']
-				mr.material_request_date = cstr(r['transaction_date'])
-
-	def get_items(self):
-		if self.get_items_from == "Sales Order":
-			self.get_so_items()
-		elif self.get_items_from == "Material Request":
-			self.get_mr_items()
-
-	def get_so_items(self):
-		so_list = [d.sales_order for d in self.get('sales_orders') if d.sales_order]
-		if not so_list:
-			msgprint(_("Please enter Sales Orders in the above table"))
-			return []
-
-		item_condition = ""
-		if self.fg_item:
-			item_condition = ' and so_item.item_code = "{0}"'.format(frappe.db.escape(self.fg_item))
-
-		items = frappe.db.sql("""select distinct parent, item_code, warehouse,
-			(qty - delivered_qty)*conversion_factor as pending_qty
-			from `tabSales Order Item` so_item
-			where parent in (%s) and docstatus = 1 and qty > delivered_qty
-			and exists (select name from `tabBOM` bom where bom.item=so_item.item_code
-					and bom.is_active = 1) %s""" % \
-			(", ".join(["%s"] * len(so_list)), item_condition), tuple(so_list), as_dict=1)
-
-		if self.fg_item:
-			item_condition = ' and pi.item_code = "{0}"'.format(frappe.db.escape(self.fg_item))
-
-		packed_items = frappe.db.sql("""select distinct pi.parent, pi.item_code, pi.warehouse as warehouse,
-			(((so_item.qty - so_item.delivered_qty) * pi.qty) / so_item.qty)
-				as pending_qty
-			from `tabSales Order Item` so_item, `tabPacked Item` pi
-			where so_item.parent = pi.parent and so_item.docstatus = 1
-			and pi.parent_item = so_item.item_code
-			and so_item.parent in (%s) and so_item.qty > so_item.delivered_qty
-			and exists (select name from `tabBOM` bom where bom.item=pi.item_code
-					and bom.is_active = 1) %s""" % \
-			(", ".join(["%s"] * len(so_list)), item_condition), tuple(so_list), as_dict=1)
-
-		self.add_items(items + packed_items)
-
-	def get_mr_items(self):
-		mr_list = [d.material_request for d in self.get('material_requests') if d.material_request]
-		if not mr_list:
-			msgprint(_("Please enter Material Requests in the above table"))
-			return []
-
-		item_condition = ""
-		if self.fg_item:
-			item_condition = ' and mr_item.item_code = "' + frappe.db.escape(self.fg_item, percent=False) + '"'
-
-		items = frappe.db.sql("""select distinct parent, name, item_code, warehouse,
-			(qty - ordered_qty) as pending_qty
-			from `tabMaterial Request Item` mr_item
-			where parent in (%s) and docstatus = 1 and qty > ordered_qty
-			and exists (select name from `tabBOM` bom where bom.item=mr_item.item_code
-				and bom.is_active = 1) %s""" % \
-			(", ".join(["%s"] * len(mr_list)), item_condition), tuple(mr_list), as_dict=1)
-
-		self.add_items(items)
-
-
-	def add_items(self, items):
-		self.clear_table("items")
-		for p in items:
-			item_details = get_item_details(p['item_code'])
-			pi = self.append('items', {})
-			pi.warehouse				= p['warehouse']
-			pi.item_code				= p['item_code']
-			pi.description				= item_details and item_details.description or ''
-			pi.stock_uom				= item_details and item_details.stock_uom or ''
-			pi.bom_no					= item_details and item_details.bom_no or ''
-			pi.planned_qty				= flt(p['pending_qty'])
-			pi.pending_qty				= flt(p['pending_qty'])
-
-			if self.get_items_from == "Sales Order":
-				pi.sales_order		= p['parent']
-			elif self.get_items_from == "Material Request":
-				pi.material_request		= p['parent']
-				pi.material_request_item = p['name']
-
-	def validate_data(self):
-		self.validate_company()
-		for d in self.get('items'):
-			if not d.bom_no:
-				frappe.throw(_("Please select BOM for Item in Row {0}".format(d.idx)))
-			else:
-				validate_bom_no(d.item_code, d.bom_no)
-
-			if not flt(d.planned_qty):
-				frappe.throw(_("Please enter Planned Qty for Item {0} at row {1}").format(d.item_code, d.idx))
-
-	def raise_work_orders(self):
-		"""It will raise work order (Draft) for all distinct FG items"""
-		self.validate_data()
-
-		from erpnext.utilities.transaction_base import validate_uom_is_integer
-		validate_uom_is_integer(self, "stock_uom", "planned_qty")
-
-		items = self.get_production_items()
-
-		wo_list = []
-		frappe.flags.mute_messages = True
-
-		for key in items:
-			work_order = self.create_work_order(items[key])
-			if work_order:
-				wo_list.append(work_order)
-
-		frappe.flags.mute_messages = False
-
-		if wo_list:
-			wo_list = ["""<a href="#Form/Work Order/%s" target="_blank">%s</a>""" % \
-				(p, p) for p in wo_list]
-			msgprint(_("{0} created").format(comma_and(wo_list)))
-		else :
-			msgprint(_("No Work Orders created"))
-
-	def get_production_items(self):
-		item_dict = {}
-		for d in self.get("items"):
-			item_details= {
-				"production_item"		: d.item_code,
-				"sales_order"			: d.sales_order,
-				"material_request"		: d.material_request,
-				"material_request_item"	: d.material_request_item,
-				"bom_no"				: d.bom_no,
-				"description"			: d.description,
-				"stock_uom"				: d.stock_uom,
-				"company"				: self.company,
-				"wip_warehouse"			: "",
-				"fg_warehouse"			: d.warehouse,
-				"status"				: "Draft",
-				"project"				: frappe.db.get_value("Sales Order", d.sales_order, "project")
-			}
-
-			""" Club similar BOM and item for processing in case of Sales Orders """
-			if self.get_items_from == "Material Request":
-				item_details.update({
-					"qty": d.planned_qty
-				})
-				item_dict[(d.item_code, d.material_request_item, d.warehouse)] = item_details
-
-			else:
-				item_details.update({
-					"qty":flt(item_dict.get((d.item_code, d.sales_order, d.warehouse),{})
-						.get("qty")) + flt(d.planned_qty)
-				})
-				item_dict[(d.item_code, d.sales_order, d.warehouse)] = item_details
-
-		return item_dict
-
-	def create_work_order(self, item_dict):
-		"""Create work order. Called from Production Planning Tool"""
-		from erpnext.manufacturing.doctype.work_order.work_order import OverProductionError, get_default_warehouse
-		warehouse = get_default_warehouse()
-		wo = frappe.new_doc("Work Order")
-		wo.update(item_dict)
-		wo.set_work_order_operations()
-		if warehouse:
-			wo.wip_warehouse = warehouse.get('wip_warehouse')
-		if not wo.fg_warehouse:
-			wo.fg_warehouse = warehouse.get('fg_warehouse')
-
-		try:
-			wo.insert()
-			return wo.name
-		except OverProductionError:
-			pass
-
-	def get_so_wise_planned_qty(self):
-		"""
-			bom_dict {
-				bom_no: ['sales_order', 'qty']
-			}
-		"""
-		bom_dict = {}
-		for d in self.get("items"):
-			if self.get_items_from == "Material Request":
-				bom_dict.setdefault(d.bom_no, []).append([d.material_request_item, flt(d.planned_qty)])
-			else:
-				bom_dict.setdefault(d.bom_no, []).append([d.sales_order, flt(d.planned_qty)])
-		return bom_dict
-
-	def download_raw_materials(self):
-		""" Create csv data for required raw material to produce finished goods"""
-		self.validate_data()
-		bom_dict = self.get_so_wise_planned_qty()
-		self.get_raw_materials(bom_dict)
-		return self.get_csv()
-
-	def get_raw_materials(self, bom_dict,non_stock_item=0):
-		""" Get raw materials considering sub-assembly items
-			{
-				"item_code": [qty_required, description, stock_uom, min_order_qty]
-			}
-		"""
-		item_list = []
-		precision = frappe.get_precision("BOM Item", "stock_qty")
-
-		for bom, so_wise_qty in bom_dict.items():
-			bom_wise_item_details = {}
-			if self.use_multi_level_bom and self.only_raw_materials and self.include_subcontracted:
-				# get all raw materials with sub assembly childs
-				# Did not use qty_consumed_per_unit in the query, as it leads to rounding loss
-				for d in frappe.db.sql("""select fb.item_code,
-					ifnull(sum(fb.stock_qty/ifnull(bom.quantity, 1)), 0) as qty,
-					fb.description, fb.stock_uom, item.min_order_qty
-					from `tabBOM Explosion Item` fb, `tabBOM` bom, `tabItem` item
-					where bom.name = fb.parent and item.name = fb.item_code
-					and (item.is_sub_contracted_item = 0 or ifnull(item.default_bom, "")="")
-					""" + ("and item.is_stock_item = 1","")[non_stock_item] + """
-					and fb.docstatus<2 and bom.name=%(bom)s
-					group by fb.item_code, fb.stock_uom""", {"bom":bom}, as_dict=1):
-						bom_wise_item_details.setdefault(d.item_code, d)
-			else:
-				# Get all raw materials considering SA items as raw materials,
-				# so no childs of SA items
-				bom_wise_item_details = self.get_subitems(bom_wise_item_details, bom,1, \
-					self.use_multi_level_bom,self.only_raw_materials, self.include_subcontracted,non_stock_item)
-
-			for item, item_details in bom_wise_item_details.items():
-				for so_qty in so_wise_qty:
-					item_list.append([item, flt(flt(item_details.qty) * so_qty[1], precision),
-						item_details.description, item_details.stock_uom, item_details.min_order_qty,
-						so_qty[0]])
-
-		self.make_items_dict(item_list)
-
-	def get_subitems(self,bom_wise_item_details, bom, parent_qty, include_sublevel, only_raw, supply_subs,non_stock_item=0):
-		items = frappe.db.sql("""
-			SELECT
-				bom_item.item_code,
-				default_material_request_type,
-				ifnull(%(parent_qty)s * sum(bom_item.stock_qty/ifnull(bom.quantity, 1)), 0) as qty,
-				item.is_sub_contracted_item as is_sub_contracted,
-				item.default_bom as default_bom,
-				bom_item.description as description,
-				bom_item.stock_uom as stock_uom,
-				item.min_order_qty as min_order_qty
-			FROM
-				`tabBOM Item` bom_item,
-				`tabBOM` bom,
-				tabItem item
-			where
-				bom.name = bom_item.parent
-				and bom.name = %(bom)s
-				and bom_item.docstatus < 2
-				and bom_item.item_code = item.name
-			""" + ("and item.is_stock_item = 1", "")[non_stock_item] + """
-			group by bom_item.item_code""", {"bom": bom, "parent_qty": parent_qty}, as_dict=1)
-
-		for d in items:
-			if ((d.default_material_request_type == "Purchase"
-				and not (d.is_sub_contracted and only_raw and include_sublevel))
-				or (d.default_material_request_type == "Manufacture" and not only_raw)):
-
-				if d.item_code in bom_wise_item_details:
-					bom_wise_item_details[d.item_code].qty = bom_wise_item_details[d.item_code].qty + d.qty
-				else:
-					bom_wise_item_details[d.item_code] = d
-
-			if include_sublevel and d.default_bom:
-				if ((d.default_material_request_type == "Purchase" and d.is_sub_contracted and supply_subs)
-					or (d.default_material_request_type == "Manufacture")):
-
-					my_qty = 0
-					projected_qty = self.get_item_projected_qty(d.item_code)
-					if self.create_material_requests_for_all_required_qty:
-						my_qty = d.qty
-					else:
-						total_required_qty = flt(bom_wise_item_details.get(d.item_code, frappe._dict()).qty)
-						if (total_required_qty - d.qty) < projected_qty:
-							my_qty = total_required_qty - projected_qty
-						else:
-							my_qty = d.qty
-
-					if my_qty > 0:
-						self.get_subitems(bom_wise_item_details,
-							d.default_bom, my_qty, include_sublevel, only_raw, supply_subs)
-
-		return bom_wise_item_details
-
-	def make_items_dict(self, item_list):
-		if not getattr(self, "item_dict", None):
-			self.item_dict = {}
-
-		for i in item_list:
-			self.item_dict.setdefault(i[0], []).append([flt(i[1]), i[2], i[3], i[4], i[5]])
-
-	def get_csv(self):
-		item_list = [['Item Code', 'Description', 'Stock UOM', 'Required Qty', 'Warehouse',
-		 	'Quantity Requested for Purchase', 'Ordered Qty', 'Actual Qty']]
-		for item in self.item_dict:
-			total_qty = sum([flt(d[0]) for d in self.item_dict[item]])
-			item_list.append([item, self.item_dict[item][0][1], self.item_dict[item][0][2], total_qty])
-			item_qty = frappe.db.sql("""select warehouse, indented_qty, ordered_qty, actual_qty
-				from `tabBin` where item_code = %s""", item, as_dict=1)
-
-			i_qty, o_qty, a_qty = 0, 0, 0
-			for w in item_qty:
-				i_qty, o_qty, a_qty = i_qty + flt(w.indented_qty), o_qty + \
-					flt(w.ordered_qty), a_qty + flt(w.actual_qty)
-
-				item_list.append(['', '', '', '', w.warehouse, flt(w.indented_qty),
-					flt(w.ordered_qty), flt(w.actual_qty)])
-			if item_qty:
-				item_list.append(['', '', '', '', 'Total', i_qty, o_qty, a_qty])
-			else:
-				item_list.append(['', '', '', '', 'Total', 0, 0, 0])
-
-		return item_list
-
-	def raise_material_requests(self):
-		"""
-			Raise Material Request if projected qty is less than qty required
-			Requested qty should be shortage qty considering minimum order qty
-		"""
-		self.validate_data()
-		if not self.purchase_request_for_warehouse:
-			frappe.throw(_("Please enter Warehouse for which Material Request will be raised"))
-
-		bom_dict = self.get_so_wise_planned_qty()
-		self.get_raw_materials(bom_dict,self.create_material_requests_non_stock_request)
-
-		if self.item_dict:
-			self.create_material_request()
-
-	def get_requested_items(self):
-		items_to_be_requested = frappe._dict()
-
-		if not self.create_material_requests_for_all_required_qty:
-			item_projected_qty = self.get_projected_qty()
-
-		for item, so_item_qty in self.item_dict.items():
-			total_qty = sum([flt(d[0]) for d in so_item_qty])
-			requested_qty = 0
-
-			if self.create_material_requests_for_all_required_qty:
-				requested_qty = total_qty
-			elif total_qty > item_projected_qty.get(item, 0):
-				# shortage
-				requested_qty = total_qty - flt(item_projected_qty.get(item))
-				# consider minimum order qty
-
-			if requested_qty and requested_qty < flt(so_item_qty[0][3]):
-				requested_qty = flt(so_item_qty[0][3])
-
-			# distribute requested qty SO wise
-			for item_details in so_item_qty:
-				if requested_qty:
-					sales_order = item_details[4] or "No Sales Order"
-					if self.get_items_from == "Material Request":
-						sales_order = "No Sales Order"
-					if requested_qty <= item_details[0]:
-						adjusted_qty = requested_qty
-					else:
-						adjusted_qty = item_details[0]
-
-					items_to_be_requested.setdefault(item, {}).setdefault(sales_order, 0)
-					items_to_be_requested[item][sales_order] += adjusted_qty
-					requested_qty -= adjusted_qty
-				else:
-					break
-
-			# requested qty >= total so qty, due to minimum order qty
-			if requested_qty:
-				items_to_be_requested.setdefault(item, {}).setdefault("No Sales Order", 0)
-				items_to_be_requested[item]["No Sales Order"] += requested_qty
-
-		return items_to_be_requested
-
-	def get_item_projected_qty(self,item):
-		conditions = ""
-		if self.purchase_request_for_warehouse:
-			conditions = " and warehouse='{0}'".format(frappe.db.escape(self.purchase_request_for_warehouse))
-
-		item_projected_qty = frappe.db.sql("""
-			select ifnull(sum(projected_qty),0) as qty
-			from `tabBin`
-			where item_code = %(item_code)s {conditions}
-		""".format(conditions=conditions), { "item_code": item }, as_dict=1)
-
-		return item_projected_qty[0].qty
-
-	def get_projected_qty(self):
-		items = self.item_dict.keys()
-		item_projected_qty = frappe.db.sql("""select item_code, sum(projected_qty)
-			from `tabBin` where item_code in (%s) and warehouse=%s group by item_code""" %
-			(", ".join(["%s"]*len(items)), '%s'), tuple(items + [self.purchase_request_for_warehouse]))
-
-		return dict(item_projected_qty)
-
-	def create_material_request(self):
-		items_to_be_requested = self.get_requested_items()
-
-		material_request_list = []
-		if items_to_be_requested:
-			for item in items_to_be_requested:
-				item_wrapper = frappe.get_doc("Item", item)
-				material_request = frappe.new_doc("Material Request")
-				material_request.update({
-					"transaction_date": nowdate(),
-					"status": "Draft",
-					"company": self.company,
-					"requested_by": frappe.session.user,
-					"schedule_date": add_days(nowdate(), cint(item_wrapper.lead_time_days)),
-				})
-				material_request.update({"material_request_type": item_wrapper.default_material_request_type})
-
-				for sales_order, requested_qty in items_to_be_requested[item].items():
-					material_request.append("items", {
-						"doctype": "Material Request Item",
-						"__islocal": 1,
-						"item_code": item,
-						"item_name": item_wrapper.item_name,
-						"description": item_wrapper.description,
-						"uom": item_wrapper.stock_uom,
-						"item_group": item_wrapper.item_group,
-						"brand": item_wrapper.brand,
-						"qty": requested_qty,
-						"schedule_date": add_days(nowdate(), cint(item_wrapper.lead_time_days)),
-						"warehouse": self.purchase_request_for_warehouse,
-						"sales_order": sales_order if sales_order!="No Sales Order" else None,
-						"project": frappe.db.get_value("Sales Order", sales_order, "project") \
-							if sales_order!="No Sales Order" else None
-					})
-
-				material_request.flags.ignore_permissions = 1
-				material_request.submit()
-				material_request_list.append(material_request.name)
-
-			if material_request_list:
-				message = ["""<a href="#Form/Material Request/%s" target="_blank">%s</a>""" % \
-					(p, p) for p in material_request_list]
-				msgprint(_("Material Requests {0} created").format(comma_and(message)))
-		else:
-			msgprint(_("Nothing to request"))
diff --git a/erpnext/selling/doctype/sales_order/sales_order.js b/erpnext/selling/doctype/sales_order/sales_order.js
index ab2f6ee..b1bfeff 100644
--- a/erpnext/selling/doctype/sales_order/sales_order.js
+++ b/erpnext/selling/doctype/sales_order/sales_order.js
@@ -344,8 +344,6 @@
 				label: __('Include Exploded Items')},
 			{fieldtype:'Check', fieldname:'ignore_existing_ordered_qty',
 				label: __('Ignore Existing Ordered Qty')},
-			{fieldtype:'Check', fieldname:'include_raw_materials_from_sales_order',
-				label: __('Include raw materials from sales order')},
 			{
 				fieldtype:'Table', fieldname: 'items',
 				description: __('Select BOM, Qty and For Warehouse'),
diff --git a/erpnext/selling/doctype/sales_order/sales_order.py b/erpnext/selling/doctype/sales_order/sales_order.py
index 1460bc8..445e02b 100755
--- a/erpnext/selling/doctype/sales_order/sales_order.py
+++ b/erpnext/selling/doctype/sales_order/sales_order.py
@@ -934,7 +934,7 @@
 		item["ignore_existing_ordered_qty"] = items.get('ignore_existing_ordered_qty')
 		item["include_raw_materials_from_sales_order"] = items.get('include_raw_materials_from_sales_order')
 
-	raw_materials = get_items_for_material_requests(items, company)
+	raw_materials = get_items_for_material_requests(items, sales_order, company)
 	if not raw_materials:
 		frappe.msgprint(_("Material Request not created, as quantity for Raw Materials already available."))
 		return
