Merge branch 'develop' into bom_items_and_scraps
diff --git a/erpnext/manufacturing/report/bom_items_and_scraps/__init__.py b/erpnext/manufacturing/report/bom_items_and_scraps/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/erpnext/manufacturing/report/bom_items_and_scraps/__init__.py
diff --git a/erpnext/manufacturing/report/bom_items_and_scraps/bom_items_and_scraps.js b/erpnext/manufacturing/report/bom_items_and_scraps/bom_items_and_scraps.js
new file mode 100644
index 0000000..ebff39f
--- /dev/null
+++ b/erpnext/manufacturing/report/bom_items_and_scraps/bom_items_and_scraps.js
@@ -0,0 +1,15 @@
+// Copyright (c) 2016, Frappe Technologies Pvt. Ltd. and contributors
+// For license information, please see license.txt
+/* eslint-disable */
+
+frappe.query_reports["BOM Items and Scraps"] = {
+	"filters": [
+		{
+			fieldname: "bom",
+			label: __("BOM"),
+			fieldtype: "Link",
+			options: "BOM",
+			reqd: 1
+		},
+	]
+};
diff --git a/erpnext/manufacturing/report/bom_items_and_scraps/bom_items_and_scraps.json b/erpnext/manufacturing/report/bom_items_and_scraps/bom_items_and_scraps.json
new file mode 100644
index 0000000..bebe85d
--- /dev/null
+++ b/erpnext/manufacturing/report/bom_items_and_scraps/bom_items_and_scraps.json
@@ -0,0 +1,27 @@
+{
+ "add_total_row": 0,
+ "creation": "2019-05-14 12:06:14.998746",
+ "disable_prepared_report": 0,
+ "disabled": 0,
+ "docstatus": 0,
+ "doctype": "Report",
+ "idx": 0,
+ "is_standard": "Yes",
+ "modified": "2019-05-14 12:06:14.998746",
+ "modified_by": "Administrator",
+ "module": "Manufacturing",
+ "name": "BOM Items and Scraps",
+ "owner": "Administrator",
+ "prepared_report": 0,
+ "ref_doctype": "BOM",
+ "report_name": "BOM Items and Scraps ",
+ "report_type": "Script Report",
+ "roles": [
+  {
+   "role": "Manufacturing Manager"
+  },
+  {
+   "role": "Manufacturing User"
+  }
+ ]
+}
\ No newline at end of file
diff --git a/erpnext/manufacturing/report/bom_items_and_scraps/bom_items_and_scraps.py b/erpnext/manufacturing/report/bom_items_and_scraps/bom_items_and_scraps.py
new file mode 100644
index 0000000..875d115
--- /dev/null
+++ b/erpnext/manufacturing/report/bom_items_and_scraps/bom_items_and_scraps.py
@@ -0,0 +1,83 @@
+# Copyright (c) 2013, Frappe Technologies Pvt. Ltd. and contributors
+# For license information, please see license.txt
+
+from __future__ import unicode_literals
+import frappe
+from pprint import pprint
+
+def execute(filters=None):
+	data = []
+	columns = get_columns()
+	get_data(filters, data)
+	return columns, data
+
+def get_data(filters, data):
+	get_exploded_items(filters.bom, data)
+
+def get_exploded_items(bom, data, indent=0):
+	exploded_items = frappe.get_all("BOM Item",
+		filters={"parent": bom},
+		fields= ['qty','bom_no','qty','scrap','item_code','item_name','description','uom'])
+
+	for item in exploded_items:
+		item["indent"] = indent
+		data.append({
+			'item_code': item.item_code,
+			'item_name': item.item_name,
+			'indent': indent,
+			'bom': item.bom_no,
+			'qty': item.qty,
+			'uom': item.uom,
+			'description': item.description,
+			'scrap': item.scrap
+			})
+		if item.bom_no:
+			get_exploded_items(item.bom_no, data, indent=indent+1)
+
+def get_columns():
+	return [
+		{
+			"label": "Item Code",
+			"fieldtype": "Link",
+			"fieldname": "item_code",
+			"width": 300,
+			"options": "Item"
+		},
+		{
+			"label": "Item Name",
+			"fieldtype": "data",
+			"fieldname": "item_name",
+			"width": 100
+		},
+		{
+			"label": "BOM",
+			"fieldtype": "Link",
+			"fieldname": "bom",
+			"width": 150,
+			"options": "BOM"
+		},
+		{
+			"label": "Qty",
+			"fieldtype": "data",
+			"fieldname": "qty",
+			"width": 100
+		},
+		{
+			"label": "UOM",
+			"fieldtype": "data",
+			"fieldname": "uom",
+			"width": 100
+		},
+		{
+			"label": "Standard Description",
+			"fieldtype": "data",
+			"fieldname": "description",
+			"width": 150
+		},
+		{
+			"label": "Scrap",
+			"fieldtype": "data",
+			"fieldname": "scrap",
+			"width": 100
+		},
+	]