Merge branch 'master' into develop
diff --git a/.eslintrc b/.eslintrc
index c9cd552..4dd1216 100644
--- a/.eslintrc
+++ b/.eslintrc
@@ -132,6 +132,7 @@
 		"get_url_arg": true,
 		"get_server_fields": true,
 		"set_multiple": true,
-		"QUnit": true
+		"QUnit": true,
+		"Chart": true
 	}
 }
diff --git a/erpnext/accounts/doctype/account/account.py b/erpnext/accounts/doctype/account/account.py
index 0787a1f..b31c5d6 100644
--- a/erpnext/accounts/doctype/account/account.py
+++ b/erpnext/accounts/doctype/account/account.py
@@ -205,12 +205,10 @@
 		return new_account
 
 	def after_rename(self, old, new, merge=False):
+		super(Account, self).after_rename(old, new, merge)
+
 		if not merge:
-			frappe.db.set_value("Account", new, "account_name",
-				" - ".join(new.split(" - ")[:-1]))
-		else:
-			from frappe.utils.nestedset import rebuild_tree
-			rebuild_tree("Account", "parent_account")
+			frappe.db.set_value("Account", new, "account_name", " - ".join(new.split(" - ")[:-1]))
 
 def get_parent_account(doctype, txt, searchfield, start, page_len, filters):
 	return frappe.db.sql("""select name from tabAccount
diff --git a/erpnext/accounts/doctype/cost_center/cost_center.py b/erpnext/accounts/doctype/cost_center/cost_center.py
index 12d5e19..55388a5 100644
--- a/erpnext/accounts/doctype/cost_center/cost_center.py
+++ b/erpnext/accounts/doctype/cost_center/cost_center.py
@@ -59,9 +59,8 @@
 		return new_cost_center
 
 	def after_rename(self, olddn, newdn, merge=False):
+		super(CostCenter, self).after_rename(olddn, newdn, merge)
+
 		if not merge:
 			frappe.db.set_value("Cost Center", newdn, "cost_center_name",
 				" - ".join(newdn.split(" - ")[:-1]))
-		else:
-			super(CostCenter, self).after_rename(olddn, newdn, merge)
-
diff --git a/erpnext/accounts/doctype/journal_entry/journal_entry.py b/erpnext/accounts/doctype/journal_entry/journal_entry.py
index 790003c..cc35652 100644
--- a/erpnext/accounts/doctype/journal_entry/journal_entry.py
+++ b/erpnext/accounts/doctype/journal_entry/journal_entry.py
@@ -566,17 +566,26 @@
 		account = get_bank_cash_account(mode_of_payment, company).get("account")
 
 	if not account:
+		'''
+			Set the default account first. If the user hasn't set any default account then, he doesn't
+			want us to set any random account. In this case set the account only if there is single
+			account (of that type), otherwise return empty dict.
+		'''
 		if account_type=="Bank":
 			account = frappe.db.get_value("Company", company, "default_bank_account")
 			if not account:
-				account = frappe.db.get_value("Account",
-					{"company": company, "account_type": "Bank", "is_group": 0})
+				account_list = frappe.get_all("Account", filters = {"company": company,
+					"account_type": "Bank", "is_group": 0})
+				if len(account_list) == 1:
+					account = account_list[0].name
 
 		elif account_type=="Cash":
 			account = frappe.db.get_value("Company", company, "default_cash_account")
 			if not account:
-				account = frappe.db.get_value("Account",
-					{"company": company, "account_type": "Cash", "is_group": 0})
+				account_list = frappe.get_all("Account", filters = {"company": company,
+					"account_type": "Cash", "is_group": 0})
+				if len(account_list) == 1:
+					account = account_list[0].name
 
 	if account:
 		account_details = frappe.db.get_value("Account", account,
diff --git a/erpnext/accounts/doctype/payment_request/payment_request.py b/erpnext/accounts/doctype/payment_request/payment_request.py
index 807ad28..21ddb10 100644
--- a/erpnext/accounts/doctype/payment_request/payment_request.py
+++ b/erpnext/accounts/doctype/payment_request/payment_request.py
@@ -294,7 +294,7 @@
 	if args.get("payment_gateway"):
 		return get_payment_gateway_account(args.get("payment_gateway"))
 
-	if args.cart:
+	if args.order_type == "Shopping Cart":
 		payment_gateway_account = frappe.get_doc("Shopping Cart Settings").payment_gateway_account
 		return get_payment_gateway_account(payment_gateway_account)
 
diff --git a/erpnext/accounts/doctype/pos_profile/pos_profile.json b/erpnext/accounts/doctype/pos_profile/pos_profile.json
index 8136c98..e2246bc 100644
--- a/erpnext/accounts/doctype/pos_profile/pos_profile.json
+++ b/erpnext/accounts/doctype/pos_profile/pos_profile.json
@@ -480,7 +480,67 @@
    "bold": 0, 
    "collapsible": 0, 
    "columns": 0, 
-   "depends_on": "", 
+   "fieldname": "section_break_15", 
+   "fieldtype": "Section Break", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Applicable for Users", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "applicable_for_users", 
+   "fieldtype": "Table", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Applicable for Users", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "POS Profile User", 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "section_break_11", 
    "fieldtype": "Section Break", 
    "hidden": 0, 
@@ -1471,7 +1531,7 @@
  "show_name_in_global_search": 0, 
  "sort_field": "modified", 
  "sort_order": "DESC", 
- "title_field": "user", 
+ "title_field": "pos_profile_name", 
  "track_changes": 0, 
  "track_seen": 0
 }
\ No newline at end of file
diff --git a/erpnext/accounts/doctype/pos_profile/pos_profile.py b/erpnext/accounts/doctype/pos_profile/pos_profile.py
index 8d6a2db..6b7d99f 100644
--- a/erpnext/accounts/doctype/pos_profile/pos_profile.py
+++ b/erpnext/accounts/doctype/pos_profile/pos_profile.py
@@ -11,7 +11,7 @@
 
 class POSProfile(Document):
 	def validate(self):
-		self.check_for_duplicate()
+		# self.check_for_duplicate()
 		self.validate_all_link_fields()
 		self.validate_duplicate_groups()
 		self.check_default_payment()
@@ -94,3 +94,45 @@
 @frappe.whitelist()
 def get_series():
 	return frappe.get_meta("Sales Invoice").get_field("naming_series").options or ""
+
+@frappe.whitelist()
+def get_pos_profiles_for_user(user=None):
+	out = []
+	if not user:
+		user = frappe.session.user
+
+	res = frappe.db.sql('''
+		select
+			parent
+		from
+			`tabPOS Profile User`
+		where
+			user = %s
+	''', (user), as_dict=1)
+
+	if not res:
+		company = frappe.defaults.get_user_default('company')
+		res = frappe.db.sql('''
+			select
+				pos_profile_name
+			from
+				`tabPOS Profile`
+			where
+				company = %s
+		''', (company), as_dict=1)
+
+		out = [r.pos_profile_name for r in res]
+
+		return out
+
+	for r in res:
+		name = frappe.db.get_value('POS Profile', r.parent, 'pos_profile_name')
+		out.append(name)
+
+	return out
+
+@frappe.whitelist()
+def get_pos_profile(pos_profile_name=None):
+	if not pos_profile_name: return
+	name = frappe.db.get_value('POS Profile', { 'pos_profile_name': pos_profile_name })
+	return frappe.get_doc('POS Profile', name)
diff --git a/erpnext/accounts/doctype/pos_profile_user/__init__.py b/erpnext/accounts/doctype/pos_profile_user/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/erpnext/accounts/doctype/pos_profile_user/__init__.py
diff --git a/erpnext/accounts/doctype/pos_profile_user/pos_profile_user.js b/erpnext/accounts/doctype/pos_profile_user/pos_profile_user.js
new file mode 100644
index 0000000..f0884eb
--- /dev/null
+++ b/erpnext/accounts/doctype/pos_profile_user/pos_profile_user.js
@@ -0,0 +1,6 @@
+// Copyright (c) 2017, Frappe Technologies Pvt. Ltd. and contributors
+// For license information, please see license.txt
+
+frappe.ui.form.on('POS Profile User', {
+
+});
diff --git a/erpnext/accounts/doctype/pos_profile_user/pos_profile_user.json b/erpnext/accounts/doctype/pos_profile_user/pos_profile_user.json
new file mode 100644
index 0000000..22c7f72
--- /dev/null
+++ b/erpnext/accounts/doctype/pos_profile_user/pos_profile_user.json
@@ -0,0 +1,93 @@
+{
+ "allow_copy": 0, 
+ "allow_guest_to_view": 0, 
+ "allow_import": 0, 
+ "allow_rename": 0, 
+ "beta": 0, 
+ "creation": "2017-10-27 16:46:06.060930", 
+ "custom": 0, 
+ "docstatus": 0, 
+ "doctype": "DocType", 
+ "document_type": "", 
+ "editable_grid": 1, 
+ "engine": "InnoDB", 
+ "fields": [
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "user", 
+   "fieldtype": "Link", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 1, 
+   "in_standard_filter": 0, 
+   "label": "User", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "User", 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }
+ ], 
+ "has_web_view": 0, 
+ "hide_heading": 0, 
+ "hide_toolbar": 0, 
+ "idx": 0, 
+ "image_view": 0, 
+ "in_create": 0, 
+ "is_submittable": 0, 
+ "issingle": 0, 
+ "istable": 0, 
+ "max_attachments": 0, 
+ "modified": "2017-10-27 16:46:12.784244", 
+ "modified_by": "Administrator", 
+ "module": "Accounts", 
+ "name": "POS Profile User", 
+ "name_case": "", 
+ "owner": "Administrator", 
+ "permissions": [
+  {
+   "amend": 0, 
+   "apply_user_permissions": 0, 
+   "cancel": 0, 
+   "create": 1, 
+   "delete": 1, 
+   "email": 1, 
+   "export": 1, 
+   "if_owner": 0, 
+   "import": 0, 
+   "permlevel": 0, 
+   "print": 1, 
+   "read": 1, 
+   "report": 1, 
+   "role": "System Manager", 
+   "set_user_permissions": 0, 
+   "share": 1, 
+   "submit": 0, 
+   "write": 1
+  }
+ ], 
+ "quick_entry": 1, 
+ "read_only": 0, 
+ "read_only_onload": 0, 
+ "show_name_in_global_search": 0, 
+ "sort_field": "modified", 
+ "sort_order": "DESC", 
+ "track_changes": 1, 
+ "track_seen": 0
+}
\ No newline at end of file
diff --git a/erpnext/accounts/doctype/pos_profile_user/pos_profile_user.py b/erpnext/accounts/doctype/pos_profile_user/pos_profile_user.py
new file mode 100644
index 0000000..d77cdde
--- /dev/null
+++ b/erpnext/accounts/doctype/pos_profile_user/pos_profile_user.py
@@ -0,0 +1,9 @@
+# -*- coding: utf-8 -*-
+# Copyright (c) 2017, Frappe Technologies Pvt. Ltd. and contributors
+# For license information, please see license.txt
+
+from __future__ import unicode_literals
+from frappe.model.document import Document
+
+class POSProfileUser(Document):
+	pass
diff --git a/erpnext/accounts/doctype/sales_invoice/pos.py b/erpnext/accounts/doctype/sales_invoice/pos.py
index 36c2365..63db16c 100644
--- a/erpnext/accounts/doctype/sales_invoice/pos.py
+++ b/erpnext/accounts/doctype/sales_invoice/pos.py
@@ -16,6 +16,8 @@
 	doc = frappe.new_doc('Sales Invoice')
 	doc.is_pos = 1;
 	pos_profile = get_pos_profile(doc.company) or {}
+	if not pos_profile:
+		frappe.throw(_("POS Profile is required to use Point-of-Sale"))
 	if not doc.company: doc.company = pos_profile.get('company')
 	doc.update_stock = pos_profile.get('update_stock')
 
diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.js b/erpnext/accounts/doctype/sales_invoice/sales_invoice.js
index 28a5d01..ccaae49 100644
--- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.js
+++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.js
@@ -95,8 +95,9 @@
 
 		// Show buttons only when pos view is active
 		if (cint(doc.docstatus==0) && cur_frm.page.current_view_name!=="pos" && !doc.is_return) {
-			cur_frm.cscript.sales_order_btn();
-			cur_frm.cscript.delivery_note_btn();
+			this.frm.cscript.sales_order_btn();
+			this.frm.cscript.delivery_note_btn();
+			this.frm.cscript.quotation_btn();
 		}
 
 		this.set_default_print_format();
@@ -157,6 +158,26 @@
 				})
 			}, __("Get items from"));
 	},
+	
+	quotation_btn: function() {
+		var me = this;
+		this.$quotation_btn = this.frm.add_custom_button(__('Quotation'),
+			function() {
+				erpnext.utils.map_current_doc({
+					method: "erpnext.selling.doctype.quotation.quotation.make_sales_invoice",
+					source_doctype: "Quotation",
+					target: me.frm,
+					setters: {
+						customer: me.frm.doc.customer || undefined,
+					},
+					get_query_filters: {
+						docstatus: 1,
+						status: ["!=", "Lost"],
+						company: me.frm.doc.company
+					}
+				})
+			}, __("Get items from"));
+	},
 
 	delivery_note_btn: function() {
 		var me = this;
diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.json b/erpnext/accounts/doctype/sales_invoice/sales_invoice.json
index ecd7cf9..f2625cc 100644
--- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.json
+++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.json
@@ -4433,7 +4433,7 @@
  "istable": 0, 
  "max_attachments": 0, 
  "menu_index": 0, 
- "modified": "2017-10-24 12:46:48.331723", 
+ "modified": "2017-11-03 05:31:56.636424", 
  "modified_by": "Administrator", 
  "module": "Accounts", 
  "name": "Sales Invoice", 
@@ -4531,5 +4531,5 @@
  "timeline_field": "customer", 
  "title_field": "title", 
  "track_changes": 1, 
- "track_seen": 0
+ "track_seen": 1
 }
\ No newline at end of file
diff --git a/erpnext/accounts/doctype/sales_invoice/tests/test_sales_invoice_with_margin.js b/erpnext/accounts/doctype/sales_invoice/tests/test_sales_invoice_with_margin.js
new file mode 100644
index 0000000..60652c8
--- /dev/null
+++ b/erpnext/accounts/doctype/sales_invoice/tests/test_sales_invoice_with_margin.js
@@ -0,0 +1,36 @@
+QUnit.module('Accounts');
+
+QUnit.test("test sales invoice with margin", function(assert) {
+	assert.expect(3);
+	let done = assert.async();
+	frappe.run_serially([
+		() => {
+			return frappe.tests.make('Sales Invoice', [
+				{customer: 'Test Customer 1'},
+				{selling_price_list: 'Test-Selling-USD'},
+				{currency: 'USD'},
+				{items: [
+					[
+						{'item_code': 'Test Product 3'},
+						{'delivery_date': frappe.datetime.add_days(frappe.defaults.get_default("year_end_date"), 1)},
+						{'qty': 1},
+						{'margin_type': 'Percentage'},
+						{'margin_rate_or_amount': 20}
+					]
+				]}
+			]);
+		},
+		() => cur_frm.save(),
+		() => {
+			assert.ok(cur_frm.doc.items[0].rate_with_margin == 240, "Margin rate correct");
+			assert.ok(cur_frm.doc.items[0].base_rate_with_margin == cur_frm.doc.conversion_rate * 240, "Base margin rate correct");
+			assert.ok(cur_frm.doc.total == 240, "Amount correct");
+
+		},
+		() => frappe.tests.click_button('Submit'),
+		() => frappe.tests.click_button('Yes'),
+		() => frappe.timeout(0.3),
+		() => done()
+	]);
+});
+
diff --git a/erpnext/accounts/doctype/sales_invoice_item/sales_invoice_item.json b/erpnext/accounts/doctype/sales_invoice_item/sales_invoice_item.json
index 613f384..becb902 100644
--- a/erpnext/accounts/doctype/sales_invoice_item/sales_invoice_item.json
+++ b/erpnext/accounts/doctype/sales_invoice_item/sales_invoice_item.json
@@ -729,6 +729,7 @@
    "label": "Rate With Margin", 
    "length": 0, 
    "no_copy": 0, 
+   "options": "currency", 
    "permlevel": 0, 
    "precision": "2", 
    "print_hide": 1, 
@@ -809,6 +810,38 @@
    "bold": 0, 
    "collapsible": 0, 
    "columns": 0, 
+   "depends_on": "eval:doc.margin_type && doc.price_list_rate && doc.margin_rate_or_amount", 
+   "fieldname": "base_rate_with_margin", 
+   "fieldtype": "Currency", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Rate With Margin (Company Currency)", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "Company:company:default_currency", 
+   "permlevel": 0, 
+   "precision": "2", 
+   "print_hide": 1, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 1, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "section_break1", 
    "fieldtype": "Section Break", 
    "hidden": 0, 
@@ -2166,7 +2199,7 @@
  "issingle": 0, 
  "istable": 1, 
  "max_attachments": 0, 
- "modified": "2017-09-27 08:31:37.827893", 
+ "modified": "2017-11-03 11:33:36.004844", 
  "modified_by": "Administrator", 
  "module": "Accounts", 
  "name": "Sales Invoice Item", 
diff --git a/erpnext/accounts/report/accounts_receivable/accounts_receivable.py b/erpnext/accounts/report/accounts_receivable/accounts_receivable.py
index 56db392..ba5b7f2 100644
--- a/erpnext/accounts/report/accounts_receivable/accounts_receivable.py
+++ b/erpnext/accounts/report/accounts_receivable/accounts_receivable.py
@@ -309,14 +309,16 @@
 
 		rows = []
 		for d in data:
-			rows.append(d[self.ageing_col_idx_start : self.ageing_col_idx_start+4])
-
-		if rows:
-			rows.insert(0, [[d.get("label")] for d in ageing_columns])
+			rows.append(
+				{
+					'values': d[self.ageing_col_idx_start : self.ageing_col_idx_start+4]
+				}
+			)
 
 		return {
 			"data": {
-				'labels': rows
+				'labels': [d.get("label") for d in ageing_columns],
+				'datasets': rows
 			},
 			"type": 'percentage'
 		}
diff --git a/erpnext/accounts/report/delivered_items_to_be_billed/delivered_items_to_be_billed.json b/erpnext/accounts/report/delivered_items_to_be_billed/delivered_items_to_be_billed.json
index f0399b0..08bbf8d 100644
--- a/erpnext/accounts/report/delivered_items_to_be_billed/delivered_items_to_be_billed.json
+++ b/erpnext/accounts/report/delivered_items_to_be_billed/delivered_items_to_be_billed.json
@@ -1,5 +1,5 @@
 {
- "add_total_row": 0, 
+ "add_total_row": 1, 
  "apply_user_permissions": 1, 
  "creation": "2013-07-30 17:28:49", 
  "disabled": 0, 
@@ -7,7 +7,7 @@
  "doctype": "Report", 
  "idx": 3, 
  "is_standard": "Yes", 
- "modified": "2017-02-24 20:20:20.613388", 
+ "modified": "2017-11-06 13:04:36.338268", 
  "modified_by": "Administrator", 
  "module": "Accounts", 
  "name": "Delivered Items To Be Billed", 
diff --git a/erpnext/accounts/report/ordered_items_to_be_billed/ordered_items_to_be_billed.json b/erpnext/accounts/report/ordered_items_to_be_billed/ordered_items_to_be_billed.json
index db3c9d2..c983dc9 100644
--- a/erpnext/accounts/report/ordered_items_to_be_billed/ordered_items_to_be_billed.json
+++ b/erpnext/accounts/report/ordered_items_to_be_billed/ordered_items_to_be_billed.json
@@ -1,5 +1,5 @@
 {
- "add_total_row": 0, 
+ "add_total_row": 1, 
  "apply_user_permissions": 1, 
  "creation": "2013-02-21 14:26:44", 
  "disabled": 0, 
@@ -7,7 +7,7 @@
  "doctype": "Report", 
  "idx": 3, 
  "is_standard": "Yes", 
- "modified": "2017-02-24 20:20:13.972178", 
+ "modified": "2017-11-06 13:04:51.559061", 
  "modified_by": "Administrator", 
  "module": "Accounts", 
  "name": "Ordered Items To Be Billed", 
diff --git a/erpnext/accounts/report/received_items_to_be_billed/received_items_to_be_billed.json b/erpnext/accounts/report/received_items_to_be_billed/received_items_to_be_billed.json
index 906481f..64eb984 100644
--- a/erpnext/accounts/report/received_items_to_be_billed/received_items_to_be_billed.json
+++ b/erpnext/accounts/report/received_items_to_be_billed/received_items_to_be_billed.json
@@ -1,5 +1,5 @@
 {
- "add_total_row": 0, 
+ "add_total_row": 1, 
  "apply_user_permissions": 1, 
  "creation": "2013-07-30 18:35:10", 
  "disabled": 0, 
@@ -7,7 +7,7 @@
  "doctype": "Report", 
  "idx": 3, 
  "is_standard": "Yes", 
- "modified": "2017-02-24 19:59:52.887744", 
+ "modified": "2017-11-06 13:04:26.094432", 
  "modified_by": "Administrator", 
  "module": "Accounts", 
  "name": "Received Items To Be Billed", 
diff --git a/erpnext/accounts/report/sales_payment_summary/__init__.py b/erpnext/accounts/report/sales_payment_summary/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/erpnext/accounts/report/sales_payment_summary/__init__.py
diff --git a/erpnext/accounts/report/sales_payment_summary/sales_payment_summary.js b/erpnext/accounts/report/sales_payment_summary/sales_payment_summary.js
new file mode 100644
index 0000000..6b46214
--- /dev/null
+++ b/erpnext/accounts/report/sales_payment_summary/sales_payment_summary.js
@@ -0,0 +1,57 @@
+// Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
+// License: GNU General Public License v3. See license.txt
+
+frappe.query_reports["Sales Payment Summary"] = {
+	"filters": [
+		{
+			"fieldname":"from_date",
+			"label": __("From Date"),
+			"fieldtype": "Date",
+			"default": frappe.datetime.get_today(),
+			"width": "80"
+		},
+		{
+			"fieldname":"to_date",
+			"label": __("To Date"),
+			"fieldtype": "Date",
+			"default": frappe.datetime.get_today()
+		},
+		{
+			"fieldname":"company",
+			"label": __("Company"),
+			"fieldtype": "Link",
+			"options": "Company",
+			"default": frappe.defaults.get_user_default("Company")
+		},
+		{
+			"fieldname":"mode_of_payment",
+			"label": __("Mode of Payment"),
+			"fieldtype": "Link",
+			"options": "Mode of Payment"
+		},
+		{
+			"fieldname":"owner",
+			"label": __("Owner"),
+			"fieldtype": "Link",
+			"options": "User",
+			"defaults": user
+		},
+		{
+			"fieldname":"cost_center",
+			"label": __("Cost Center"),
+			"fieldtype": "Link",
+			"options": "Cost Center"
+		},
+		{
+			"fieldname":"warehouse",
+			"label": __("Warehouse"),
+			"fieldtype": "Link",
+			"options": "Warehouse"
+		},
+		{
+			"fieldname":"is_pos",
+			"label": __("POS?"),
+			"fieldtype": "Check"
+		}
+	]
+};
diff --git a/erpnext/accounts/report/sales_payment_summary/sales_payment_summary.json b/erpnext/accounts/report/sales_payment_summary/sales_payment_summary.json
new file mode 100644
index 0000000..8c6242f
--- /dev/null
+++ b/erpnext/accounts/report/sales_payment_summary/sales_payment_summary.json
@@ -0,0 +1,26 @@
+{
+ "add_total_row": 1, 
+ "apply_user_permissions": 1, 
+ "creation": "2017-11-03 16:31:45.757516", 
+ "disabled": 0, 
+ "docstatus": 0, 
+ "doctype": "Report", 
+ "idx": 0, 
+ "is_standard": "Yes", 
+ "modified": "2017-11-04 05:15:35.892659", 
+ "modified_by": "Administrator", 
+ "module": "Accounts", 
+ "name": "Sales Payment Summary", 
+ "owner": "Administrator", 
+ "ref_doctype": "Sales Invoice", 
+ "report_name": "Sales Payment Summary", 
+ "report_type": "Script Report", 
+ "roles": [
+  {
+   "role": "Accounts Manager"
+  }, 
+  {
+   "role": "Accounts User"
+  }
+ ]
+}
\ No newline at end of file
diff --git a/erpnext/accounts/report/sales_payment_summary/sales_payment_summary.py b/erpnext/accounts/report/sales_payment_summary/sales_payment_summary.py
new file mode 100644
index 0000000..bb80955
--- /dev/null
+++ b/erpnext/accounts/report/sales_payment_summary/sales_payment_summary.py
@@ -0,0 +1,66 @@
+# Copyright (c) 2013, Frappe Technologies Pvt. Ltd. and contributors
+# For license information, please see license.txt
+
+from __future__ import unicode_literals
+import frappe
+from frappe import _
+
+def execute(filters=None):
+	columns, data = [], []
+	columns=get_columns()
+	data=get_sales_payment_data(filters, columns)
+	return columns, data
+
+def get_columns():
+	return [
+		_("Date") + ":Date:80",
+		_("Owner") + "::150",
+		_("Payment Mode") + "::120",
+		_("Warehouse") + ":Link/Cost Center:100",
+		_("Cost Center") + ":Link/Warehouse:100",
+		_("Sales and Returns") + ":Currency/currency:120",
+		_("Taxes") + ":Currency/currency:120",
+		_("Payments") + ":Currency/currency:120",
+		_("Reconciliation") + ":Currency/currency:120"
+	]
+
+def get_sales_payment_data(filters, columns):
+	sales_invoice_data = get_sales_invoice_data(filters)
+	data = []
+	for inv in sales_invoice_data:
+		row = [inv.posting_date, inv.owner, inv.mode_of_payment,inv.warehouse,
+			inv.cost_center,inv.net_total, inv.total_taxes, inv.paid_amount,
+			(inv.net_total + inv.total_taxes - inv.paid_amount)]
+		data.append(row)
+	return data
+
+def get_conditions(filters):
+	conditions = ""
+	if filters.get("company"): conditions += " a.company=%(company)s"
+	if filters.get("customer"): conditions += " and a.customer = %(customer)s"
+	if filters.get("owner"): conditions += " and a.owner = %(owner)s"
+	if filters.get("from_date"): conditions += " and a.posting_date >= %(from_date)s"
+	if filters.get("to_date"): conditions += " and a.posting_date <= %(to_date)s"
+	if filters.get("mode_of_payment"): conditions += " and c.mode_of_payment >= %(mode_of_payment)s"
+	if filters.get("warehouse"): conditions += " and b.warehouse <= %(warehouse)s"
+	if filters.get("cost_center"): conditions += " and b.cost_center <= %(cost_center)s"
+	if filters.get("is_pos"): conditions += " and a.is_pos = %(is_pos)s"
+
+	return conditions
+
+def get_sales_invoice_data(filters):
+	conditions = get_conditions(filters)
+	return frappe.db.sql("""
+		select
+			a.owner, a.posting_date, c.mode_of_payment, b.warehouse, b.cost_center,
+			sum(a.net_total) as "net_total",
+			sum(a.total_taxes_and_charges) as "total_taxes",
+			sum(a.base_paid_amount) as "paid_amount"
+		from `tabSales Invoice` a, `tabSales Invoice Item` b, `tabSales Invoice Payment` c
+		where
+			a.name = b.parent
+			and a.name = c.parent
+			and {conditions}
+			group by
+			a.owner, a.posting_date, c.mode_of_payment, b.warehouse, b.cost_center
+	""".format(conditions=conditions), filters, as_dict=1)
\ No newline at end of file
diff --git a/erpnext/accounts/utils.py b/erpnext/accounts/utils.py
index f7aa341..a8fd5e9 100644
--- a/erpnext/accounts/utils.py
+++ b/erpnext/accounts/utils.py
@@ -630,7 +630,7 @@
 			'invoice_amount': flt(d.invoice_amount),
 			'payment_amount': flt(d.payment_amount),
 			'outstanding_amount': flt(d.invoice_amount - d.payment_amount, precision),
-			'due_date': frappe.db.get_value(d.voucher_type, d.voucher_no, 
+			'due_date': frappe.db.get_value(d.voucher_type, d.voucher_no,
 				"posting_date" if party_type=="Employee" else "due_date"),
 		}))
 
@@ -656,16 +656,14 @@
 		order_by="name")]
 
 @frappe.whitelist()
-def get_children():
+def get_children(doctype, parent, company, is_root=False):
 	from erpnext.accounts.report.financial_statements import sort_root_accounts
 
-	args = frappe.local.form_dict
-	doctype, company = args['doctype'], args['company']
 	fieldname = frappe.db.escape(doctype.lower().replace(' ','_'))
 	doctype = frappe.db.escape(doctype)
 
 	# root
-	if args['parent'] in ("Accounts", "Cost Centers"):
+	if is_root:
 		fields = ", root_type, report_type, account_currency" if doctype=="Account" else ""
 		acc = frappe.db.sql(""" select
 			name as value, is_group as expandable {fields}
@@ -675,7 +673,7 @@
 			order by name""".format(fields=fields, fieldname = fieldname, doctype=doctype),
 				company, as_dict=1)
 
-		if args["parent"]=="Accounts":
+		if parent=="Accounts":
 			sort_root_accounts(acc)
 	else:
 		# other
@@ -686,7 +684,7 @@
 			where ifnull(`parent_{fieldname}`,'') = %s
 			and docstatus<2
 			order by name""".format(fields=fields, fieldname=fieldname, doctype=doctype),
-				args['parent'], as_dict=1)
+				parent, as_dict=1)
 
 	if doctype == 'Account':
 		company_currency = frappe.db.get_value("Company", company, "default_currency")
diff --git a/erpnext/buying/doctype/buying_settings/buying_settings.json b/erpnext/buying/doctype/buying_settings/buying_settings.json
index ac97255..25e9c15 100644
--- a/erpnext/buying/doctype/buying_settings/buying_settings.json
+++ b/erpnext/buying/doctype/buying_settings/buying_settings.json
@@ -182,6 +182,38 @@
    "search_index": 0, 
    "set_only_once": 0, 
    "unique": 0
+  },
+  {
+   "allow_bulk_edit": 0,
+   "allow_on_submit": 0,
+   "bold": 0,
+   "collapsible": 0,
+   "columns": 0,
+   "default": "0",
+   "description": "If enabled, last purchase details of items will not be fetched from previous purchase order or purchase receipt",
+   "fieldname": "disable_fetch_last_purchase_rate",
+   "fieldtype": "Check",
+   "hidden": 0,
+   "ignore_user_permissions": 0,
+   "ignore_xss_filter": 0,
+   "in_filter": 0,
+   "in_global_search": 0,
+   "in_list_view": 0,
+   "in_standard_filter": 0,
+   "label": "Disable Fetching Last Purchase Details in Purchase Order",
+   "length": 0,
+   "no_copy": 0,
+   "permlevel": 0,
+   "precision": "",
+   "print_hide": 0,
+   "print_hide_if_no_value": 0,
+   "read_only": 0,
+   "remember_last_selected_value": 0,
+   "report_hide": 0,
+   "reqd": 0,
+   "search_index": 0,
+   "set_only_once": 0,
+   "unique": 0
   }
  ], 
  "hide_heading": 0, 
diff --git a/erpnext/buying/doctype/purchase_order/purchase_order.py b/erpnext/buying/doctype/purchase_order/purchase_order.py
index 4150993..bbaa043 100644
--- a/erpnext/buying/doctype/purchase_order/purchase_order.py
+++ b/erpnext/buying/doctype/purchase_order/purchase_order.py
@@ -4,7 +4,7 @@
 from __future__ import unicode_literals
 import frappe
 import json
-from frappe.utils import cstr, flt
+from frappe.utils import cstr, flt, cint
 from frappe import msgprint, _
 from frappe.model.mapper import get_mapped_doc
 from erpnext.controllers.buying_controller import BuyingController
@@ -105,25 +105,26 @@
 	def get_last_purchase_rate(self):
 		"""get last purchase rates for all items"""
 
-		conversion_rate = flt(self.get('conversion_rate')) or 1.0
+		if not cint(frappe.db.get_single_value("Buying Settings", "disable_fetch_last_purchase_rate")):
+			conversion_rate = flt(self.get('conversion_rate')) or 1.0
 
-		for d in self.get("items"):
-			if d.item_code:
-				last_purchase_details = get_last_purchase_details(d.item_code, self.name)
+			for d in self.get("items"):
+				if d.item_code:
+					last_purchase_details = get_last_purchase_details(d.item_code, self.name)
 
-				if last_purchase_details:
-					d.base_price_list_rate = (last_purchase_details['base_price_list_rate'] *
-						(flt(d.conversion_factor) or 1.0))
-					d.discount_percentage = last_purchase_details['discount_percentage']
-					d.base_rate = last_purchase_details['base_rate'] * (flt(d.conversion_factor) or 1.0)
-					d.price_list_rate = d.base_price_list_rate / conversion_rate
-					d.last_purchase_rate = d.base_rate / conversion_rate
-				else:
+					if last_purchase_details:
+						d.base_price_list_rate = (last_purchase_details['base_price_list_rate'] *
+							(flt(d.conversion_factor) or 1.0))
+						d.discount_percentage = last_purchase_details['discount_percentage']
+						d.base_rate = last_purchase_details['base_rate'] * (flt(d.conversion_factor) or 1.0)
+						d.price_list_rate = d.base_price_list_rate / conversion_rate
+						d.last_purchase_rate = d.base_rate / conversion_rate
+					else:
 
-					item_last_purchase_rate = frappe.db.get_value("Item", d.item_code, "last_purchase_rate")
-					if item_last_purchase_rate:
-						d.base_price_list_rate = d.base_rate = d.price_list_rate \
-							= d.last_purchase_rate = item_last_purchase_rate
+						item_last_purchase_rate = frappe.db.get_value("Item", d.item_code, "last_purchase_rate")
+						if item_last_purchase_rate:
+							d.base_price_list_rate = d.base_rate = d.price_list_rate \
+								= d.last_purchase_rate = item_last_purchase_rate
 
 	# Check for Closed status
 	def check_for_closed_status(self):
diff --git a/erpnext/buying/doctype/purchase_order/tests/test_purchase_order_with_last_purchase_rate.js b/erpnext/buying/doctype/purchase_order/tests/test_purchase_order_with_last_purchase_rate.js
index d19f017..bd5881b 100644
--- a/erpnext/buying/doctype/purchase_order/tests/test_purchase_order_with_last_purchase_rate.js
+++ b/erpnext/buying/doctype/purchase_order/tests/test_purchase_order_with_last_purchase_rate.js
@@ -1,7 +1,7 @@
 QUnit.module('Buying');
 
 QUnit.test("test: purchase order with last purchase rate", function(assert) {
-	assert.expect(5);
+	assert.expect(9);
 	let done = assert.async();
 
 	frappe.run_serially([
@@ -77,9 +77,11 @@
 		// Get the last purchase rate of items
 		() => {
 			assert.ok(cur_frm.doc.items[0].last_purchase_rate == 800, "Last purchase rate of item 1 correct");
+			assert.ok(cur_frm.doc.items[1].last_purchase_rate != 0);
 		},
 		() => {
 			assert.ok(cur_frm.doc.items[1].last_purchase_rate == 400, "Last purchase rate of item 2 correct");
+			assert.ok(cur_frm.doc.items[1].last_purchase_rate != 0);
 		},
 
 		() => frappe.tests.click_button('Submit'),
@@ -94,6 +96,59 @@
 			assert.ok(cur_frm.doc.status == 'To Receive and Bill', "Submitted successfully");
 		},
 
+		// enable allow_last_purchase_rate
+		() => frappe.tests.make('Buying Settings', [
+			// values to be set
+			{"disable_fetch_last_purchase_rate": 1}
+		]),
+
+		() => {
+			return frappe.tests.make('Purchase Order', [
+				{supplier: 'Test Supplier'},
+				{is_subcontracted: 'No'},
+				{currency: 'INR'},
+				{items: [
+					[
+						{"item_code": 'Test Product 4'},
+						{"schedule_date": frappe.datetime.add_days(frappe.datetime.now_date(), 1)},
+						{"expected_delivery_date": frappe.datetime.add_days(frappe.datetime.now_date(), 5)},
+						{"qty": 1},
+						{"rate": 800},
+						{"warehouse": 'Stores - '+frappe.get_abbr(frappe.defaults.get_default("Company"))}
+					],
+					[
+						{"item_code": 'Test Product 1'},
+						{"schedule_date": frappe.datetime.add_days(frappe.datetime.now_date(), 1)},
+						{"expected_delivery_date": frappe.datetime.add_days(frappe.datetime.now_date(), 5)},
+						{"qty": 1},
+						{"rate": 400},
+						{"warehouse": 'Stores - '+frappe.get_abbr(frappe.defaults.get_default("Company"))}
+					]
+				]}
+			]);
+		},
+
+		() => {
+			// Get item details
+			assert.ok(cur_frm.doc.items[0].last_purchase_rate == 0);
+			assert.ok(cur_frm.doc.items[1].last_purchase_rate == 0);
+		},
+
+		() => frappe.timeout(1),
+
+		() => frappe.tests.click_button('Submit'),
+		() => frappe.tests.click_button('Yes'),
+		() => frappe.timeout(3),
+
+		() => frappe.tests.click_button('Close'),
+		() => frappe.timeout(1),
+
+		// enable allow_last_purchase_rate
+		() => frappe.tests.make('Buying Settings', [
+			// values to be set
+			{"disable_fetch_last_purchase_rate": 0}
+		]),
+
 		() => done()
 	]);
 });
\ No newline at end of file
diff --git a/erpnext/buying/doctype/request_for_quotation/request_for_quotation.py b/erpnext/buying/doctype/request_for_quotation/request_for_quotation.py
index 5becb82..97c4438 100644
--- a/erpnext/buying/doctype/request_for_quotation/request_for_quotation.py
+++ b/erpnext/buying/doctype/request_for_quotation/request_for_quotation.py
@@ -138,7 +138,7 @@
 			'user_fullname': full_name
 		}
 
-		subject = _("Request for Quotation: {0}".format(self.name))
+		subject = _("Request for Quotation")
 		template = "templates/emails/request_for_quotation.html"
 		sender = frappe.session.user not in STANDARD_USERS and frappe.session.user or None
 		message = frappe.get_template(template).render(args)
diff --git a/erpnext/config/accounts.py b/erpnext/config/accounts.py
index cdce13b..58fb2f0 100644
--- a/erpnext/config/accounts.py
+++ b/erpnext/config/accounts.py
@@ -468,6 +468,12 @@
 					"name": "Customer Credit Balance",
 					"doctype": "Customer"
 				},
+				{
+					"type": "report",
+					"is_query_report": True,
+					"name": "Sales Payment Summary",
+					"doctype": "Sales Invoice"
+				}
 			]
 		},
 		{
diff --git a/erpnext/config/projects.py b/erpnext/config/projects.py
index a8514b2..b97e097 100644
--- a/erpnext/config/projects.py
+++ b/erpnext/config/projects.py
@@ -15,6 +15,7 @@
 				{
 					"type": "doctype",
 					"name": "Task",
+					"route": "Tree/Task",
 					"description": _("Project activity / task."),
 				},
 				{
diff --git a/erpnext/config/schools.py b/erpnext/config/schools.py
index dbdcd35..1e7d1b0 100644
--- a/erpnext/config/schools.py
+++ b/erpnext/config/schools.py
@@ -124,10 +124,6 @@
 				},
 				{
 					"type": "doctype",
-					"name": "Grading Scale"
-				},
-				{
-					"type": "doctype",
 					"name": "Assessment Criteria"
 				},
 				{
@@ -144,6 +140,12 @@
 					"name": "Course wise Assessment Report",
 					"doctype": "Assessment Result"
 				},
+				{
+					"type": "report",
+					"is_query_report": True,
+					"name": "Assessment Plan Status",
+					"doctype": "Assessment Plan"
+				},
 
 			]
 		},
@@ -203,6 +205,10 @@
 				},
 				{
 					"type": "doctype",
+					"name": "Grading Scale"
+				},
+				{
+					"type": "doctype",
 					"name": "Academic Term"
 				},
 				{
diff --git a/erpnext/config/stock.py b/erpnext/config/stock.py
index d6b18fd..cb17deb 100644
--- a/erpnext/config/stock.py
+++ b/erpnext/config/stock.py
@@ -9,22 +9,18 @@
 				{
 					"type": "doctype",
 					"name": "Stock Entry",
-					"description": _("Record item movement."),
 				},
 				{
 					"type": "doctype",
 					"name": "Delivery Note",
-					"description": _("Shipments to customers."),
 				},
 				{
 					"type": "doctype",
 					"name": "Purchase Receipt",
-					"description": _("Goods received from Suppliers."),
 				},
 				{
 					"type": "doctype",
 					"name": "Material Request",
-					"description": _("Requests for items."),
 				},
 			]
 		},
@@ -69,17 +65,14 @@
 				{
 					"type": "doctype",
 					"name": "Item",
-					"description": _("All Products or Services."),
 				},
 				{
 					"type": "doctype",
 					"name": "Product Bundle",
-					"description": _("Bundle items at time of sale."),
 				},
 				{
 					"type": "doctype",
 					"name": "Price List",
-					"description": _("Price List master.")
 				},
 				{
 					"type": "doctype",
@@ -87,30 +80,24 @@
 					"icon": "fa fa-sitemap",
 					"label": _("Item Group"),
 					"link": "Tree/Item Group",
-					"description": _("Tree of Item Groups."),
 				},
 				{
 					"type": "doctype",
 					"name": "Item Price",
-					"description": _("Multiple Item prices."),
 					"route": "Report/Item Price"
 				},
 				{
 					"type": "doctype",
 					"name": "Shipping Rule",
-					"description": _("Rules for adding shipping costs.")
 				},
 				{
 					"type": "doctype",
 					"name": "Pricing Rule",
-					"description": _("Rules for applying pricing and discount.")
 				},
 				{
 					"type": "doctype",
 					"name": "Item Variant Settings",
-					"description": _("Item Variant Settings."),
 				},
-
 			]
 		},
 		{
@@ -119,17 +106,14 @@
 				{
 					"type": "doctype",
 					"name": "Serial No",
-					"description": _("Single unit of an Item."),
 				},
 				{
 					"type": "doctype",
 					"name": "Batch",
-					"description": _("Batch (lot) of an Item."),
 				},
 				{
 					"type": "doctype",
 					"name": "Installation Note",
-					"description": _("Installation record for a Serial No.")
 				},
 				{
 					"type": "report",
@@ -155,22 +139,18 @@
 				{
 					"type": "doctype",
 					"name": "Stock Reconciliation",
-					"description": _("Upload stock balance via csv.")
 				},
 				{
 					"type": "doctype",
 					"name": "Packing Slip",
-					"description": _("Split Delivery Note into packages.")
 				},
 				{
 					"type": "doctype",
 					"name": "Quality Inspection",
-					"description": _("Incoming quality inspection.")
 				},
 				{
 					"type": "doctype",
 					"name": "Landed Cost Voucher",
-					"description": _("Update additional costs to calculate landed cost of items"),
 				}
 			]
 		},
@@ -181,28 +161,27 @@
 				{
 					"type": "doctype",
 					"name": "Stock Settings",
-					"description": _("Default settings for stock transactions.")
 				},
 				{
 					"type": "doctype",
 					"name": "Warehouse",
-					"description": _("Where items are stored."),
 				},
 				{
 					"type": "doctype",
 					"name": "UOM",
 					"label": _("Unit of Measure") + " (UOM)",
-					"description": _("e.g. Kg, Unit, Nos, m")
 				},
 				{
 					"type": "doctype",
 					"name": "Item Attribute",
-					"description": _("Attributes for Item Variants. e.g Size, Color etc."),
 				},
 				{
 					"type": "doctype",
 					"name": "Brand",
-					"description": _("Brand master.")
+				},
+				{
+					"type": "doctype",
+					"name": "Item Variant Settings",
 				},
 			]
 		},
diff --git a/erpnext/controllers/item_variant.py b/erpnext/controllers/item_variant.py
index f40d519..821c81c 100644
--- a/erpnext/controllers/item_variant.py
+++ b/erpnext/controllers/item_variant.py
@@ -239,3 +239,20 @@
 	if abbreviations:
 		variant.item_code = "{0}-{1}".format(template_item_code, "-".join(abbreviations))
 		variant.item_name = "{0}-{1}".format(template_item_name, "-".join(abbreviations))
+
+@frappe.whitelist()
+def create_variant_doc_for_quick_entry(template, args):
+	variant_based_on = frappe.db.get_value("Item", template, "variant_based_on")
+	args = json.loads(args)
+	if variant_based_on == "Manufacturer":
+		variant = get_variant(template, **args)
+	else:
+		existing_variant = get_variant(template, args)
+		if existing_variant:
+			return existing_variant
+		else:
+			variant = create_variant(template, args=args)
+			variant.name = variant.item_code
+			validate_item_variant_attributes(variant, args)
+	return variant.as_dict()
+
diff --git a/erpnext/controllers/taxes_and_totals.py b/erpnext/controllers/taxes_and_totals.py
index e85e56b..e9672df 100644
--- a/erpnext/controllers/taxes_and_totals.py
+++ b/erpnext/controllers/taxes_and_totals.py
@@ -62,7 +62,7 @@
 						(1.0 - (item.discount_percentage / 100.0)), item.precision("rate"))
 
 				if item.doctype in ['Quotation Item', 'Sales Order Item', 'Delivery Note Item', 'Sales Invoice Item']:
-					item.rate_with_margin = self.calculate_margin(item)
+					item.rate_with_margin, item.base_rate_with_margin = self.calculate_margin(item)
 
 					item.rate = flt(item.rate_with_margin * (1.0 - (item.discount_percentage / 100.0)), item.precision("rate"))\
 						if item.rate_with_margin > 0 else item.rate
@@ -503,6 +503,7 @@
 
 	def calculate_margin(self, item):
 		rate_with_margin = 0.0
+		base_rate_with_margin = 0.0
 		if item.price_list_rate:
 			if item.pricing_rule and not self.doc.ignore_pricing_rule:
 				pricing_rule = frappe.get_doc('Pricing Rule', item.pricing_rule)
@@ -512,8 +513,9 @@
 			if item.margin_type and item.margin_rate_or_amount:
 				margin_value = item.margin_rate_or_amount if item.margin_type == 'Amount' else flt(item.price_list_rate) * flt(item.margin_rate_or_amount) / 100
 				rate_with_margin = flt(item.price_list_rate) + flt(margin_value)
+				base_rate_with_margin = flt(rate_with_margin) * flt(self.doc.conversion_rate)
 
-		return rate_with_margin
+		return rate_with_margin, base_rate_with_margin
 
 	def set_item_wise_tax_breakup(self):
 		self.doc.other_charges_calculation = get_itemised_tax_breakup_html(self.doc)
diff --git a/erpnext/docs/user/manual/en/customize-erpnext/articles/field-types.md b/erpnext/docs/user/manual/en/customize-erpnext/articles/field-types.md
index 24cb4ab..c73ebc7 100644
--- a/erpnext/docs/user/manual/en/customize-erpnext/articles/field-types.md
+++ b/erpnext/docs/user/manual/en/customize-erpnext/articles/field-types.md
@@ -56,6 +56,17 @@
 
 Link field is connected to another master from where it fetches data. For example, in the Quotation master, Customer is a Link field.
 
+- Geolocation
+
+Use Geolocation field to store GeoJSON <a href="https://tools.ietf.org/html/rfc7946#section-3.3">featurecollection</a>. Stores polygons, lines and points. Internally it uses following custom properties for identifying a circle.
+
+```
+{
+	"point_type": "circle",
+	"radius": 10.00
+}
+```
+
 - Password
 
 Password field will have decode value in it.
@@ -84,4 +95,4 @@
 
 Text Editor is text field. It has text-formatting options. In ERPNext, this field is generally used for defining Terms and Conditions.
 
-<!-- markdown -->
\ No newline at end of file
+<!-- markdown -->
diff --git a/erpnext/docs/user/manual/en/stock/item/index.txt b/erpnext/docs/user/manual/en/stock/item/index.txt
index 4e66875..db5fa0a 100644
--- a/erpnext/docs/user/manual/en/stock/item/index.txt
+++ b/erpnext/docs/user/manual/en/stock/item/index.txt
@@ -4,3 +4,4 @@
 purchase-details
 reorder
 item-valuation-fifo-and-moving-average
+item-settings
diff --git a/erpnext/docs/user/manual/en/stock/setup/stock-settings.md b/erpnext/docs/user/manual/en/stock/setup/stock-settings.md
index 32562c6..96d1627 100644
--- a/erpnext/docs/user/manual/en/stock/setup/stock-settings.md
+++ b/erpnext/docs/user/manual/en/stock/setup/stock-settings.md
@@ -4,4 +4,12 @@
 
 <img class="screenshot" alt="Stock Settings" src="/docs/assets/img/stock/stock-settings.png">
 
+### Clean HTML Description
+
+Usually descriptions are copy-pasted from a website or Word / PDF file and they contain a lot of embedded style. This messes up the Print view of your invoices or quotes.
+
+To fix this, you can check "Convert Item Description to Clean HTML" in Stock Settings. This will ensure that when you save your Items, their descriptions will be cleaned up.
+
+If you want control your description views and llow any HTML to be embedded, you can uncheck this property.
+
 {next}
\ No newline at end of file
diff --git a/erpnext/domains/manufacturing.py b/erpnext/domains/manufacturing.py
index b8bb7e0..8c911a3 100644
--- a/erpnext/domains/manufacturing.py
+++ b/erpnext/domains/manufacturing.py
@@ -18,8 +18,5 @@
 	'set_value': [
 		['Stock Settings', None, 'show_barcode_field', 1]
 	],
-	'restricted_roles': [
-		'Manufacturing User'
-	],
 	'default_portal_role': 'Customer'
 }
\ No newline at end of file
diff --git a/erpnext/erpnext_integrations/__init__.py b/erpnext/erpnext_integrations/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/erpnext/erpnext_integrations/__init__.py
diff --git a/erpnext/erpnext_integrations/connectors/__init__.py b/erpnext/erpnext_integrations/connectors/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/erpnext/erpnext_integrations/connectors/__init__.py
diff --git a/erpnext/erpnext_integrations/connectors/github_connection.py b/erpnext/erpnext_integrations/connectors/github_connection.py
new file mode 100644
index 0000000..ab7708d
--- /dev/null
+++ b/erpnext/erpnext_integrations/connectors/github_connection.py
@@ -0,0 +1,45 @@
+from __future__ import unicode_literals
+import frappe
+from frappe.data_migration.doctype.data_migration_connector.connectors.base import BaseConnection
+from github import Github
+
+class GithubConnection(BaseConnection):
+	def __init__(self, connector):
+		self.connector = connector
+
+		try:
+			password = self.get_password()
+		except frappe.AuthenticationError:
+			password = None
+
+		if self.connector.username and password:
+			self.connection = Github(self.connector.username, self.get_password())
+		else:
+			self.connection = Github()
+
+		self.name_field = 'id'
+
+	def insert(self, doctype, doc):
+		pass
+
+	def update(self, doctype, doc, migration_id):
+		pass
+
+	def delete(self, doctype, migration_id):
+		pass
+
+	def get(self, remote_objectname, fields=None, filters=None, start=0, page_length=10):
+		repo = filters.get('repo')
+
+		if remote_objectname == 'Milestone':
+			return self.get_milestones(repo, start, page_length)
+		if remote_objectname == 'Issue':
+			return self.get_issues(repo, start, page_length)
+
+	def get_milestones(self, repo, start=0, page_length=10):
+		_repo = self.connection.get_repo(repo)
+		return list(_repo.get_milestones()[start:start+page_length])
+
+	def get_issues(self, repo, start=0, page_length=10):
+		_repo = self.connection.get_repo(repo)
+		return list(_repo.get_issues()[start:start+page_length])
diff --git a/erpnext/erpnext_integrations/data_migration_mapping/__init__.py b/erpnext/erpnext_integrations/data_migration_mapping/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/erpnext/erpnext_integrations/data_migration_mapping/__init__.py
diff --git a/erpnext/erpnext_integrations/data_migration_mapping/issue_to_task/__init__.py b/erpnext/erpnext_integrations/data_migration_mapping/issue_to_task/__init__.py
new file mode 100644
index 0000000..5f0f691
--- /dev/null
+++ b/erpnext/erpnext_integrations/data_migration_mapping/issue_to_task/__init__.py
@@ -0,0 +1,11 @@
+import frappe
+
+def pre_process(issue):
+
+	project = frappe.db.get_value('Project', filters={'project_name': issue.milestone})
+	return {
+		'title': issue.title,
+		'body': frappe.utils.to_html(issue.body or ''),
+		'state': issue.state.title(),
+		'project': project or ''
+	}
diff --git a/erpnext/erpnext_integrations/data_migration_mapping/issue_to_task/issue_to_task.json b/erpnext/erpnext_integrations/data_migration_mapping/issue_to_task/issue_to_task.json
new file mode 100644
index 0000000..e945ba2
--- /dev/null
+++ b/erpnext/erpnext_integrations/data_migration_mapping/issue_to_task/issue_to_task.json
@@ -0,0 +1,36 @@
+{
+ "condition": "{\"repo\":\"frappe/erpnext\"}", 
+ "creation": "2017-10-16 16:03:32.772191", 
+ "docstatus": 0, 
+ "doctype": "Data Migration Mapping", 
+ "fields": [
+  {
+   "is_child_table": 0, 
+   "local_fieldname": "subject", 
+   "remote_fieldname": "title"
+  }, 
+  {
+   "is_child_table": 0, 
+   "local_fieldname": "description", 
+   "remote_fieldname": "body"
+  }, 
+  {
+   "is_child_table": 0, 
+   "local_fieldname": "status", 
+   "remote_fieldname": "state"
+  }
+ ], 
+ "idx": 0, 
+ "local_doctype": "Task", 
+ "local_primary_key": "name", 
+ "mapping_name": "Issue to Task", 
+ "mapping_type": "Pull", 
+ "migration_id_field": "github_sync_id", 
+ "modified": "2017-10-20 11:48:54.575993", 
+ "modified_by": "Administrator", 
+ "name": "Issue to Task", 
+ "owner": "Administrator", 
+ "page_length": 10, 
+ "remote_objectname": "Issue", 
+ "remote_primary_key": "id"
+}
\ No newline at end of file
diff --git a/erpnext/erpnext_integrations/data_migration_mapping/milestone_to_project/__init__.py b/erpnext/erpnext_integrations/data_migration_mapping/milestone_to_project/__init__.py
new file mode 100644
index 0000000..212f81b
--- /dev/null
+++ b/erpnext/erpnext_integrations/data_migration_mapping/milestone_to_project/__init__.py
@@ -0,0 +1,6 @@
+def pre_process(milestone):
+	return {
+		'title': milestone.title,
+		'description': milestone.description,
+		'state': milestone.state.title()
+	}
diff --git a/erpnext/erpnext_integrations/data_migration_mapping/milestone_to_project/milestone_to_project.json b/erpnext/erpnext_integrations/data_migration_mapping/milestone_to_project/milestone_to_project.json
new file mode 100644
index 0000000..5a3e07e
--- /dev/null
+++ b/erpnext/erpnext_integrations/data_migration_mapping/milestone_to_project/milestone_to_project.json
@@ -0,0 +1,36 @@
+{
+ "condition": "{\"repo\": \"frappe/erpnext\"}", 
+ "creation": "2017-10-13 11:16:49.664925", 
+ "docstatus": 0, 
+ "doctype": "Data Migration Mapping", 
+ "fields": [
+  {
+   "is_child_table": 0, 
+   "local_fieldname": "project_name", 
+   "remote_fieldname": "title"
+  }, 
+  {
+   "is_child_table": 0, 
+   "local_fieldname": "notes", 
+   "remote_fieldname": "description"
+  }, 
+  {
+   "is_child_table": 0, 
+   "local_fieldname": "status", 
+   "remote_fieldname": "state"
+  }
+ ], 
+ "idx": 0, 
+ "local_doctype": "Project", 
+ "local_primary_key": "project_name", 
+ "mapping_name": "Milestone to Project", 
+ "mapping_type": "Pull", 
+ "migration_id_field": "github_sync_id", 
+ "modified": "2017-10-20 11:48:54.552305", 
+ "modified_by": "Administrator", 
+ "name": "Milestone to Project", 
+ "owner": "Administrator", 
+ "page_length": 10, 
+ "remote_objectname": "Milestone", 
+ "remote_primary_key": "id"
+}
\ No newline at end of file
diff --git a/erpnext/erpnext_integrations/data_migration_plan/github_sync/github_sync.json b/erpnext/erpnext_integrations/data_migration_plan/github_sync/github_sync.json
new file mode 100644
index 0000000..20eb387
--- /dev/null
+++ b/erpnext/erpnext_integrations/data_migration_plan/github_sync/github_sync.json
@@ -0,0 +1,22 @@
+{
+ "creation": "2017-10-13 11:16:53.600026", 
+ "docstatus": 0, 
+ "doctype": "Data Migration Plan", 
+ "idx": 0, 
+ "mappings": [
+  {
+   "enabled": 1, 
+   "mapping": "Milestone to Project"
+  }, 
+  {
+   "enabled": 1, 
+   "mapping": "Issue to Task"
+  }
+ ], 
+ "modified": "2017-10-20 11:48:54.496123", 
+ "modified_by": "Administrator", 
+ "module": "ERPNext Integrations", 
+ "name": "GitHub Sync", 
+ "owner": "Administrator", 
+ "plan_name": "GitHub Sync"
+}
\ No newline at end of file
diff --git a/erpnext/hr/doctype/upload_attendance/upload_attendance.json b/erpnext/hr/doctype/upload_attendance/upload_attendance.json
index 5a3f72a..16b7a83 100644
--- a/erpnext/hr/doctype/upload_attendance/upload_attendance.json
+++ b/erpnext/hr/doctype/upload_attendance/upload_attendance.json
@@ -1,28 +1,39 @@
 {
  "allow_copy": 1, 
+ "allow_guest_to_view": 0, 
  "allow_import": 0, 
  "allow_rename": 0, 
+ "beta": 0, 
  "creation": "2013-01-25 11:34:53", 
  "custom": 0, 
  "docstatus": 0, 
  "doctype": "DocType", 
+ "editable_grid": 0, 
  "fields": [
   {
+   "allow_bulk_edit": 0, 
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
-   "description": "Download the Template, fill appropriate data and attach the modified file.\nAll dates and employee combination in the selected period will come in the template, with existing attendance records", 
+   "columns": 0, 
+   "description": "", 
    "fieldname": "download_template", 
    "fieldtype": "Section Break", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
+   "in_global_search": 0, 
    "in_list_view": 0, 
+   "in_standard_filter": 0, 
    "label": "Download Template", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
    "read_only": 0, 
+   "remember_last_selected_value": 0, 
    "report_hide": 0, 
    "reqd": 0, 
    "search_index": 0, 
@@ -30,22 +41,30 @@
    "unique": 0
   }, 
   {
+   "allow_bulk_edit": 0, 
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "att_fr_date", 
    "fieldtype": "Date", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
-   "in_list_view": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 1, 
+   "in_standard_filter": 0, 
    "label": "Attendance From Date", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "attenadnce_date", 
    "oldfieldtype": "Date", 
    "permlevel": 0, 
    "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
    "read_only": 0, 
+   "remember_last_selected_value": 0, 
    "report_hide": 0, 
    "reqd": 1, 
    "search_index": 0, 
@@ -53,20 +72,28 @@
    "unique": 0
   }, 
   {
+   "allow_bulk_edit": 0, 
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "att_to_date", 
    "fieldtype": "Date", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
-   "in_list_view": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 1, 
+   "in_standard_filter": 0, 
    "label": "Attendance To Date", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
    "read_only": 0, 
+   "remember_last_selected_value": 0, 
    "report_hide": 0, 
    "reqd": 1, 
    "search_index": 0, 
@@ -74,21 +101,29 @@
    "unique": 0
   }, 
   {
+   "allow_bulk_edit": 0, 
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "get_template", 
    "fieldtype": "Button", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
+   "in_global_search": 0, 
    "in_list_view": 0, 
+   "in_standard_filter": 0, 
    "label": "Get Template", 
+   "length": 0, 
    "no_copy": 0, 
    "oldfieldtype": "Button", 
    "permlevel": 0, 
    "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
    "read_only": 0, 
+   "remember_last_selected_value": 0, 
    "report_hide": 0, 
    "reqd": 0, 
    "search_index": 0, 
@@ -96,20 +131,28 @@
    "unique": 0
   }, 
   {
+   "allow_bulk_edit": 0, 
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "upload_attendance_data", 
    "fieldtype": "Section Break", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
+   "in_global_search": 0, 
    "in_list_view": 0, 
+   "in_standard_filter": 0, 
    "label": "Import Attendance", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
    "read_only": 0, 
+   "remember_last_selected_value": 0, 
    "report_hide": 0, 
    "reqd": 0, 
    "search_index": 0, 
@@ -117,20 +160,28 @@
    "unique": 0
   }, 
   {
+   "allow_bulk_edit": 0, 
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "upload_html", 
    "fieldtype": "HTML", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
+   "in_global_search": 0, 
    "in_list_view": 0, 
+   "in_standard_filter": 0, 
    "label": "Upload HTML", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
    "read_only": 0, 
+   "remember_last_selected_value": 0, 
    "report_hide": 0, 
    "reqd": 0, 
    "search_index": 0, 
@@ -138,20 +189,28 @@
    "unique": 0
   }, 
   {
+   "allow_bulk_edit": 0, 
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "import_log", 
    "fieldtype": "HTML", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
+   "in_global_search": 0, 
    "in_list_view": 0, 
+   "in_standard_filter": 0, 
    "label": "Import Log", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
    "read_only": 0, 
+   "remember_last_selected_value": 0, 
    "report_hide": 0, 
    "reqd": 0, 
    "search_index": 0, 
@@ -159,17 +218,18 @@
    "unique": 0
   }
  ], 
+ "has_web_view": 0, 
  "hide_heading": 0, 
  "hide_toolbar": 1, 
  "icon": "fa fa-upload-alt", 
  "idx": 1, 
+ "image_view": 0, 
  "in_create": 0, 
- "in_dialog": 0, 
  "is_submittable": 0, 
  "issingle": 1, 
  "istable": 0, 
  "max_attachments": 1, 
- "modified": "2015-06-05 11:37:04.348120", 
+ "modified": "2017-11-14 12:51:34.980103", 
  "modified_by": "Administrator", 
  "module": "HR", 
  "name": "Upload Attendance", 
@@ -216,6 +276,10 @@
    "write": 1
   }
  ], 
+ "quick_entry": 0, 
  "read_only": 0, 
- "read_only_onload": 0
+ "read_only_onload": 0, 
+ "show_name_in_global_search": 0, 
+ "track_changes": 0, 
+ "track_seen": 0
 }
\ No newline at end of file
diff --git a/erpnext/hub_node/__init__.py b/erpnext/hub_node/__init__.py
index 8efbed8..76a7f6f 100644
--- a/erpnext/hub_node/__init__.py
+++ b/erpnext/hub_node/__init__.py
@@ -15,13 +15,16 @@
 	return hub_settings
 
 @frappe.whitelist()
-def get_items(start=0, limit=20, category=None, order_by=None, text=None):
+def get_items(start=0, limit=20, category=None, order_by=None, company=None, text=None):
 	connection = get_connection()
 	filters = {
 		'hub_category': category,
 	}
 	if text:
 		filters.update({'item_name': ('like', '%' + text + '%')})
+	if company:
+		filters.update({'company_name': company})
+
 	response = connection.get_list('Hub Item',
 		limit_start=start, limit_page_length=limit,
 		filters=filters)
diff --git a/erpnext/hub_node/page/hub/hub.js b/erpnext/hub_node/page/hub/hub.js
index 8a715b8..15bd97d 100644
--- a/erpnext/hub_node/page/hub/hub.js
+++ b/erpnext/hub_node/page/hub/hub.js
@@ -215,7 +215,7 @@
 			.on('click', '.company-link a', function(e) {
 				e.preventDefault();
 				const company_name = $(this).attr('data-company-name');
-				me.get_company_details(company_name);
+				frappe.set_route('hub', 'Company', company_name);
 			})
 			.on('click', '.breadcrumb li', function(e) {
 				e.preventDefault();
@@ -476,26 +476,34 @@
 	}
 
 	get_company_details(company_id) {
-		// get from cache if exists
-		let company_details = this.company_cache[company_id];
-		if(this.company_cache[company_id]) {
-			this.go_to_company_page(company_details);
-			return;
-		}
-		frappe.call({
-			method: 'erpnext.hub_node.get_company_details',
-			args: {hub_sync_id: company_id}
-		}).then((r) => {
-			if (r.message) {
-				const company_details = r.message.company_details;
-				this.company_cache[company_id] = company_details;
-				this.go_to_company_page(company_details)
+		this.company_cache = this.company_cache || {};
+
+		return new Promise(resolve => {
+			// get from cache if exists
+			let company_details = this.company_cache[company_id];
+			if(company_details) {
+				resolve(company_details);
+				return;
 			}
-		});
+			frappe.call({
+				method: 'erpnext.hub_node.get_company_details',
+				args: {hub_sync_id: company_id}
+			}).then((r) => {
+				if (r.message) {
+					const company_details = r.message;
+					this.company_cache[company_id] = company_details;
+					resolve(company_details)
+				}
+			});
+		})
 	}
 
-	go_to_company_page(company_details) {
-		frappe.set_route('hub', 'Company', company_details.company_name);
+	go_to_company_page(company_id) {
+		this.get_company_details(company_id)
+			.then(this.show_company_page.bind(this));
+	}
+
+	show_company_page(company_details) {
 		this.$hub_main_section.empty();
 
 		let $company_page =
@@ -574,10 +582,10 @@
 							<h2>${ company_details.company_name }</h2>
 						</div>
 						<div class="company">
-							<span class="">${ company_details.seller_city }</span>
+							<span class="">${ company_details.country }</span>
 						</div>
 						<div class="description">
-							<span class="small">${ company_details.seller_description }</span>
+							<span class="small">${ company_details.site_name }</span>
 						</div>
 					</div>
 
@@ -836,7 +844,7 @@
 					</div>
 				</a>
 				<div class="company-link">
-					<a data-company-name="${ item.company_id }" class="">${ item.company_name }</a>
+					<a data-company-name="${ item.company_name }" class="">${ item.company_name }</a>
 				</div>
 				<div>${ item.formatted_price ? item.formatted_price : ''}</div>
 			</div>
diff --git a/erpnext/manufacturing/doctype/bom/bom.py b/erpnext/manufacturing/doctype/bom/bom.py
index b140bf5..d0cf609 100644
--- a/erpnext/manufacturing/doctype/bom/bom.py
+++ b/erpnext/manufacturing/doctype/bom/bom.py
@@ -587,7 +587,11 @@
 		frappe.throw(_("BOM {0} does not belong to Item {1}").format(bom_no, item))
 
 @frappe.whitelist()
-def get_children():
+def get_children(doctype, parent=None, is_tree=False):
+	if not parent:
+		frappe.msgprint(_('Please select a BOM'))
+		return
+
 	if frappe.form_dict.parent:
 		return frappe.db.sql("""select
 			bom_item.item_code,
diff --git a/erpnext/manufacturing/doctype/bom/bom_tree.js b/erpnext/manufacturing/doctype/bom/bom_tree.js
index 09fe037..854f633 100644
--- a/erpnext/manufacturing/doctype/bom/bom_tree.js
+++ b/erpnext/manufacturing/doctype/bom/bom_tree.js
@@ -11,7 +11,7 @@
 	title: "BOM",
 	breadcrumb: "Manufacturing",
 	disable_add_node: true,
-	root_label: "bom", //fieldname from filters
+	root_label: "All Bill of Materials", //fieldname from filters
 	get_label: function(node) {
 		if(node.data.qty) {
 			return node.data.qty + " x " + node.data.item_code;
diff --git a/erpnext/manufacturing/doctype/production_order/production_order.js b/erpnext/manufacturing/doctype/production_order/production_order.js
index c3e6f20..226ebfc 100644
--- a/erpnext/manufacturing/doctype/production_order/production_order.js
+++ b/erpnext/manufacturing/doctype/production_order/production_order.js
@@ -17,6 +17,14 @@
 			}
 		});
 		
+		frm.set_query("source_warehouse", function() {
+			return {
+				filters: {
+					'company': frm.doc.company,
+				}
+			}
+		});
+		
 		frm.set_query("source_warehouse", "required_items", function() {
 			return {
 				filters: {
diff --git a/erpnext/manufacturing/doctype/production_order/production_order.json b/erpnext/manufacturing/doctype/production_order/production_order.json
index e56e5a1..a5428aa 100644
--- a/erpnext/manufacturing/doctype/production_order/production_order.json
+++ b/erpnext/manufacturing/doctype/production_order/production_order.json
@@ -1320,6 +1320,36 @@
    "bold": 0, 
    "collapsible": 0, 
    "columns": 0, 
+   "fieldname": "sales_order_item", 
+   "fieldtype": "Data", 
+   "hidden": 1, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Sales Order Item", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 1, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "amended_from", 
    "fieldtype": "Link", 
    "hidden": 0, 
@@ -1358,7 +1388,7 @@
  "issingle": 0, 
  "istable": 0, 
  "max_attachments": 0, 
- "modified": "2017-07-10 14:29:00.457874", 
+ "modified": "2017-11-03 05:31:56.636724", 
  "modified_by": "Administrator", 
  "module": "Manufacturing", 
  "name": "Production Order", 
@@ -1412,5 +1442,5 @@
  "sort_order": "ASC", 
  "title_field": "production_item", 
  "track_changes": 1, 
- "track_seen": 0
+ "track_seen": 1
 }
\ No newline at end of file
diff --git a/erpnext/manufacturing/doctype/production_order/production_order.py b/erpnext/manufacturing/doctype/production_order/production_order.py
index 89ecbe7..fce9d65 100644
--- a/erpnext/manufacturing/doctype/production_order/production_order.py
+++ b/erpnext/manufacturing/doctype/production_order/production_order.py
@@ -35,6 +35,7 @@
 			validate_bom_no(self.production_item, self.bom_no)
 
 		self.validate_sales_order()
+		self.set_default_warehouse()
 		self.validate_warehouse_belongs_to_company()
 		self.calculate_operating_cost()
 		self.validate_qty()
@@ -69,6 +70,12 @@
 			else:
 				frappe.throw(_("Sales Order {0} is not valid").format(self.sales_order))
 
+	def set_default_warehouse(self):
+		if not self.wip_warehouse:
+			self.wip_warehouse = frappe.db.get_single_value("Manufacturing Settings", "default_wip_warehouse")
+		if not self.fg_warehouse:
+			self.fg_warehouse = frappe.db.get_single_value("Manufacturing Settings", "default_fg_warehouse")
+	
 	def validate_warehouse_belongs_to_company(self):
 		warehouses = [self.fg_warehouse, self.wip_warehouse]
 		for d in self.get("required_items"):
diff --git a/erpnext/manufacturing/page/production_analytics/production_analytics.js b/erpnext/manufacturing/page/production_analytics/production_analytics.js
index 39168b7..efbd0a5 100644
--- a/erpnext/manufacturing/page/production_analytics/production_analytics.js
+++ b/erpnext/manufacturing/page/production_analytics/production_analytics.js
@@ -64,7 +64,7 @@
 
 		var chart_data = this.get_chart_data ? this.get_chart_data() : null;
 
-		this.chart = new frappe.chart.FrappeChart({
+		this.chart = new Chart({
 			parent: ".chart",
 			data: chart_data,
 			type: 'line'
diff --git a/erpnext/modules.txt b/erpnext/modules.txt
index 5e9f6c7..79ded14 100644
--- a/erpnext/modules.txt
+++ b/erpnext/modules.txt
@@ -17,3 +17,4 @@
 Regional
 Healthcare
 Restaurant
+ERPNext Integrations
\ No newline at end of file
diff --git a/erpnext/patches.txt b/erpnext/patches.txt
index 1ae99a3..6cb87b6 100644
--- a/erpnext/patches.txt
+++ b/erpnext/patches.txt
@@ -448,6 +448,7 @@
 erpnext.patches.v8_9.delete_gst_doctypes_for_outside_india_accounts
 erpnext.patches.v8_9.set_default_fields_in_variant_settings
 erpnext.patches.v8_9.update_billing_gstin_for_indian_account
+erpnext.patches.v9_0.add_user_to_child_table_in_pos_profile
 erpnext.patches.v9_0.set_schedule_date_for_material_request_and_purchase_order
 erpnext.patches.v9_0.student_admission_childtable_migrate
 erpnext.patches.v9_0.fix_subscription_next_date #2017-10-23
@@ -455,6 +456,7 @@
 erpnext.patches.v9_0.set_variant_item_description
 erpnext.patches.v9_0.set_uoms_in_variant_field
 erpnext.patches.v9_0.copy_old_fees_field_data
+execute:frappe.delete_doc_if_exists("DocType", "Program Fee")
 erpnext.patches.v9_0.set_pos_profile_name
 erpnext.patches.v9_0.remove_non_existing_warehouse_from_stock_settings
 execute:frappe.delete_doc_if_exists("DocType", "Program Fee")
diff --git a/erpnext/patches/v5_4/cleanup_journal_entry.py b/erpnext/patches/v5_4/cleanup_journal_entry.py
index a0c3323..9100b8f 100644
--- a/erpnext/patches/v5_4/cleanup_journal_entry.py
+++ b/erpnext/patches/v5_4/cleanup_journal_entry.py
@@ -1,5 +1,5 @@
 import frappe
-from MySQLdb import OperationalError
+from pymysql import InternalError
 
 def execute():
 	frappe.reload_doctype("Journal Entry Account")
@@ -15,6 +15,6 @@
 			frappe.db.sql("""update `tabJournal Entry Account`
 				set reference_type=%s, reference_name={0} where ifnull({0}, '') != ''
 			""".format(fieldname), doctype)
-		except OperationalError:
+		except InternalError:
 			# column not found
 			pass
diff --git a/erpnext/patches/v5_7/item_template_attributes.py b/erpnext/patches/v5_7/item_template_attributes.py
index 22b15d3..6aa81f7 100644
--- a/erpnext/patches/v5_7/item_template_attributes.py
+++ b/erpnext/patches/v5_7/item_template_attributes.py
@@ -3,7 +3,7 @@
 
 from __future__ import print_function, unicode_literals
 import frappe
-import MySQLdb
+from frappe.exceptions import SQLError
 
 def execute():
 	"""
@@ -31,7 +31,7 @@
 		try:
 			migrate_item_variants()
 
-		except MySQLdb.ProgrammingError:
+		except SQLError:
 			print("`tabItem Variant` not found")
 
 def rename_and_reload_doctypes():
diff --git a/erpnext/patches/v9_0/add_user_to_child_table_in_pos_profile.py b/erpnext/patches/v9_0/add_user_to_child_table_in_pos_profile.py
new file mode 100644
index 0000000..e7833c0
--- /dev/null
+++ b/erpnext/patches/v9_0/add_user_to_child_table_in_pos_profile.py
@@ -0,0 +1,22 @@
+# Copyright (c) 2017, Frappe and Contributors
+# License: GNU General Public License v3. See license.txt
+
+from __future__ import unicode_literals
+import frappe
+
+def execute():
+	doctype = 'POS Profile'
+	frappe.reload_doc('accounts', 'doctype', doctype)
+	frappe.reload_doc('accounts', 'doctype', 'POS Profile User')
+
+	for doc in frappe.get_all(doctype):
+		_doc = frappe.get_doc(doctype, doc.name)
+		user = frappe.db.get_value(doctype, doc.name, 'user')
+
+		if not user: continue
+
+		_doc.append('applicable_for_users', {
+			'user': user
+		})
+		_doc.pos_profile_name = user + ' - ' + _doc.company
+		_doc.save()
diff --git a/erpnext/patches/v9_0/revert_manufacturing_user_role.py b/erpnext/patches/v9_0/revert_manufacturing_user_role.py
new file mode 100644
index 0000000..5bfa8c3
--- /dev/null
+++ b/erpnext/patches/v9_0/revert_manufacturing_user_role.py
@@ -0,0 +1,21 @@
+import frappe
+
+def execute():
+	if 'Manufacturing' in frappe.get_active_domains(): return
+
+	role = 'Manufacturing User'
+	frappe.db.set_value('Role', role, 'restrict_to_domain', '')
+	frappe.db.set_value('Role', role, 'disabled', 0)
+
+	users = frappe.get_all('Has Role', filters = {
+		'parenttype': 'User',
+		'role': ('in', ['System Manager', 'Manufacturing Manager'])
+	}, fields=['parent'], as_list=1)
+
+	for user in users:
+		_user = frappe.get_doc('User', user[0])
+		_user.append('roles', {
+			'role': role
+		})
+		_user.flags.ignore_validate = True
+		_user.save()
diff --git a/erpnext/projects/doctype/task/task.js b/erpnext/projects/doctype/task/task.js
index df38cfe..b8f324a 100644
--- a/erpnext/projects/doctype/task/task.js
+++ b/erpnext/projects/doctype/task/task.js
@@ -19,38 +19,47 @@
 	},
 
 	refresh: function(frm) {
-		var doc = frm.doc;
-		if(doc.__islocal) {
-			if(!frm.doc.exp_end_date) {
-				frm.set_value("exp_end_date", frappe.datetime.add_days(new Date(), 7));
+		frm.fields_dict['parent_task'].get_query = function() {
+			return {
+				filters: {
+					"is_group": 1,
+				}
 			}
 		}
-
-		if(!doc.__islocal) {
-			if(frappe.model.can_read("Timesheet")) {
-				frm.add_custom_button(__("Timesheet"), function() {
-					frappe.route_options = {"project": doc.project, "task": doc.name}
-					frappe.set_route("List", "Timesheet");
-				}, __("View"), true);
-			}
-			if(frappe.model.can_read("Expense Claim")) {
-				frm.add_custom_button(__("Expense Claims"), function() {
-					frappe.route_options = {"project": doc.project, "task": doc.name}
-					frappe.set_route("List", "Expense Claim");
-				}, __("View"), true);
+		if(!frm.is_group){
+			var doc = frm.doc;
+			if(doc.__islocal) {
+				if(!frm.doc.exp_end_date) {
+					frm.set_value("exp_end_date", frappe.datetime.add_days(new Date(), 7));
+				}
 			}
 
-			if(frm.perm[0].write) {
-				if(frm.doc.status!=="Closed" && frm.doc.status!=="Cancelled") {
-					frm.add_custom_button(__("Close"), function() {
-						frm.set_value("status", "Closed");
-						frm.save();
-					});
-				} else {
-					frm.add_custom_button(__("Reopen"), function() {
-						frm.set_value("status", "Open");
-						frm.save();
-					});
+			if(!doc.__islocal) {
+				if(frappe.model.can_read("Timesheet")) {
+					frm.add_custom_button(__("Timesheet"), function() {
+						frappe.route_options = {"project": doc.project, "task": doc.name}
+						frappe.set_route("List", "Timesheet");
+					}, __("View"), true);
+				}
+				if(frappe.model.can_read("Expense Claim")) {
+					frm.add_custom_button(__("Expense Claims"), function() {
+						frappe.route_options = {"project": doc.project, "task": doc.name}
+						frappe.set_route("List", "Expense Claim");
+					}, __("View"), true);
+				}
+
+				if(frm.perm[0].write) {
+					if(frm.doc.status!=="Closed" && frm.doc.status!=="Cancelled") {
+						frm.add_custom_button(__("Close"), function() {
+							frm.set_value("status", "Closed");
+							frm.save();
+						});
+					} else {
+						frm.add_custom_button(__("Reopen"), function() {
+							frm.set_value("status", "Open");
+							frm.save();
+						});
+					}
 				}
 			}
 		}
@@ -71,6 +80,21 @@
 		}
 	},
 
+	is_group: function(frm) {
+		frappe.call({
+			method:"erpnext.projects.doctype.task.task.check_if_child_exists",
+			args: {
+				name: frm.doc.name
+			},
+			callback: function(r){
+				if(r.message){
+					frappe.msgprint(__('Cannot convert it to non-group. Child Tasks exist.'));
+					frm.reload_doc();
+				}
+			}
+		})
+	},
+
 	validate: function(frm) {
 		frm.doc.project && frappe.model.remove_from_locals("Project",
 			frm.doc.project);
diff --git a/erpnext/projects/doctype/task/task.json b/erpnext/projects/doctype/task/task.json
index e4ab5a7..8e72d03 100644
--- a/erpnext/projects/doctype/task/task.json
+++ b/erpnext/projects/doctype/task/task.json
@@ -2,7 +2,7 @@
  "allow_copy": 0, 
  "allow_guest_to_view": 0, 
  "allow_import": 1, 
- "allow_rename": 1, 
+ "allow_rename": 0, 
  "autoname": "TASK.#####", 
  "beta": 0, 
  "creation": "2013-01-29 19:25:50", 
@@ -30,9 +30,8 @@
    "label": "Subject", 
    "length": 0, 
    "no_copy": 0, 
-   "oldfieldname": "subject", 
-   "oldfieldtype": "Data", 
    "permlevel": 0, 
+   "precision": "", 
    "print_hide": 0, 
    "print_hide_if_no_value": 0, 
    "read_only": 0, 
@@ -78,6 +77,37 @@
   {
    "allow_bulk_edit": 0, 
    "allow_on_submit": 0, 
+   "bold": 1, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "default": "0", 
+   "fieldname": "is_group", 
+   "fieldtype": "Check", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 1, 
+   "in_standard_filter": 0, 
+   "label": "Is Group", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
    "columns": 0, 
@@ -173,9 +203,42 @@
   {
    "allow_bulk_edit": 0, 
    "allow_on_submit": 0, 
-   "bold": 0, 
+   "bold": 1, 
    "collapsible": 0, 
    "columns": 0, 
+   "fieldname": "parent_task", 
+   "fieldtype": "Link", 
+   "hidden": 0, 
+   "ignore_user_permissions": 1, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Parent Task", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "Task", 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 1, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "collapsible_depends_on": "", 
+   "columns": 0, 
+   "depends_on": "", 
    "fieldname": "section_break_10", 
    "fieldtype": "Section Break", 
    "hidden": 0, 
@@ -205,6 +268,7 @@
    "bold": 0, 
    "collapsible": 0, 
    "columns": 0, 
+   "depends_on": "", 
    "fieldname": "exp_start_date", 
    "fieldtype": "Date", 
    "hidden": 0, 
@@ -237,6 +301,7 @@
    "collapsible": 0, 
    "columns": 0, 
    "default": "0", 
+   "depends_on": "", 
    "description": "", 
    "fieldname": "expected_time", 
    "fieldtype": "Float", 
@@ -269,6 +334,7 @@
    "bold": 0, 
    "collapsible": 0, 
    "columns": 0, 
+   "depends_on": "", 
    "fieldname": "task_weight", 
    "fieldtype": "Float", 
    "hidden": 0, 
@@ -328,6 +394,7 @@
    "bold": 1, 
    "collapsible": 0, 
    "columns": 0, 
+   "depends_on": "", 
    "fieldname": "exp_end_date", 
    "fieldtype": "Date", 
    "hidden": 0, 
@@ -359,6 +426,7 @@
    "bold": 0, 
    "collapsible": 0, 
    "columns": 0, 
+   "depends_on": "", 
    "fieldname": "progress", 
    "fieldtype": "Percent", 
    "hidden": 0, 
@@ -389,6 +457,7 @@
    "bold": 0, 
    "collapsible": 0, 
    "columns": 0, 
+   "depends_on": "", 
    "fieldname": "is_milestone", 
    "fieldtype": "Check", 
    "hidden": 0, 
@@ -418,7 +487,9 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "collapsible_depends_on": "", 
    "columns": 0, 
+   "depends_on": "", 
    "fieldname": "section_break0", 
    "fieldtype": "Section Break", 
    "hidden": 0, 
@@ -449,6 +520,7 @@
    "bold": 0, 
    "collapsible": 0, 
    "columns": 0, 
+   "depends_on": "", 
    "fieldname": "description", 
    "fieldtype": "Text Editor", 
    "hidden": 0, 
@@ -481,7 +553,9 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "collapsible_depends_on": "", 
    "columns": 0, 
+   "depends_on": "", 
    "fieldname": "section_break", 
    "fieldtype": "Section Break", 
    "hidden": 0, 
@@ -512,6 +586,7 @@
    "bold": 0, 
    "collapsible": 0, 
    "columns": 0, 
+   "depends_on": "", 
    "fieldname": "depends_on", 
    "fieldtype": "Table", 
    "hidden": 0, 
@@ -543,6 +618,7 @@
    "bold": 0, 
    "collapsible": 0, 
    "columns": 0, 
+   "depends_on": "", 
    "fieldname": "depends_on_tasks", 
    "fieldtype": "Data", 
    "hidden": 1, 
@@ -572,7 +648,9 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "collapsible_depends_on": "", 
    "columns": 0, 
+   "depends_on": "", 
    "description": "", 
    "fieldname": "actual", 
    "fieldtype": "Section Break", 
@@ -606,6 +684,7 @@
    "bold": 0, 
    "collapsible": 0, 
    "columns": 0, 
+   "depends_on": "", 
    "fieldname": "act_start_date", 
    "fieldtype": "Date", 
    "hidden": 0, 
@@ -638,6 +717,7 @@
    "collapsible": 0, 
    "columns": 0, 
    "default": "", 
+   "depends_on": "", 
    "description": "", 
    "fieldname": "actual_time", 
    "fieldtype": "Float", 
@@ -699,6 +779,7 @@
    "bold": 0, 
    "collapsible": 0, 
    "columns": 0, 
+   "depends_on": "", 
    "fieldname": "act_end_date", 
    "fieldtype": "Date", 
    "hidden": 0, 
@@ -730,6 +811,7 @@
    "bold": 0, 
    "collapsible": 0, 
    "columns": 0, 
+   "depends_on": "", 
    "fieldname": "section_break_17", 
    "fieldtype": "Section Break", 
    "hidden": 0, 
@@ -759,6 +841,7 @@
    "bold": 0, 
    "collapsible": 0, 
    "columns": 0, 
+   "depends_on": "", 
    "fieldname": "total_costing_amount", 
    "fieldtype": "Currency", 
    "hidden": 0, 
@@ -791,6 +874,7 @@
    "bold": 0, 
    "collapsible": 0, 
    "columns": 0, 
+   "depends_on": "", 
    "fieldname": "total_expense_claim", 
    "fieldtype": "Currency", 
    "hidden": 0, 
@@ -851,6 +935,7 @@
    "bold": 0, 
    "collapsible": 0, 
    "columns": 0, 
+   "depends_on": "", 
    "fieldname": "total_billing_amount", 
    "fieldtype": "Currency", 
    "hidden": 0, 
@@ -1025,6 +1110,96 @@
    "search_index": 0, 
    "set_only_once": 0, 
    "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "lft", 
+   "fieldtype": "Int", 
+   "hidden": 1, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "lft", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 1, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "rgt", 
+   "fieldtype": "Int", 
+   "hidden": 1, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "rgt", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 1, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "old_parent", 
+   "fieldtype": "Data", 
+   "hidden": 1, 
+   "ignore_user_permissions": 1, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Old Parent", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 1, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
   }
  ], 
  "has_web_view": 0, 
@@ -1039,7 +1214,7 @@
  "istable": 0, 
  "max_attachments": 5, 
  "menu_index": 0, 
- "modified": "2017-05-23 11:28:28.161600", 
+ "modified": "2017-11-10 18:37:19.660293", 
  "modified_by": "Administrator", 
  "module": "Projects", 
  "name": "Task", 
diff --git a/erpnext/projects/doctype/task/task.py b/erpnext/projects/doctype/task/task.py
index 52ae132..fa56a95 100644
--- a/erpnext/projects/doctype/task/task.py
+++ b/erpnext/projects/doctype/task/task.py
@@ -5,13 +5,14 @@
 import frappe, json
 
 from frappe.utils import getdate, date_diff, add_days, cstr
-from frappe import _
-
-from frappe.model.document import Document
+from frappe import _, throw
+from frappe.utils.nestedset import NestedSet
 
 class CircularReferenceError(frappe.ValidationError): pass
 
-class Task(Document):
+class Task(NestedSet):
+	nsm_parent_field = 'parent_task'
+
 	def get_feed(self):
 		return '{0}: {1}'.format(_(self.status), self.subject)
 
@@ -59,7 +60,11 @@
 				depends_on_tasks += d.task + ","
 		self.depends_on_tasks = depends_on_tasks
 
+	def update_nsm_model(self):
+		frappe.utils.nestedset.update_nsm(self)
+
 	def on_update(self):
+		self.update_nsm_model()
 		self.check_recursion()
 		self.reschedule_dependent_tasks()
 		self.update_project()
@@ -105,16 +110,20 @@
 						frappe.throw(_("Circular Reference Error"), CircularReferenceError)
 					if b[0]:
 						task_list.append(b[0])
+
 				if count == 15:
 					break
 
 	def reschedule_dependent_tasks(self):
 		end_date = self.exp_end_date or self.act_end_date
 		if end_date:
-			for task_name in frappe.db.sql("""select name from `tabTask` as parent where parent.project = %(project)s and parent.name in \
-				(select parent from `tabTask Depends On` as child where child.task = %(task)s and child.project = %(project)s)""",
-				{'project': self.project, 'task':self.name }, as_dict=1):
-
+			for task_name in frappe.db.sql("""
+				select name from `tabTask` as parent
+				where parent.project = %(project)s
+					and parent.name in (
+						select parent from `tabTask Depends On` as child
+						where child.task = %(task)s and child.project = %(project)s)
+			""", {'project': self.project, 'task':self.name }, as_dict=1):
 				task = frappe.get_doc("Task", task_name.name)
 				if task.exp_start_date and task.exp_end_date and task.exp_start_date < getdate(end_date) and task.status == "Open":
 					task_duration = date_diff(task.exp_end_date, task.exp_start_date)
@@ -128,6 +137,17 @@
 		if project_user:
 			return True
 
+	def on_trash(self):
+		if check_if_child_exists(self.name):
+			throw(_("Child Task exists for this Task. You can not delete this Task."))
+
+		self.update_nsm_model()
+
+@frappe.whitelist()
+def check_if_child_exists(name):
+	return frappe.db.sql("""select name from `tabTask`
+		where parent_task = %s""", name)
+
 @frappe.whitelist()
 def get_events(start, end, filters=None):
 	"""Returns events for Gantt / Calendar view rendering.
@@ -177,4 +197,54 @@
 		and exp_end_date < CURDATE()
 		and `status` not in ('Closed', 'Cancelled')""")
 
+@frappe.whitelist()
+def get_children(doctype, parent, task=None, project=None, is_root=False):
+	conditions = ''
 
+	if task:
+		# via filters
+		conditions += ' and parent_task = "{0}"'.format(frappe.db.escape(task))
+	elif parent and not is_root:
+		# via expand child
+		conditions += ' and parent_task = "{0}"'.format(frappe.db.escape(parent))
+	else:
+		conditions += ' and ifnull(parent_task, "")=""'
+
+	if project:
+		conditions += ' and project = "{0}"'.format(frappe.db.escape(project))
+
+	tasks = frappe.db.sql("""select name as value,
+		subject as title,
+		is_group as expandable
+		from `tabTask`
+		where docstatus < 2
+		{conditions}
+		order by name""".format(conditions=conditions), as_dict=1)
+
+	# return tasks
+	return tasks
+
+@frappe.whitelist()
+def add_node():
+    from frappe.desk.treeview import make_tree_args
+    args = frappe.form_dict
+    args.update({
+    	"name_field": "subject"
+    })
+    args = make_tree_args(**args)
+
+    if args.parent_task == 'task':
+        args.parent_task = None
+
+    frappe.get_doc(args).insert()
+
+@frappe.whitelist()
+def add_multiple_tasks(data, parent):
+    data = json.loads(data)['tasks']
+    tasks = data.split('\n')
+    new_doc = {'doctype': 'Task', 'parent_task': parent}
+
+    for d in tasks:
+        new_doc['subject'] = d
+        new_task = frappe.get_doc(new_doc)
+        new_task.insert()
diff --git a/erpnext/projects/doctype/task/task_list.js b/erpnext/projects/doctype/task/task_list.js
index ee224d9..887bd42 100644
--- a/erpnext/projects/doctype/task/task_list.js
+++ b/erpnext/projects/doctype/task/task_list.js
@@ -25,7 +25,9 @@
 		return [__(doc.status), colors[doc.status], "status,=," + doc.status];
 	},
 	gantt_custom_popup_html: function(ganttobj, task) {
-		var html = `<h5>${ganttobj.name}</h5>`;
+		var html = `<h5><a style="text-decoration:underline"\
+			href="#Form/Task/${ganttobj.id}""> ${ganttobj.name} </a></h5>`;
+
 		if(task.project) html += `<p>Project: ${task.project}</p>`;
 		html += `<p>Progress: ${ganttobj.progress}</p>`;
 
diff --git a/erpnext/projects/doctype/task/task_tree.js b/erpnext/projects/doctype/task/task_tree.js
new file mode 100644
index 0000000..935a1e0
--- /dev/null
+++ b/erpnext/projects/doctype/task/task_tree.js
@@ -0,0 +1,60 @@
+frappe.provide("frappe.treeview_settings");
+
+frappe.treeview_settings['Task'] = {
+	get_tree_nodes: "erpnext.projects.doctype.task.task.get_children",
+	add_tree_node: "erpnext.projects.doctype.task.task.add_node",
+	filters: [
+		{
+			fieldname: "project",
+			fieldtype:"Link",
+			options: "Project",
+			label: __("Project"),
+		},
+		{
+			fieldname: "task",
+			fieldtype:"Link",
+			options: "Task",
+			label: __("Task"),
+			get_query: function() {
+				return {
+					filters: [["Task", 'is_group', '=', 1]]
+				};
+			}
+		}
+	],
+	breadcrumb: "Projects",
+	get_tree_root: false,
+	root_label: "All Tasks",
+	ignore_fields: ["parent_task"],
+	onload: function(me) {
+		me.make_tree();
+	},
+	toolbar: [
+		{
+			label:__("Add Multiple"),
+			condition: function(node) {
+				return node.expandable;
+			},
+			click: function(node) {
+				var d = new frappe.ui.Dialog({
+					'fields': [
+						{'fieldname': 'tasks', 'label': 'Tasks', 'fieldtype': 'Text'},
+					],
+					primary_action: function() {
+						d.hide();
+						return frappe.call({
+							method: "erpnext.projects.doctype.task.task.add_multiple_tasks",
+							args: {
+								data: d.get_values(),
+								parent: node.data.value
+							},
+							callback: function() { }
+						});
+					}
+				});
+				d.show();
+			}
+		}
+	],
+	extend_toolbar: true
+};
\ No newline at end of file
diff --git a/erpnext/projects/doctype/task/test_records.json b/erpnext/projects/doctype/task/test_records.json
deleted file mode 100644
index 42ca0e7..0000000
--- a/erpnext/projects/doctype/task/test_records.json
+++ /dev/null
@@ -1,15 +0,0 @@
-[
- {
-  "status": "Open", 
-  "subject": "_Test Task",
-  "name": "task001"
- }, 
- {
-  "status": "Open", 
-  "subject": "_Test Task 1"
- }, 
- {
-  "status": "Open", 
-  "subject": "_Test Task 2"
- }
-]
\ No newline at end of file
diff --git a/erpnext/projects/doctype/task/test_task.py b/erpnext/projects/doctype/task/test_task.py
index 2e64b73..1d94618 100644
--- a/erpnext/projects/doctype/task/test_task.py
+++ b/erpnext/projects/doctype/task/test_task.py
@@ -5,137 +5,61 @@
 import unittest
 from frappe.utils import getdate, nowdate, add_days
 
-# test_records = frappe.get_test_records('Task')
-
 from erpnext.projects.doctype.task.task import CircularReferenceError
 
 class TestTask(unittest.TestCase):
 	def test_circular_reference(self):
+		task1 = create_task("_Test Task 1", nowdate(), add_days(nowdate(), 10))
+		task2 = create_task("_Test Task 2", add_days(nowdate(), 11), add_days(nowdate(), 15), task1.name)
+		task3 = create_task("_Test Task 3", add_days(nowdate(), 11), add_days(nowdate(), 15), task2.name)
 
-		task1 =  frappe.new_doc('Task')
-		task1.update({
-			"status": "Open",
-			"subject": "_Test Task 1",
-			"project": "_Test Project",
-			"exp_start_date": "2015-1-1",
-			"exp_end_date": "2015-1-10"
-		})
-		task1.save()
-
-		task2 =  frappe.new_doc('Task')
-		task2.update({
-			"status": "Open",
-			"subject": "_Test Task 2",
-			"project": "_Test Project",
-			"exp_start_date": "2015-1-11",
-			"exp_end_date": "2015-1-15",
-			"depends_on":[
-				{
-					"task": task1.name
-				}
-			]
-		})
-		task2.save()
-
-		task3 =  frappe.new_doc('Task')
-		task3.update({
-			"status": "Open",
-			"subject": "_Test Task 2",
-			"project": "_Test Project",
-			"exp_start_date": "2015-1-11",
-			"exp_end_date": "2015-1-15",
-			"depends_on":[
-				{
-					"task": task2.name
-				}
-			]
-		})
-		task3.save()
-
+		task1.reload()
 		task1.append("depends_on", {
 			"task": task3.name
 		})
+
 		self.assertRaises(CircularReferenceError, task1.save)
 
 		task1.set("depends_on", [])
 		task1.save()
 
-		task4 =  frappe.new_doc('Task')
-		task4.update({
-			"status": "Open",
-			"subject": "_Test Task 1",
-			"exp_start_date": "2015-1-1",
-			"exp_end_date": "2015-1-15",
-			"depends_on":[
-				{
-					"task": task1.name
-				}
-			]
-		})
-		task4.save()
+		task4 = create_task("_Test Task 4", nowdate(), add_days(nowdate(), 15), task1.name)
 
 		task3.append("depends_on", {
 			"task": task4.name
 		})
 
 	def test_reschedule_dependent_task(self):
-		task1 =  frappe.new_doc('Task')
-		task1.update({
-			"status": "Open",
-			"subject": "_Test Task 1",
-			"project": "_Test Project",
-			"exp_start_date": "2015-1-1",
-			"exp_end_date": "2015-1-10"
-		})
-		task1.save()
+		task1 = create_task("_Test Task 1", nowdate(), add_days(nowdate(), 10))
 
-		task2 =  frappe.new_doc('Task')
-		task2.update({
-			"status": "Open",
-			"subject": "_Test Task 2",
-			"project": "_Test Project",
-			"exp_start_date": "2015-1-11",
-			"exp_end_date": "2015-1-15",
-			"depends_on":[
-				{
-					"task": task1.name,
-					"project": "_Test Project"
-				}
-			]
-		})
+		task2 = create_task("_Test Task 2", add_days(nowdate(), 11), add_days(nowdate(), 15), task1.name)
+		task2.get("depends_on")[0].project = "_Test Project"
 		task2.save()
 
-		task3 =  frappe.new_doc('Task')
-		task3.update({
-			"status": "Open",
-			"subject": "_Test Task 3",
-			"project": "_Test Project",
-			"exp_start_date": "2015-1-16",
-			"exp_end_date": "2015-1-18",
-			"depends_on":[
-				{
-					"task": task2.name,
-					"project": "_Test Project"
-				}
-			]
-		})
+		task3 = create_task("_Test Task 3", add_days(nowdate(), 11), add_days(nowdate(), 15), task2.name)
+		task3.get("depends_on")[0].project = "_Test Project"
 		task3.save()
 
 		task1.update({
-			"exp_end_date": "2015-1-20"
+			"exp_end_date": add_days(nowdate(), 20)
 		})
 		task1.save()
 
-		self.assertEqual(frappe.db.get_value("Task", task2.name, "exp_start_date"), getdate('2015-1-21'))
-		self.assertEqual(frappe.db.get_value("Task", task2.name, "exp_end_date"), getdate('2015-1-25'))
+		self.assertEqual(frappe.db.get_value("Task", task2.name, "exp_start_date"),
+			getdate(add_days(nowdate(), 21)))
+		self.assertEqual(frappe.db.get_value("Task", task2.name, "exp_end_date"),
+			getdate(add_days(nowdate(), 25)))
 
-		self.assertEqual(frappe.db.get_value("Task", task3.name, "exp_start_date"), getdate('2015-1-26'))
-		self.assertEqual(frappe.db.get_value("Task", task3.name, "exp_end_date"), getdate('2015-1-28'))
+		self.assertEqual(frappe.db.get_value("Task", task3.name, "exp_start_date"),
+			getdate(add_days(nowdate(), 26)))
+		self.assertEqual(frappe.db.get_value("Task", task3.name, "exp_end_date"),
+			getdate(add_days(nowdate(), 30)))
 
 	def test_close_assignment(self):
-		task = frappe.new_doc("Task")
-		task.subject = "Test Close Assignment"
-		task.insert()
+		if not frappe.db.exists("Task", "Test Close Assignment"):
+			task = frappe.new_doc("Task")
+			task.subject = "Test Close Assignment"
+			task.insert()
 
 		def assign():
 			from frappe.desk.form import assign_to
@@ -147,8 +71,10 @@
 			})
 
 		def get_owner_and_status():
-			return frappe.db.get_value("ToDo", filters={"reference_type": task.doctype, "reference_name": task.name,
-					"description": "Close this task"}, fieldname=("owner", "status"), as_dict=True)
+			return frappe.db.get_value("ToDo",
+				filters={"reference_type": task.doctype, "reference_name": task.name,
+					"description": "Close this task"},
+				fieldname=("owner", "status"), as_dict=True)
 
 		assign()
 		todo = get_owner_and_status()
@@ -164,16 +90,29 @@
 		self.assertEquals(todo.status, "Closed")
 
 	def test_overdue(self):
-		task = frappe.get_doc({
-			"doctype":"Task",
-			"subject": "Testing Overdue",
-			"status": "Open",
-			"exp_end_date": add_days(nowdate(), -1)
-		})
-
-		task.insert()
+		task = create_task("Testing Overdue", add_days(nowdate(), -10), add_days(nowdate(), -5))
 
 		from erpnext.projects.doctype.task.task import set_tasks_as_overdue
 		set_tasks_as_overdue()
 
 		self.assertEquals(frappe.db.get_value("Task", task.name, "status"), "Overdue")
+
+def create_task(subject, start=None, end=None, depends_on=None, project=None):
+	if not frappe.db.exists("Task", subject):
+		task = frappe.new_doc('Task')
+		task.status = "Open"
+		task.subject = subject
+		task.exp_start_date = start or nowdate()
+		task.exp_end_date = end or nowdate()
+		task.project = project or "_Test Project"
+		task.save()
+	else:
+		task = frappe.get_doc("Task", subject)
+
+	if depends_on:
+		task.append("depends_on", {
+			"task": depends_on
+		})
+		task.save()
+
+	return task
\ No newline at end of file
diff --git a/erpnext/projects/doctype/task/test_task.js b/erpnext/projects/doctype/task/tests/test_task.js
similarity index 100%
rename from erpnext/projects/doctype/task/test_task.js
rename to erpnext/projects/doctype/task/tests/test_task.js
diff --git a/erpnext/projects/doctype/task/tests/test_task_tree.js b/erpnext/projects/doctype/task/tests/test_task_tree.js
new file mode 100644
index 0000000..9cbcf85
--- /dev/null
+++ b/erpnext/projects/doctype/task/tests/test_task_tree.js
@@ -0,0 +1,99 @@
+/* eslint-disable */
+// rename this file from _test_[name] to test_[name] to activate
+// and remove above this line
+
+QUnit.test("test: Task Tree", function (assert) {
+	let done = assert.async();
+
+	// number of asserts
+	assert.expect(5);
+
+	frappe.run_serially([
+		// insert a new Task
+		() => frappe.set_route('Tree', 'Task'),
+		() => frappe.timeout(0.5),
+
+		// Checking adding child without selecting any Node
+		() => frappe.tests.click_button('New'),
+		() => frappe.timeout(0.5),
+		() => {assert.equal($(`.msgprint`).text(), "Select a group node first.", "Error message success");},
+		() => frappe.tests.click_button('Close'),
+		() => frappe.timeout(0.5),
+
+		// Creating child nodes
+		() => frappe.tests.click_link('task'),
+		() => frappe.map_group.make('Test-1'),
+		() => frappe.map_group.make('Test-2'),
+		() => frappe.map_group.make('Test-3', 1),
+		() => frappe.timeout(1),
+		() => frappe.tests.click_link('Test-3'),
+		() => frappe.map_group.make('Test-4', 0),
+
+		// Checking Edit button
+		() => frappe.timeout(0.5),
+		() => frappe.tests.click_link('Test-1'),
+		() => frappe.tests.click_button('Edit'),
+		() => frappe.timeout(0.5),
+		() => {assert.deepEqual(frappe.get_route(), ["Form", "Task", "Test-1"], "Edit route checks");},
+
+		// Deleting child Node
+		() => frappe.set_route('Tree', 'Task'),
+		() => frappe.timeout(0.5),
+		() => frappe.tests.click_link('Test-1'),
+		() => frappe.tests.click_button('Delete'),
+		() => frappe.timeout(0.5),
+		() => frappe.tests.click_button('Yes'),
+
+		// Deleting Group Node that has child nodes in it
+		() => frappe.timeout(0.5),
+		() => frappe.tests.click_link('Test-3'),
+		() => frappe.tests.click_button('Delete'),
+		() => frappe.timeout(0.5),
+		() => frappe.tests.click_button('Yes'),
+		() => frappe.timeout(1),
+		() => {assert.equal(cur_dialog.title, 'Message', 'Error thrown correctly');},
+		() => frappe.tests.click_button('Close'),
+
+		// Renaming Child node
+		() => frappe.timeout(0.5),
+		() => frappe.tests.click_link('Test-2'),
+		() => frappe.tests.click_button('Rename'),
+		() => frappe.timeout(1),
+		() => cur_dialog.set_value('new_name', 'Test-5'),
+		() => frappe.timeout(1.5),
+		() => cur_dialog.get_primary_btn().click(),
+		() => frappe.timeout(1),
+		() => {assert.equal($(`a:contains("Test-5"):visible`).length, 1, 'Rename successfull');},
+
+		// Add multiple child tasks
+		() => frappe.tests.click_link('Test-3'),
+		() => frappe.timeout(0.5),
+		() => frappe.click_button('Add Multiple'),
+		() => frappe.timeout(1),
+		() => cur_dialog.set_value('tasks', 'Test-6\nTest-7'),
+		() => frappe.timeout(0.5),
+		() => frappe.click_button('Submit'),
+		() => frappe.timeout(2),
+		() => frappe.click_button('Expand All'),
+		() => frappe.timeout(1),
+		() => {
+			let count = $(`a:contains("Test-6"):visible`).length + $(`a:contains("Test-7"):visible`).length;
+			assert.equal(count, 2, "Multiple Tasks added successfully");
+		},
+
+		() => done()
+	]);
+});
+
+frappe.map_group = {
+	make:function(subject, is_group = 0){
+		return frappe.run_serially([
+			() => frappe.click_button('Add Child'),
+			() => frappe.timeout(1),
+			() => cur_dialog.set_value('is_group', is_group),
+			() => cur_dialog.set_value('subject', subject),
+			() => frappe.click_button('Create New'),
+			() => frappe.timeout(1.5)
+		]);
+	}
+};
diff --git a/erpnext/public/build.json b/erpnext/public/build.json
index 393e90c..0730df9 100644
--- a/erpnext/public/build.json
+++ b/erpnext/public/build.json
@@ -32,7 +32,9 @@
         "public/js/utils/item_selector.js",
         "public/js/help_links.js",
         "public/js/schools/student_button.html",
-        "public/js/schools/assessment_result_tool.html"
+        "public/js/schools/assessment_result_tool.html",
+        "public/js/templates/item_quick_entry.html",
+        "public/js/utils/item_quick_entry.js"
     ],
     "js/item-dashboard.min.js": [
         "stock/dashboard/item_dashboard.html",
diff --git a/erpnext/public/js/controllers/taxes_and_totals.js b/erpnext/public/js/controllers/taxes_and_totals.js
index 84624b8..05c323b 100644
--- a/erpnext/public/js/controllers/taxes_and_totals.js
+++ b/erpnext/public/js/controllers/taxes_and_totals.js
@@ -4,11 +4,13 @@
 erpnext.taxes_and_totals = erpnext.payments.extend({
 	setup: function() {},
 	apply_pricing_rule_on_item: function(item){
+
 		if(item.margin_type == "Percentage"){
 			item.rate_with_margin = flt(item.price_list_rate)
 				+ flt(item.price_list_rate) * ( flt(item.margin_rate_or_amount) / 100);
 		} else {
 			item.rate_with_margin = flt(item.price_list_rate) + flt(item.margin_rate_or_amount);
+			item.base_rate_with_margin = flt(item.rate_with_margin) * flt(cur_frm.doc.conversion_rate);
 		}
 
 		item.rate = flt(item.rate_with_margin , precision("rate", item));
diff --git a/erpnext/public/js/pos/pos_selected_item.html b/erpnext/public/js/pos/pos_selected_item.html
index 6f2772b..085e048 100644
--- a/erpnext/public/js/pos/pos_selected_item.html
+++ b/erpnext/public/js/pos/pos_selected_item.html
@@ -8,7 +8,7 @@
 		<input type="tel" class="form-control cell" disabled value="{%= price_list_rate %}"/>
 	</div>
 	<div class="pos-list-row">
-		<div class="cell">{{ __("Discount") }}:</div>
+		<div class="cell">{{ __("Discount") }}: %</div>
 		<input type="tel" class="form-control cell pos-item-disc" value="{%= discount_percentage %}">
 	</div>
 	<div class="pos-list-row">
diff --git a/erpnext/public/js/templates/item_quick_entry.html b/erpnext/public/js/templates/item_quick_entry.html
new file mode 100644
index 0000000..6a5f36d
--- /dev/null
+++ b/erpnext/public/js/templates/item_quick_entry.html
@@ -0,0 +1,3 @@
+<div class="h6 uppercase" style="margin-top: 30px;">{{ __("Variant Attributes") }}</div>
+<div class="attributes hide-control">
+</div>
\ No newline at end of file
diff --git a/erpnext/public/js/utils/item_quick_entry.js b/erpnext/public/js/utils/item_quick_entry.js
new file mode 100644
index 0000000..ebb92da
--- /dev/null
+++ b/erpnext/public/js/utils/item_quick_entry.js
@@ -0,0 +1,408 @@
+frappe.provide('frappe.ui.form');
+
+frappe.ui.form.ItemQuickEntryForm = frappe.ui.form.QuickEntryForm.extend({
+	init: function(doctype, after_insert) {
+		this._super(doctype, after_insert);
+	},
+
+	render_dialog: function() {
+		this.mandatory = this.get_variant_fields().concat(this.mandatory);
+		this.mandatory = this.mandatory.concat(this.get_attributes_fields());
+		this._super();
+		this.init_post_render_dialog_operations();
+		this.preset_fields_for_template();
+		this.dialog.$wrapper.find('.edit-full').text(__('Edit in full page for more options like assets, serial nos, batches etc.'))
+	},
+
+	init_post_render_dialog_operations: function() {
+		this.dialog.fields_dict.attribute_html.$wrapper.append(frappe.render_template("item_quick_entry"));
+		this.init_for_create_variant_trigger();
+		this.init_for_item_template_trigger();
+		// explicitly hide manufacturing fields as hidden not working.
+		this.toggle_manufacturer_fields();
+		this.dialog.get_field("item_template").df.hidden = 1;
+		this.dialog.get_field("item_template").refresh();
+	},
+
+	register_primary_action: function() {
+		var me = this;
+		this.dialog.set_primary_action(__('Save'), function() {
+			if (me.dialog.working) return;
+
+			var data = me.dialog.get_values();
+			var variant_values = {};
+
+			if (me.dialog.fields_dict.create_variant.$input.prop("checked")) {
+				variant_values = me.get_variant_doc();
+				if (!Object.keys(variant_values).length) {
+					data = null;
+				}
+				variant_values.stock_uom = me.template_doc.stock_uom;
+				variant_values.item_group = me.template_doc.item_group;
+			}
+
+			if (data) {
+				me.dialog.working = true;
+				var values = me.update_doc();
+				//patch for manufacturer type variants as extend is overwriting it.
+				if (variant_values['variant_based_on'] == "Manufacturer") {
+					values['variant_based_on'] = "Manufacturer";
+				}
+				$.extend(variant_values, values);
+				me.insert(variant_values);
+			}
+		});
+	},
+
+	insert: function(variant_values) {
+		let me = this;
+		return new Promise(resolve => {
+			frappe.call({
+				method: "frappe.client.insert",
+				args: {
+					doc: variant_values
+				},
+				callback: function(r) {
+					me.dialog.hide();
+					// delete the old doc
+					frappe.model.clear_doc(me.dialog.doc.doctype, me.dialog.doc.name);
+					me.dialog.doc = r.message;
+					if (frappe._from_link) {
+						frappe.ui.form.update_calling_link(me.dialog.doc);
+					} else {
+						if (me.after_insert) {
+							me.after_insert(me.dialog.doc);
+						} else {
+							me.open_from_if_not_list();
+						}
+					}
+				},
+				error: function() {
+					me.open_doc();
+				},
+				always: function() {
+					me.dialog.working = false;
+					resolve(me.dialog.doc);
+				},
+				freeze: true
+			});
+		});
+	},
+
+	open_doc: function() {
+		this.dialog.hide();
+		this.update_doc();
+		if (this.dialog.fields_dict.create_variant.$input.prop("checked")) {
+			var template = this.dialog.fields_dict.item_template.input.value;
+			if (template)
+				frappe.set_route("Form", this.doctype, template);
+		} else {
+			frappe.set_route('Form', this.doctype, this.doc.name);
+		}
+	},
+
+	get_variant_fields: function() {
+		var variant_fields = [{
+			fieldname: "create_variant",
+			fieldtype: "Check",
+			label: __("Create Variant")
+		},
+		{
+			fieldname: 'item_template',
+			label: __('Item Template'),
+			reqd: 0,
+			fieldtype: 'Link',
+			options: "Item",
+			get_query: function() {
+				return {
+					filters: {
+						"has_variants": 1
+					}
+				};
+			}
+		}];
+
+		return variant_fields;
+	},
+
+	get_manufacturing_fields: function() {
+		this.manufacturer_fields = [{
+			fieldtype: 'Link',
+			options: 'Manufacturer',
+			label: 'Manufacturer',
+			fieldname: "manufacturer",
+			hidden: 1,
+			reqd: 0
+		}, {
+			fieldtype: 'Data',
+			label: 'Manufacturer Part Number',
+			fieldname: 'manufacturer_part_no',
+			hidden: 1,
+			reqd: 0
+		}];
+		return this.manufacturer_fields;
+	},
+
+	get_attributes_fields: function() {
+		var attribute_fields = [{
+			fieldname: 'attribute_html',
+			fieldtype: 'HTML'
+		}]
+
+		attribute_fields = attribute_fields.concat(this.get_manufacturing_fields());
+		return attribute_fields;
+	},
+
+	init_for_create_variant_trigger: function() {
+		var me = this;
+
+		this.dialog.fields_dict.create_variant.$input.on("click", function() {
+			me.preset_fields_for_template();
+			me.init_post_template_trigger_operations(false, [], true);
+		});
+	},
+
+	preset_fields_for_template: function() {
+		var for_variant = this.dialog.get_value('create_variant');
+
+		// setup template field, seen and mandatory if variant
+		let template_field = this.dialog.get_field("item_template");
+		template_field.df.reqd = for_variant;
+		template_field.set_value('');
+		template_field.df.hidden = !for_variant;
+		template_field.refresh();
+
+		// hide properties for variant
+		['item_code', 'item_name', 'item_group', 'stock_uom'].forEach((d) => {
+			let f = this.dialog.get_field(d);
+			f.df.hidden = for_variant;
+			f.refresh();
+		});
+
+		this.dialog.get_field('attribute_html').toggle(false);
+
+		// non mandatory for variants
+		['item_code', 'stock_uom', 'item_group'].forEach((d) => {
+			let f = this.dialog.get_field(d);
+			f.df.reqd = !for_variant;
+			f.refresh();
+		});
+
+	},
+
+	init_for_item_template_trigger: function() {
+		var me = this;
+
+		me.dialog.fields_dict["item_template"].df.onchange = () => {
+			var template = me.dialog.fields_dict.item_template.input.value;
+			me.template_doc = null;
+			if (template) {
+				frappe.call({
+					method: "frappe.client.get",
+					args: {
+						doctype: "Item",
+						name: template
+					},
+					callback: function(r) {
+						me.template_doc = r.message;
+						me.is_manufacturer = false;
+
+						if (me.template_doc.variant_based_on === "Manufacturer") {
+							me.init_post_template_trigger_operations(true, [], true);
+						} else {
+
+							me.init_post_template_trigger_operations(false, me.template_doc.attributes, false);
+							me.render_attributes(me.template_doc.attributes);
+						}
+					}
+				});
+			} else {
+				me.dialog.get_field('attribute_html').toggle(false);
+				me.init_post_template_trigger_operations(false, [], true);
+			}
+		}
+	},
+
+	init_post_template_trigger_operations: function(is_manufacturer, attributes, attributes_flag) {
+		this.attributes = attributes;
+		this.attribute_values = {};
+		this.attributes_count = attributes.length;
+
+		this.dialog.fields_dict.attribute_html.$wrapper.find(".attributes").empty();
+		this.is_manufacturer = is_manufacturer;
+		this.toggle_manufacturer_fields();
+		this.dialog.fields_dict.attribute_html.$wrapper.find(".attributes").toggleClass("hide-control", attributes_flag);
+		this.dialog.fields_dict.attribute_html.$wrapper.find(".attributes-header").toggleClass("hide-control", attributes_flag);
+	},
+
+	toggle_manufacturer_fields: function() {
+		var me = this;
+		$.each(this.manufacturer_fields, function(i, dialog_field) {
+			me.dialog.get_field(dialog_field.fieldname).df.hidden = !me.is_manufacturer;
+			me.dialog.get_field(dialog_field.fieldname).df.reqd = dialog_field.fieldname == 'manufacturer' ? me.is_manufacturer : false;
+			me.dialog.get_field(dialog_field.fieldname).refresh();
+		});
+	},
+
+	initiate_render_attributes: function() {
+		this.dialog.fields_dict.attribute_html.$wrapper.find(".attributes").empty();
+		this.render_attributes(this.attributes);
+	},
+
+	render_attributes: function(attributes) {
+		var me = this;
+
+		this.dialog.get_field('attribute_html').toggle(true);
+
+		$.each(attributes, function(index, row) {
+			var desc = "";
+			var fieldtype = "Data";
+			if (row.numeric_values) {
+				fieldtype = "Float";
+				desc = "Min Value: " + row.from_range + " , Max Value: " + row.to_range + ", in Increments of: " + row.increment;
+			}
+
+			me.init_make_control(fieldtype, row);
+			me[row.attribute].set_value(me.attribute_values[row.attribute] || "");
+			me[row.attribute].$wrapper.toggleClass("has-error", me.attribute_values[row.attribute] ? false : true);
+
+			// Set Label explicitly as make_control is not displaying label
+			$(me[row.attribute].label_area).text(__(row.attribute));
+
+			if (desc) {
+				$(repl(`<p class="help-box small text-muted hidden-xs">%(desc)s</p>`, {
+					"desc": desc
+				})).insertAfter(me[row.attribute].input_area);
+			}
+
+			if (!row.numeric_values) {
+				me.init_awesomplete_for_attribute(row);
+			} else {
+				me[row.attribute].$input.on("change", function() {
+					me.attribute_values[row.attribute] = $(this).val();
+					$(this).closest(".frappe-control").toggleClass("has-error", $(this).val() ? false : true);
+				});
+			}
+		});
+	},
+
+	init_make_control: function(fieldtype, row) {
+		this[row.attribute] = frappe.ui.form.make_control({
+			df: {
+				"fieldtype": fieldtype,
+				"label": row.attribute,
+				"fieldname": row.attribute,
+				"options": row.options || ""
+			},
+			parent: $(this.dialog.fields_dict.attribute_html.wrapper).find(".attributes"),
+			only_input: false
+		});
+		this[row.attribute].make_input();
+	},
+
+	init_awesomplete_for_attribute: function(row) {
+		var me = this;
+
+		this[row.attribute].input.awesomplete = new Awesomplete(this[row.attribute].input, {
+			minChars: 0,
+			maxItems: 99,
+			autoFirst: true,
+			list: [],
+		});
+
+		this[row.attribute].$input.on('input', function(e) {
+			frappe.call({
+				method: "frappe.client.get_list",
+				args: {
+					doctype: "Item Attribute Value",
+					filters: [
+						["parent", "=", $(e.target).attr("data-fieldname")],
+						["attribute_value", "like", e.target.value + "%"]
+					],
+					fields: ["attribute_value"]
+				},
+				callback: function(r) {
+					if (r.message) {
+						e.target.awesomplete.list = r.message.map(function(d) {
+							return d.attribute_value;
+						});
+					}
+				}
+			});
+		}).on('focus', function(e) {
+			$(e.target).val('').trigger('input');
+		}).on("awesomplete-close", function (e) {
+			me.attribute_values[$(e.target).attr("data-fieldname")] = e.target.value;
+			$(e.target).closest(".frappe-control").toggleClass("has-error", e.target.value ? false : true);
+		});
+	},
+
+	get_variant_doc: function() {
+		var me = this;
+		var variant_doc = {};
+		var attribute = this.validate_mandatory_attributes();
+
+		if (Object.keys(attribute).length) {
+			frappe.call({
+				method: "erpnext.controllers.item_variant.create_variant_doc_for_quick_entry",
+				args: {
+					"template": me.dialog.fields_dict.item_template.$input.val(),
+					args: attribute
+				},
+				async: false,
+				callback: function(r) {
+					if (Object.prototype.toString.call(r.message) == "[object Object]") {
+						variant_doc = r.message;
+					} else {
+						var msgprint_dialog = frappe.msgprint(__("Item Variant {0} already exists with same attributes", [repl('<a class="strong variant-click" data-item-code="%(item)s" \
+								>%(item)s</a>', {
+								item: r.message
+							})]));
+
+						msgprint_dialog.$wrapper.find(".variant-click").on("click", function() {
+							msgprint_dialog.hide();
+							me.dialog.hide();
+							if (frappe._from_link) {
+								frappe._from_link.set_value($(this).attr("data-item-code"));
+							} else {
+								frappe.set_route('Form', "Item", $(this).attr("data-item-code"));
+							}
+						});
+					}
+				}
+			})
+		}
+		return variant_doc;
+	},
+
+	validate_mandatory_attributes: function() {
+		var me = this;
+		var attribute = {};
+		var mandatory = [];
+
+		$.each(this.attributes, function(index, attr) {
+			var value = me.attribute_values[attr.attribute] || "";
+			if (value) {
+				attribute[attr.attribute] = attr.numeric_values ? flt(value) : value;
+			} else {
+				mandatory.push(attr.attribute);
+			}
+		})
+
+		if (mandatory.length) {
+			frappe.msgprint({
+				title: __('Missing Values Required'),
+				message: __('Following fields have missing values:') + '<br><br><ul><li>' + mandatory.join('<li>') + '</ul>',
+				indicator: 'orange'
+			});
+			return {};
+		}
+
+		if (this.is_manufacturer) {
+			$.each(this.manufacturer_fields, function(index, field) {
+				attribute[field.fieldname] = me.dialog.fields_dict[field.fieldname].input.value;
+			});
+		}
+		return attribute;
+	}
+});
\ No newline at end of file
diff --git a/erpnext/schools/doctype/assessment_plan/assessment_plan.py b/erpnext/schools/doctype/assessment_plan/assessment_plan.py
index a09f3ee..55c4148 100644
--- a/erpnext/schools/doctype/assessment_plan/assessment_plan.py
+++ b/erpnext/schools/doctype/assessment_plan/assessment_plan.py
@@ -43,7 +43,7 @@
 		assessment_criteria_list = frappe.db.sql_list(''' select apc.assessment_criteria
 			from `tabAssessment Plan` ap , `tabAssessment Plan Criteria` apc
 			where ap.name = apc.parent and ap.course=%s and ap.student_group=%s and ap.assessment_group=%s
-			and ap.name != %s''', (self.course, self.student_group, self.assessment_group, self.name))
+			and ap.name != %s and ap.docstatus=1''', (self.course, self.student_group, self.assessment_group, self.name))
 		for d in self.assessment_criteria:
 			if d.assessment_criteria in assessment_criteria_list:
 				frappe.throw(_("You have already assessed for the assessment criteria {}.")
diff --git a/erpnext/schools/doctype/assessment_result/assessment_result.js b/erpnext/schools/doctype/assessment_result/assessment_result.js
index 7bd1d19..6d20896 100644
--- a/erpnext/schools/doctype/assessment_result/assessment_result.js
+++ b/erpnext/schools/doctype/assessment_result/assessment_result.js
@@ -32,7 +32,7 @@
 frappe.ui.form.on("Assessment Result Detail", {
 	score: function(frm, cdt, cdn) {
 		var d  = locals[cdt][cdn];
-		if (d.score >= d.maximum_score) {
+		if (d.score > d.maximum_score) {
 			frappe.throw(__("Score cannot be greater than Maximum Score"));
 		}
 		else {
diff --git a/erpnext/schools/doctype/assessment_result_tool/assessment_result_tool.js b/erpnext/schools/doctype/assessment_result_tool/assessment_result_tool.js
index dfa7b14..142bbf4 100644
--- a/erpnext/schools/doctype/assessment_result_tool/assessment_result_tool.js
+++ b/erpnext/schools/doctype/assessment_result_tool/assessment_result_tool.js
@@ -12,10 +12,11 @@
 			frm.set_value("student_group", frappe.route_options.student_group);
 			frm.set_value("assessment_plan", frappe.route_options.assessment_plan);
 			frappe.route_options = null;
+		} else {
+			frm.trigger("assessment_plan");
 		}
 		frm.disable_save();
 		frm.page.clear_indicator();
-		frm.trigger("assessment_plan");
 	},
 
 	assessment_plan: function(frm) {
diff --git a/erpnext/schools/report/assessment_plan_status/__init__.py b/erpnext/schools/report/assessment_plan_status/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/erpnext/schools/report/assessment_plan_status/__init__.py
diff --git a/erpnext/schools/report/assessment_plan_status/assessment_plan_status.js b/erpnext/schools/report/assessment_plan_status/assessment_plan_status.js
new file mode 100644
index 0000000..2d1eb09
--- /dev/null
+++ b/erpnext/schools/report/assessment_plan_status/assessment_plan_status.js
@@ -0,0 +1,28 @@
+// Copyright (c) 2016, Frappe Technologies Pvt. Ltd. and contributors
+// For license information, please see license.txt
+/* eslint-disable */
+
+frappe.query_reports["Assessment Plan Status"] = {
+	"filters": [
+		{
+			"fieldname":"assessment_group",
+			"label": __("Assessment Group"),
+			"fieldtype": "Link",
+			"options": "Assessment Group",
+			"get_query": function() {
+				return{
+					filters: {
+						'is_group': 0
+					}
+				};
+			}
+		},
+		{
+			"fieldname":"schedule_date",
+			"label": __("Scheduled Upto"),
+			"fieldtype": "Date",
+			"options": ""
+		}
+
+	]
+}
diff --git a/erpnext/schools/report/assessment_plan_status/assessment_plan_status.json b/erpnext/schools/report/assessment_plan_status/assessment_plan_status.json
new file mode 100644
index 0000000..141747f5
--- /dev/null
+++ b/erpnext/schools/report/assessment_plan_status/assessment_plan_status.json
@@ -0,0 +1,23 @@
+{
+ "add_total_row": 0, 
+ "apply_user_permissions": 1, 
+ "creation": "2017-11-09 15:07:30.404428", 
+ "disabled": 0, 
+ "docstatus": 0, 
+ "doctype": "Report", 
+ "idx": 0, 
+ "is_standard": "Yes", 
+ "modified": "2017-11-13 11:25:50.651364", 
+ "modified_by": "Administrator", 
+ "module": "Schools", 
+ "name": "Assessment Plan Status", 
+ "owner": "Administrator", 
+ "ref_doctype": "Assessment Plan", 
+ "report_name": "Assessment Plan Status", 
+ "report_type": "Script Report", 
+ "roles": [
+  {
+   "role": "Academics User"
+  }
+ ]
+}
\ No newline at end of file
diff --git a/erpnext/schools/report/assessment_plan_status/assessment_plan_status.py b/erpnext/schools/report/assessment_plan_status/assessment_plan_status.py
new file mode 100644
index 0000000..21184a6
--- /dev/null
+++ b/erpnext/schools/report/assessment_plan_status/assessment_plan_status.py
@@ -0,0 +1,179 @@
+# Copyright (c) 2013, Frappe Technologies Pvt. Ltd. and contributors
+# For license information, please see license.txt
+
+from __future__ import unicode_literals
+import frappe
+from frappe import _
+from itertools import groupby
+from frappe.utils import cint
+
+DOCSTATUS = {
+	0: "saved",
+	1: "submitted",
+}
+
+def execute(filters=None):
+	columns, data = [], []
+
+	args = frappe._dict()
+	args["assessment_group"] = filters.get("assessment_group")
+	args["schedule_date"] = filters.get("schedule_date")
+
+	columns = get_column()
+
+	data, chart = get_assessment_data(args)
+
+	return columns, data, None, chart
+
+
+def get_assessment_data(args=None):
+
+	# [total, saved, submitted, remaining]
+	chart_data = [0, 0, 0, 0]
+
+	condition = ''
+	if args["assessment_group"]:
+		condition += "and assessment_group = %(assessment_group)s"
+	if args["schedule_date"]:
+		condition += "and schedule_date <= %(schedule_date)s"
+
+	assessment_plan = frappe.db.sql('''
+			SELECT
+				ap.name as assessment_plan,
+				ap.assessment_name,
+				ap.student_group,
+				ap.schedule_date,
+				(select count(*) from `tabStudent Group Student` sgs where sgs.parent=ap.student_group)
+					as student_group_strength
+			FROM
+				`tabAssessment Plan` ap
+			WHERE
+				ap.docstatus = 1 {condition}
+			ORDER BY
+				ap.modified desc
+		'''.format(condition=condition), (args), as_dict=1)
+
+	assessment_plan_list = [d.assessment_plan for d in assessment_plan] if assessment_plan else ['']
+	assessment_result = get_assessment_result(assessment_plan_list)
+
+	for d in assessment_plan:
+
+		assessment_plan_details = assessment_result.get(d.assessment_plan)
+		assessment_plan_details = frappe._dict() if not assessment_plan_details else \
+			frappe._dict(assessment_plan_details)
+		if "saved" not in assessment_plan_details:
+			assessment_plan_details.update({"saved": 0})
+		if "submitted" not in assessment_plan_details:
+			assessment_plan_details.update({"submitted": 0})
+
+		# remaining students whose marks not entered
+		remaining_students = cint(d.student_group_strength) - cint(assessment_plan_details.saved) -\
+			cint(assessment_plan_details.submitted)
+		assessment_plan_details.update({"remaining": remaining_students})
+		d.update(assessment_plan_details)
+
+		chart_data[0] += cint(d.student_group_strength)
+		chart_data[1] += assessment_plan_details.saved
+		chart_data[2] += assessment_plan_details.submitted
+		chart_data[3] += assessment_plan_details.remaining
+
+	chart = get_chart(chart_data[1:])
+
+	return assessment_plan, chart
+
+
+def get_assessment_result(assessment_plan_list):
+	assessment_result_dict = frappe._dict()
+
+	assessment_result = frappe.db.sql('''
+		SELECT
+			assessment_plan, docstatus, count(*) as count
+		FROM
+			`tabAssessment Result`
+		WHERE
+			assessment_plan in (%s)
+		GROUP BY
+			assessment_plan, docstatus
+		ORDER BY
+			assessment_plan
+	''' %', '.join(['%s']*len(assessment_plan_list)), tuple(assessment_plan_list), as_dict=1)
+
+	for key, group in groupby(assessment_result, lambda ap: ap["assessment_plan"]):
+		tmp = {}
+		for d in group:
+			if d.docstatus in [0,1]:
+				tmp.update({DOCSTATUS[d.docstatus]:d.count})
+		assessment_result_dict[key] = tmp
+
+	return assessment_result_dict
+
+
+def get_chart(chart_data):
+	return {
+		"data": {
+			"labels": ["Saved", "Submitted", "Remaining"],
+			"datasets": [{
+				"values": chart_data
+			}]
+		},
+		"type": 'percentage',
+	}
+
+
+def get_column():
+	return [{
+		"fieldname": "assessment_plan",
+		"label": _("Assessment Plan"),
+		"fieldtype": "Link",
+		"options": "Assessment Plan",
+		"width": 120
+	},
+	{
+		"fieldname": "assessment_name",
+		"label": _("Assessment Plan Name"),
+		"fieldtype": "Data",
+		"options": "",
+		"width": 200
+	},
+	{
+		"fieldname": "schedule_date",
+		"label": _("Schedule Date"),
+		"fieldtype": "Date",
+		"options": "",
+		"width": 100
+	},
+	{
+		"fieldname": "student_group",
+		"label": _("Student Group"),
+		"fieldtype": "Link",
+		"options": "Student Group",
+		"width": 200
+	},
+	{
+		"fieldname": "student_group_strength",
+		"label": _("Total Student"),
+		"fieldtype": "Data",
+		"options": "",
+		"width": 100
+	},
+	{
+		"fieldname": "submitted",
+		"label": _("Submitted"),
+		"fieldtype": "Data",
+		"options": "",
+		"width": 100
+	},
+	{
+		"fieldname": "saved",
+		"label": _("Saved"),
+		"fieldtype": "Data",
+		"options": "",
+		"width": 100
+	},
+	{
+		"fieldname": "remaining",
+		"label": _("Remaining"),
+		"fieldtype": "Data",
+		"options": "",
+		"width": 100
+	}]
diff --git a/erpnext/selling/doctype/quotation/quotation.py b/erpnext/selling/doctype/quotation/quotation.py
index f0cce5f..6d9c170 100644
--- a/erpnext/selling/doctype/quotation/quotation.py
+++ b/erpnext/selling/doctype/quotation/quotation.py
@@ -168,6 +168,48 @@
 
 	return doclist
 
+@frappe.whitelist()
+def make_sales_invoice(source_name, target_doc=None):
+	return _make_sales_invoice(source_name, target_doc)
+
+def _make_sales_invoice(source_name, target_doc=None, ignore_permissions=False):
+	customer = _make_customer(source_name, ignore_permissions)
+
+	def set_missing_values(source, target):
+		if customer:
+			target.customer = customer.name
+			target.customer_name = customer.customer_name
+		target.ignore_pricing_rule = 1
+		target.flags.ignore_permissions = ignore_permissions
+		target.run_method("set_missing_values")
+		target.run_method("calculate_taxes_and_totals")
+
+	def update_item(obj, target, source_parent):
+		target.stock_qty = flt(obj.qty) * flt(obj.conversion_factor)
+
+	doclist = get_mapped_doc("Quotation", source_name, {
+			"Quotation": {
+				"doctype": "Sales Invoice",
+				"validation": {
+					"docstatus": ["=", 1]
+				}
+			},
+			"Quotation Item": {
+				"doctype": "Sales Invoice Item",
+				"postprocess": update_item
+			},
+			"Sales Taxes and Charges": {
+				"doctype": "Sales Taxes and Charges",
+				"add_if_empty": True
+			},
+			"Sales Team": {
+				"doctype": "Sales Team",
+				"add_if_empty": True
+			}
+		}, target_doc, set_missing_values, ignore_permissions=ignore_permissions)
+
+	return doclist	
+
 def _make_customer(source_name, ignore_permissions=False):
 	quotation = frappe.db.get_value("Quotation", source_name, ["lead", "order_type", "customer"])
 	if quotation and quotation[0] and not quotation[2]:
diff --git a/erpnext/selling/doctype/quotation/tests/test_quotation_with_margin.js b/erpnext/selling/doctype/quotation/tests/test_quotation_with_margin.js
new file mode 100644
index 0000000..590a828
--- /dev/null
+++ b/erpnext/selling/doctype/quotation/tests/test_quotation_with_margin.js
@@ -0,0 +1,36 @@
+QUnit.module('Selling');
+
+QUnit.test("test quotation with margin", function(assert) {
+	assert.expect(3);
+	let done = assert.async();
+	frappe.run_serially([
+		() => {
+			return frappe.tests.make('Quotation', [
+				{customer: 'Test Customer 1'},
+				{selling_price_list: 'Test-Selling-USD'},
+				{currency: 'USD'},
+				{items: [
+					[
+						{'item_code': 'Test Product 3'},
+						{'delivery_date': frappe.datetime.add_days(frappe.defaults.get_default("year_end_date"), 1)},
+						{'qty': 1},
+						{'margin_type': 'Percentage'},
+						{'margin_rate_or_amount': 20}
+					]
+				]}
+			]);
+		},
+		() => cur_frm.save(),
+		() => {
+			assert.ok(cur_frm.doc.items[0].rate_with_margin == 240, "Margin rate correct");
+			assert.ok(cur_frm.doc.items[0].base_rate_with_margin == cur_frm.doc.conversion_rate * 240, "Base margin rate correct");
+			assert.ok(cur_frm.doc.total == 240, "Amount correct");
+
+		},
+		() => frappe.tests.click_button('Submit'),
+		() => frappe.tests.click_button('Yes'),
+		() => frappe.timeout(0.3),
+		() => done()
+	]);
+});
+
diff --git a/erpnext/selling/doctype/quotation_item/quotation_item.json b/erpnext/selling/doctype/quotation_item/quotation_item.json
index 3fc56fa..f2e89ca 100644
--- a/erpnext/selling/doctype/quotation_item/quotation_item.json
+++ b/erpnext/selling/doctype/quotation_item/quotation_item.json
@@ -714,6 +714,7 @@
    "label": "Rate With Margin", 
    "length": 0, 
    "no_copy": 0, 
+   "options": "currency", 
    "permlevel": 0, 
    "precision": "2", 
    "print_hide": 1, 
@@ -795,6 +796,38 @@
    "bold": 0, 
    "collapsible": 0, 
    "columns": 0, 
+   "depends_on": "eval:doc.margin_type && doc.price_list_rate && doc.margin_rate_or_amount", 
+   "fieldname": "base_rate_with_margin", 
+   "fieldtype": "Currency", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Rate With Margin (Company Currency)", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "Company:company:default_currency", 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 1, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 1, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "section_break1", 
    "fieldtype": "Section Break", 
    "hidden": 0, 
@@ -1583,7 +1616,7 @@
  "istable": 1, 
  "max_attachments": 0, 
  "menu_index": 0, 
- "modified": "2017-09-27 08:31:37.485134", 
+ "modified": "2017-11-03 11:29:59.995384", 
  "modified_by": "Administrator", 
  "module": "Selling", 
  "name": "Quotation Item", 
diff --git a/erpnext/selling/doctype/sales_order/sales_order.js b/erpnext/selling/doctype/sales_order/sales_order.js
index 6f70ebe..a5e0059 100644
--- a/erpnext/selling/doctype/sales_order/sales_order.js
+++ b/erpnext/selling/doctype/sales_order/sales_order.js
@@ -40,6 +40,10 @@
 			if(!d.delivery_date) d.delivery_date = frm.doc.delivery_date;
 		});
 		refresh_field("items");
+	},
+
+	onload_post_render: function(frm) {
+		frm.get_field("items").grid.set_multiple_add("item_code", "qty");
 	}
 });
 
@@ -193,7 +197,7 @@
 					});
 					return;
 				}
-				else if(!r.message.every(function(d) { return !!d.pending_qty })) {
+				else if(!r.message) {
 					frappe.msgprint({
 						title: __('Production Order not created'),
 						message: __('Production Order already created for all items with BOM'),
@@ -213,6 +217,8 @@
 									}},
 								{fieldtype:'Float', fieldname:'pending_qty', reqd: 1,
 									label: __('Qty'), in_list_view:1},
+								{fieldtype:'Data', fieldname:'sales_order_item', reqd: 1,
+									label: __('Sales Order Item'), hidden:1}
 							],
 							get_data: function() {
 								return r.message
diff --git a/erpnext/selling/doctype/sales_order/sales_order.json b/erpnext/selling/doctype/sales_order/sales_order.json
index 36f1284..3ea34b1 100644
--- a/erpnext/selling/doctype/sales_order/sales_order.json
+++ b/erpnext/selling/doctype/sales_order/sales_order.json
@@ -3406,7 +3406,7 @@
  "issingle": 0, 
  "istable": 0, 
  "max_attachments": 0, 
- "modified": "2017-10-24 12:52:28.115742", 
+ "modified": "2017-11-03 05:31:56.636424", 
  "modified_by": "Administrator", 
  "module": "Selling", 
  "name": "Sales Order", 
@@ -3543,5 +3543,5 @@
  "timeline_field": "customer", 
  "title_field": "title", 
  "track_changes": 1, 
- "track_seen": 0
+ "track_seen": 1
 }
\ No newline at end of file
diff --git a/erpnext/selling/doctype/sales_order/sales_order.py b/erpnext/selling/doctype/sales_order/sales_order.py
index 747a3c0..a70fad1 100644
--- a/erpnext/selling/doctype/sales_order/sales_order.py
+++ b/erpnext/selling/doctype/sales_order/sales_order.py
@@ -336,14 +336,16 @@
 				bom = get_default_bom_item(i.item_code)
 				if bom:
 					stock_qty = i.qty if i.doctype == 'Packed Item' else i.stock_qty
-					items.append(dict(
-						item_code= i.item_code,
-						bom = bom,
-						warehouse = i.warehouse,
-						pending_qty= stock_qty - flt(frappe.db.sql('''select sum(qty) from `tabProduction Order`
-							where production_item=%s and sales_order=%s''', (i.item_code, self.name))[0][0])
-					))
-
+					pending_qty= stock_qty - flt(frappe.db.sql('''select sum(qty) from `tabProduction Order`
+							where production_item=%s and sales_order=%s and sales_order_item = %s and docstatus<2''', (i.item_code, self.name, i.name))[0][0])
+					if pending_qty:
+						items.append(dict(
+							item_code= i.item_code,
+							bom = bom,
+							warehouse = i.warehouse,
+							pending_qty = pending_qty,
+							sales_order_item = i.name
+						))
 		return items
 
 	def on_recurring(self, reference_doc, subscription_doc):
@@ -769,6 +771,7 @@
 			qty=i['pending_qty'],
 			company=company,
 			sales_order=sales_order,
+			sales_order_item=i['sales_order_item'],
 			project=project,
 			fg_warehouse=i['warehouse']
 		)).insert()
diff --git a/erpnext/selling/doctype/sales_order/test_sales_order.py b/erpnext/selling/doctype/sales_order/test_sales_order.py
index 9c5c82e..da600fb 100644
--- a/erpnext/selling/doctype/sales_order/test_sales_order.py
+++ b/erpnext/selling/doctype/sales_order/test_sales_order.py
@@ -10,6 +10,8 @@
 	import make_material_request, make_delivery_note, make_sales_invoice, WarehouseRequired
 from erpnext.stock.doctype.stock_entry.stock_entry_utils import make_stock_entry
 from frappe.tests.test_permissions import set_user_permission_doctypes
+from erpnext.selling.doctype.sales_order.sales_order import make_production_orders
+import json
 
 class TestSalesOrder(unittest.TestCase):
 	def tearDown(self):
@@ -505,6 +507,40 @@
 
 		self.assertEquals(new_so.get("items")[0].rate, flt((price_list_rate*25)/100 + price_list_rate))
 
+	def test_make_production_order(self):
+		# Make a new Sales Order
+		so = make_sales_order(**{
+			"item_list": [{
+				"item_code": "_Test FG Item",
+				"qty": 10,
+				"rate":100	
+			},
+			{
+				"item_code": "_Test FG Item",
+				"qty": 20,
+				"rate":200	
+			}]
+		})
+
+		# Raise Production Orders
+		po_items= []
+		so_item_name= {}
+		for item in so.get_production_order_items():
+			po_items.append({
+				"warehouse": item.get("warehouse"),
+				"item_code": item.get("item_code"),
+				"pending_qty": item.get("pending_qty"),
+				"sales_order_item": item.get("sales_order_item"),
+				"bom": item.get("bom")
+			})
+			so_item_name[item.get("sales_order_item")]= item.get("pending_qty")
+		make_production_orders(json.dumps({"items":po_items}), so.name, so.company)
+		
+		# Check if Production Orders were raised
+		for item in so_item_name:
+			po_qty = frappe.db.sql("select sum(qty) from `tabProduction Order` where sales_order=%s and sales_order_item=%s", (so.name, item))
+			self.assertEquals(po_qty[0][0], so_item_name.get(item))
+
 def make_sales_order(**args):
 	so = frappe.new_doc("Sales Order")
 	args = frappe._dict(args)
diff --git a/erpnext/selling/doctype/sales_order/tests/test_sales_order_with_margin.js b/erpnext/selling/doctype/sales_order/tests/test_sales_order_with_margin.js
new file mode 100644
index 0000000..8575b78
--- /dev/null
+++ b/erpnext/selling/doctype/sales_order/tests/test_sales_order_with_margin.js
@@ -0,0 +1,38 @@
+QUnit.module('Selling');
+
+QUnit.test("test sales order with margin", function(assert) {
+	assert.expect(3);
+	let done = assert.async();
+	frappe.run_serially([
+		() => {
+			return frappe.tests.make('Sales Order', [
+				{customer:'Test Customer 1'},
+				{selling_price_list: 'Test-Selling-USD'},
+				{currency: 'USD'},
+				{items: [
+					[
+						{'item_code': 'Test Product 3'},
+						{'delivery_date': frappe.datetime.add_days(frappe.defaults.get_default("year_end_date"), 1)},
+						{'qty': 1},
+						{'margin_type': 'Amount'},
+						{'margin_rate_or_amount': 20}
+					]
+				]},
+			]);
+		},
+
+		() => cur_frm.save(),
+		() => {
+			// get_rate_details
+			assert.ok(cur_frm.doc.items[0].rate_with_margin == 220, "Margin rate correct");
+			assert.ok(cur_frm.doc.items[0].base_rate_with_margin == cur_frm.doc.conversion_rate * 220, "Base margin rate correct");
+			assert.ok(cur_frm.doc.total == 220, "Amount correct");
+		},
+
+		() => frappe.tests.click_button('Submit'),
+		() => frappe.tests.click_button('Yes'),
+		() => frappe.timeout(0.3),
+		() => done()
+	]);
+});
+
diff --git a/erpnext/selling/doctype/sales_order_item/sales_order_item.json b/erpnext/selling/doctype/sales_order_item/sales_order_item.json
index fd7b0f2..b772f51 100644
--- a/erpnext/selling/doctype/sales_order_item/sales_order_item.json
+++ b/erpnext/selling/doctype/sales_order_item/sales_order_item.json
@@ -744,6 +744,7 @@
    "label": "Rate With Margin", 
    "length": 0, 
    "no_copy": 0, 
+   "options": "currency", 
    "permlevel": 0, 
    "precision": "", 
    "print_hide": 1, 
@@ -825,6 +826,38 @@
    "bold": 0, 
    "collapsible": 0, 
    "columns": 0, 
+   "depends_on": "eval:doc.margin_type && doc.price_list_rate && doc.margin_rate_or_amount", 
+   "fieldname": "base_rate_with_margin", 
+   "fieldtype": "Currency", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Rate With Margin (Company Currency)", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "Company:company:default_currency", 
+   "permlevel": 0, 
+   "precision": "2", 
+   "print_hide": 1, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 1, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "section_break_simple1", 
    "fieldtype": "Section Break", 
    "hidden": 0, 
@@ -1963,7 +1996,7 @@
  "istable": 1, 
  "max_attachments": 0, 
  "menu_index": 0, 
- "modified": "2017-09-27 08:31:37.129537", 
+ "modified": "2017-11-03 11:33:48.453373", 
  "modified_by": "Administrator", 
  "module": "Selling", 
  "name": "Sales Order Item", 
diff --git a/erpnext/selling/page/point_of_sale/point_of_sale.js b/erpnext/selling/page/point_of_sale/point_of_sale.js
index adde913..8ecdf85 100644
--- a/erpnext/selling/page/point_of_sale/point_of_sale.js
+++ b/erpnext/selling/page/point_of_sale/point_of_sale.js
@@ -285,25 +285,67 @@
 	}
 
 	setup_pos_profile() {
+		return new Promise((resolve) => {
+
+			const load_default = () => {
+				this.pos_profile = {
+					company: this.company,
+					currency: frappe.defaults.get_default('currency'),
+					selling_price_list: frappe.defaults.get_default('selling_price_list')
+				};
+				resolve();
+			}
+
+			const on_submit = ({ pos_profile }) => {
+				this.get_pos_profile_doc(pos_profile)
+					.then(doc => {
+						this.pos_profile = doc;
+						if (!this.pos_profile) {
+							load_default();
+						}
+						resolve();
+					});
+			}
+
+			frappe.call({
+				method: 'erpnext.accounts.doctype.pos_profile.pos_profile.get_pos_profiles_for_user'
+			}).then((r) => {
+				if (r && r.message) {
+					const pos_profiles = r.message.filter(a => a);
+
+					if (pos_profiles.length === 0) {
+						load_default();
+					} else if(pos_profiles.length === 1) {
+						// load profile directly
+						on_submit({pos_profile: pos_profiles[0]});
+					} else {
+						// ask prompt
+						frappe.prompt(
+							[{ fieldtype: 'Select', label: 'POS Profile', options: pos_profiles }],
+							on_submit,
+							__('Select POS Profile')
+						);
+					}
+				} else {
+					frappe.dom.unfreeze();
+					frappe.throw(__("POS Profile is required to use Point-of-Sale"));
+				}
+			});
+		});
+	}
+
+	get_pos_profile_doc(pos_profile_name) {
 		return new Promise(resolve => {
 			frappe.call({
-				method: 'erpnext.stock.get_item_details.get_pos_profile',
+				method: 'erpnext.accounts.doctype.pos_profile.pos_profile.get_pos_profile',
 				args: {
-					company: this.company
+					pos_profile_name
+				},
+				callback: (r) => {
+					resolve(r.message);
 				}
-			}).then(r => {
-				this.pos_profile = r.message;
-
-				if (!this.pos_profile) {
-					this.pos_profile = {
-						company: this.company,
-						currency: frappe.defaults.get_default('currency'),
-						selling_price_list: frappe.defaults.get_default('selling_price_list')
-					};
-				}
-				resolve();
 			});
-		})
+		});
 	}
 
 	setup_company() {
diff --git a/erpnext/setup/doctype/item_group/item_group.py b/erpnext/setup/doctype/item_group/item_group.py
index 2766ba0..a4c377e 100644
--- a/erpnext/setup/doctype/item_group/item_group.py
+++ b/erpnext/setup/doctype/item_group/item_group.py
@@ -47,9 +47,6 @@
 
 			return self.route
 
-	def after_rename(self, olddn, newdn, merge=False):
-		NestedSet.after_rename(self, olddn, newdn, merge)
-
 	def on_trash(self):
 		NestedSet.on_trash(self)
 		WebsiteGenerator.on_trash(self)
diff --git a/erpnext/stock/dashboard/item_dashboard.js b/erpnext/stock/dashboard/item_dashboard.js
index 113a2ef..3c334c4 100644
--- a/erpnext/stock/dashboard/item_dashboard.js
+++ b/erpnext/stock/dashboard/item_dashboard.js
@@ -80,7 +80,7 @@
 			$(frappe.render_template('item_dashboard_list', context)).appendTo(this.result);
 		} else {
 			var message = __(" Currently no stock available in any warehouse")
-			$("<span class='small'> <i class='fa fa-exclamation-triangle' aria-hidden='true'></i>"+message+"</span>").appendTo(this.result);
+			$("<span class='text-muted small'>"+message+"</span>").appendTo(this.result);
 		}
 	},
 	get_item_dashboard_data: function(data, max_count, show_item) {
diff --git a/erpnext/stock/doctype/batch/batch.js b/erpnext/stock/doctype/batch/batch.js
index 1822a06..20581dc 100644
--- a/erpnext/stock/doctype/batch/batch.js
+++ b/erpnext/stock/doctype/batch/batch.js
@@ -24,6 +24,11 @@
 			frm.trigger('make_dashboard');
 		}
 	},
+	item: (frm) => {
+		frappe.db.get_value('Item', {name: frm.doc.item}, 'has_expiry_date', (r) => {
+			frm.toggle_reqd('expiry_date', r.has_expiry_date);
+		});
+	},
 	make_dashboard: (frm) => {
 		if(!frm.is_new()) {
 			frappe.call({
diff --git a/erpnext/stock/doctype/delivery_note/delivery_note.json b/erpnext/stock/doctype/delivery_note/delivery_note.json
index a41ae68..239891c 100644
--- a/erpnext/stock/doctype/delivery_note/delivery_note.json
+++ b/erpnext/stock/doctype/delivery_note/delivery_note.json
@@ -3610,7 +3610,7 @@
  "istable": 0, 
  "max_attachments": 0, 
  "menu_index": 0, 
- "modified": "2017-09-19 11:21:59.084183", 
+ "modified": "2017-11-03 05:31:56.636424", 
  "modified_by": "Administrator", 
  "module": "Stock", 
  "name": "Delivery Note", 
@@ -3727,5 +3727,5 @@
  "timeline_field": "customer", 
  "title_field": "title", 
  "track_changes": 1, 
- "track_seen": 0
+ "track_seen": 1
 }
\ No newline at end of file
diff --git a/erpnext/stock/doctype/delivery_note/test_delivery_note_with_margin.js b/erpnext/stock/doctype/delivery_note/test_delivery_note_with_margin.js
new file mode 100644
index 0000000..67c9f38
--- /dev/null
+++ b/erpnext/stock/doctype/delivery_note/test_delivery_note_with_margin.js
@@ -0,0 +1,37 @@
+QUnit.module('Stock');
+
+QUnit.test("test delivery note with margin", function(assert) {
+	assert.expect(3);
+	let done = assert.async();
+	frappe.run_serially([
+		() => {
+			return frappe.tests.make('Delivery Note', [
+				{customer:'Test Customer 1'},
+				{selling_price_list: 'Test-Selling-USD'},
+				{currency: 'USD'},
+				{items: [
+					[
+						{'item_code': 'Test Product 3'},
+						{'qty': 1},
+						{'margin_type': 'Amount'},
+						{'margin_rate_or_amount': 10}
+					]
+				]},
+			]);
+		},
+
+		() => cur_frm.save(),
+		() => {
+			// get_rate_details
+			assert.ok(cur_frm.doc.items[0].rate_with_margin == 210, "Margin rate correct");
+			assert.ok(cur_frm.doc.items[0].base_rate_with_margin == cur_frm.doc.conversion_rate * 210, "Base margin rate correct");
+			assert.ok(cur_frm.doc.total == 210, "Amount correct");
+		},
+
+		() => frappe.tests.click_button('Submit'),
+		() => frappe.tests.click_button('Yes'),
+		() => frappe.timeout(0.3),
+		() => done()
+	]);
+});
+
diff --git a/erpnext/stock/doctype/delivery_note_item/delivery_note_item.json b/erpnext/stock/doctype/delivery_note_item/delivery_note_item.json
index 4e1ea40..72f1dfd 100644
--- a/erpnext/stock/doctype/delivery_note_item/delivery_note_item.json
+++ b/erpnext/stock/doctype/delivery_note_item/delivery_note_item.json
@@ -743,6 +743,7 @@
    "label": "Rate With Margin", 
    "length": 0, 
    "no_copy": 0, 
+   "options": "currency", 
    "permlevel": 0, 
    "precision": "2", 
    "print_hide": 1, 
@@ -824,6 +825,38 @@
    "bold": 0, 
    "collapsible": 0, 
    "columns": 0, 
+   "depends_on": "eval:doc.margin_type && doc.price_list_rate && doc.margin_rate_or_amount", 
+   "fieldname": "base_rate_with_margin", 
+   "fieldtype": "Currency", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Rate With Margin (Company Currency)", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "Company:company:default_currency", 
+   "permlevel": 0, 
+   "precision": "2", 
+   "print_hide": 1, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 1, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "section_break_1", 
    "fieldtype": "Section Break", 
    "hidden": 0, 
@@ -1956,7 +1989,7 @@
  "issingle": 0, 
  "istable": 1, 
  "max_attachments": 0, 
- "modified": "2017-09-27 08:31:38.768846", 
+ "modified": "2017-11-03 11:32:04.837794", 
  "modified_by": "Administrator", 
  "module": "Stock", 
  "name": "Delivery Note Item", 
diff --git a/erpnext/stock/doctype/item/item.js b/erpnext/stock/doctype/item/item.js
index 6f3fce5..656ee69 100644
--- a/erpnext/stock/doctype/item/item.js
+++ b/erpnext/stock/doctype/item/item.js
@@ -74,19 +74,8 @@
 		}
 
 		erpnext.item.edit_prices_button(frm);
-
-		// make sensitive fields(has_serial_no, is_stock_item, valuation_method, has_batch_no)
-		// read only if any stock ledger entry exists
-		if (!frm.doc.__islocal && frm.doc.is_stock_item) {
-			frm.toggle_enable(['has_serial_no', 'is_stock_item', 'valuation_method', 'has_batch_no'],
-				(frm.doc.__onload && frm.doc.__onload.sle_exists=="exists") ? false : true);
-		}
-
 		erpnext.item.toggle_attributes(frm);
 
-		frm.toggle_enable("is_fixed_asset", (frm.doc.__islocal || (!frm.doc.is_stock_item &&
-			((frm.doc.__onload && frm.doc.__onload.asset_exists) ? false : true))));
-
 		frm.add_custom_button(__('Duplicate'), function() {
 			var new_item = frappe.model.copy_doc(frm.doc);
 			if(new_item.item_name===new_item.item_code) {
@@ -103,25 +92,18 @@
 				frappe.set_route("Form", "Item Variant Settings");
 			}, __("View"));
 		}
-
-		if(frm.doc.__onload && frm.doc.__onload.stock_exists) {
-			// Hide variants section if stock exists
-			frm.toggle_display("variants_section", 0);
-		}
 	},
 
 	validate: function(frm){
 		erpnext.item.weight_to_validate(frm);
 	},
 
-	image: function(frm) {
+	image: function() {
 		refresh_field("image_view");
 	},
 
 	is_fixed_asset: function(frm) {
-		if (frm.doc.is_fixed_asset) {
-			frm.set_value("is_stock_item", 0);
-		}
+		frm.set_value("is_stock_item", frm.doc.is_fixed_asset ? 0 : 1);
 	},
 
 	page_name: frappe.utils.warn_page_name_change,
@@ -469,5 +451,6 @@
 			// nothing to do with attributes, hide it
 			frm.toggle_display("attributes", false);
 		}
+		frm.layout.refresh_sections();
 	}
 });
diff --git a/erpnext/stock/doctype/item/item.json b/erpnext/stock/doctype/item/item.json
index fd85a50..bfb4c62 100644
--- a/erpnext/stock/doctype/item/item.json
+++ b/erpnext/stock/doctype/item/item.json
@@ -1,3509 +1,3540 @@
 {
- "allow_copy": 0,
- "allow_guest_to_view": 0,
- "allow_import": 1,
- "allow_rename": 1,
- "autoname": "field:item_code",
- "beta": 0,
- "creation": "2013-05-03 10:45:46",
- "custom": 0,
- "default_print_format": "",
- "description": "A Product or a Service that is bought, sold or kept in stock.",
- "docstatus": 0,
- "doctype": "DocType",
- "document_type": "Setup",
- "editable_grid": 1,
- "engine": "InnoDB",
+ "allow_copy": 0, 
+ "allow_guest_to_view": 0, 
+ "allow_import": 1, 
+ "allow_rename": 1, 
+ "autoname": "field:item_code", 
+ "beta": 0, 
+ "creation": "2013-05-03 10:45:46", 
+ "custom": 0, 
+ "default_print_format": "", 
+ "description": "A Product or a Service that is bought, sold or kept in stock.", 
+ "docstatus": 0, 
+ "doctype": "DocType", 
+ "document_type": "Setup", 
+ "editable_grid": 1, 
+ "engine": "InnoDB", 
  "fields": [
   {
-   "allow_bulk_edit": 0,
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "columns": 0,
-   "fieldname": "name_and_description_section",
-   "fieldtype": "Section Break",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "ignore_xss_filter": 0,
-   "in_filter": 0,
-   "in_global_search": 0,
-   "in_list_view": 0,
-   "in_standard_filter": 0,
-   "label": "",
-   "length": 0,
-   "no_copy": 0,
-   "oldfieldtype": "Section Break",
-   "options": "fa fa-flag",
-   "permlevel": 0,
-   "print_hide": 0,
-   "print_hide_if_no_value": 0,
-   "read_only": 0,
-   "remember_last_selected_value": 0,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 0,
-   "set_only_once": 0,
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "name_and_description_section", 
+   "fieldtype": "Section Break", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "", 
+   "length": 0, 
+   "no_copy": 0, 
+   "oldfieldtype": "Section Break", 
+   "options": "fa fa-flag", 
+   "permlevel": 0, 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
    "unique": 0
-  },
+  }, 
   {
-   "allow_bulk_edit": 0,
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "columns": 0,
-   "fieldname": "naming_series",
-   "fieldtype": "Select",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "ignore_xss_filter": 0,
-   "in_filter": 0,
-   "in_global_search": 0,
-   "in_list_view": 0,
-   "in_standard_filter": 0,
-   "label": "Series",
-   "length": 0,
-   "no_copy": 0,
-   "options": "ITEM-",
-   "permlevel": 0,
-   "print_hide": 0,
-   "print_hide_if_no_value": 0,
-   "read_only": 0,
-   "remember_last_selected_value": 0,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 0,
-   "set_only_once": 1,
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "naming_series", 
+   "fieldtype": "Select", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Series", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "ITEM-", 
+   "permlevel": 0, 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 1, 
    "unique": 0
-  },
+  }, 
   {
-   "allow_bulk_edit": 0,
-   "allow_on_submit": 0,
-   "bold": 1,
-   "collapsible": 0,
-   "columns": 0,
-   "description": "",
-   "fieldname": "item_code",
-   "fieldtype": "Data",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "ignore_xss_filter": 0,
-   "in_filter": 0,
-   "in_global_search": 1,
-   "in_list_view": 0,
-   "in_standard_filter": 0,
-   "label": "Item Code",
-   "length": 0,
-   "no_copy": 0,
-   "oldfieldname": "item_code",
-   "oldfieldtype": "Data",
-   "permlevel": 0,
-   "print_hide": 0,
-   "print_hide_if_no_value": 0,
-   "read_only": 0,
-   "remember_last_selected_value": 0,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 0,
-   "set_only_once": 0,
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 1, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "description": "", 
+   "fieldname": "item_code", 
+   "fieldtype": "Data", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 1, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Item Code", 
+   "length": 0, 
+   "no_copy": 0, 
+   "oldfieldname": "item_code", 
+   "oldfieldtype": "Data", 
+   "permlevel": 0, 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
    "unique": 0
-  },
+  }, 
   {
-   "allow_bulk_edit": 0,
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "columns": 0,
-   "depends_on": "variant_of",
-   "description": "If item is a variant of another item then description, image, pricing, taxes etc will be set from the template unless explicitly specified",
-   "fieldname": "variant_of",
-   "fieldtype": "Link",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "ignore_xss_filter": 0,
-   "in_filter": 0,
-   "in_global_search": 0,
-   "in_list_view": 0,
-   "in_standard_filter": 1,
-   "label": "Variant Of",
-   "length": 0,
-   "no_copy": 0,
-   "options": "Item",
-   "permlevel": 0,
-   "precision": "",
-   "print_hide": 0,
-   "print_hide_if_no_value": 0,
-   "read_only": 1,
-   "remember_last_selected_value": 0,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 0,
-   "set_only_once": 0,
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "depends_on": "variant_of", 
+   "description": "If item is a variant of another item then description, image, pricing, taxes etc will be set from the template unless explicitly specified", 
+   "fieldname": "variant_of", 
+   "fieldtype": "Link", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 1, 
+   "label": "Variant Of", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "Item", 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 1, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 1, 
    "unique": 0
-  },
+  }, 
   {
-   "allow_bulk_edit": 0,
-   "allow_on_submit": 0,
-   "bold": 1,
-   "collapsible": 0,
-   "columns": 0,
-   "fieldname": "item_name",
-   "fieldtype": "Data",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "ignore_xss_filter": 0,
-   "in_filter": 0,
-   "in_global_search": 1,
-   "in_list_view": 0,
-   "in_standard_filter": 0,
-   "label": "Item Name",
-   "length": 0,
-   "no_copy": 0,
-   "oldfieldname": "item_name",
-   "oldfieldtype": "Data",
-   "permlevel": 0,
-   "print_hide": 0,
-   "print_hide_if_no_value": 0,
-   "read_only": 0,
-   "remember_last_selected_value": 0,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 1,
-   "set_only_once": 0,
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 1, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "item_name", 
+   "fieldtype": "Data", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 1, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Item Name", 
+   "length": 0, 
+   "no_copy": 0, 
+   "oldfieldname": "item_name", 
+   "oldfieldtype": "Data", 
+   "permlevel": 0, 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 1, 
+   "set_only_once": 0, 
    "unique": 0
-  },
+  }, 
   {
-   "allow_bulk_edit": 0,
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "columns": 0,
-   "fieldname": "barcode",
-   "fieldtype": "Data",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "ignore_xss_filter": 0,
-   "in_filter": 0,
-   "in_global_search": 0,
-   "in_list_view": 0,
-   "in_standard_filter": 0,
-   "label": "Barcode",
-   "length": 0,
-   "no_copy": 1,
-   "permlevel": 0,
-   "print_hide": 0,
-   "print_hide_if_no_value": 0,
-   "read_only": 0,
-   "remember_last_selected_value": 0,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 0,
-   "set_only_once": 0,
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "barcode", 
+   "fieldtype": "Data", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Barcode", 
+   "length": 0, 
+   "no_copy": 1, 
+   "permlevel": 0, 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
    "unique": 0
-  },
+  }, 
   {
-   "allow_bulk_edit": 0,
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "columns": 0,
-   "description": "",
-   "fieldname": "item_group",
-   "fieldtype": "Link",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "ignore_xss_filter": 0,
-   "in_filter": 0,
-   "in_global_search": 0,
-   "in_list_view": 1,
-   "in_standard_filter": 1,
-   "label": "Item Group",
-   "length": 0,
-   "no_copy": 0,
-   "oldfieldname": "item_group",
-   "oldfieldtype": "Link",
-   "options": "Item Group",
-   "permlevel": 0,
-   "print_hide": 0,
-   "print_hide_if_no_value": 0,
-   "read_only": 0,
-   "remember_last_selected_value": 0,
-   "report_hide": 0,
-   "reqd": 1,
-   "search_index": 0,
-   "set_only_once": 0,
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "description": "", 
+   "fieldname": "item_group", 
+   "fieldtype": "Link", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 1, 
+   "in_standard_filter": 1, 
+   "label": "Item Group", 
+   "length": 0, 
+   "no_copy": 0, 
+   "oldfieldname": "item_group", 
+   "oldfieldtype": "Link", 
+   "options": "Item Group", 
+   "permlevel": 0, 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 1, 
+   "search_index": 0, 
+   "set_only_once": 0, 
    "unique": 0
-  },
+  }, 
   {
-   "allow_bulk_edit": 0,
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "columns": 0,
-   "fieldname": "is_item_from_hub",
-   "fieldtype": "Check",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "ignore_xss_filter": 0,
-   "in_filter": 0,
-   "in_global_search": 0,
-   "in_list_view": 0,
-   "in_standard_filter": 0,
-   "label": "Is Item from Hub",
-   "length": 0,
-   "no_copy": 0,
-   "permlevel": 0,
-   "precision": "",
-   "print_hide": 0,
-   "print_hide_if_no_value": 0,
-   "read_only": 1,
-   "remember_last_selected_value": 0,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 0,
-   "set_only_once": 0,
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "is_item_from_hub", 
+   "fieldtype": "Check", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Is Item from Hub", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 1, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
    "unique": 0
-  },
+  }, 
   {
-   "allow_bulk_edit": 0,
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "columns": 0,
-   "description": "",
-   "fieldname": "stock_uom",
-   "fieldtype": "Link",
-   "hidden": 0,
-   "ignore_user_permissions": 1,
-   "ignore_xss_filter": 0,
-   "in_filter": 0,
-   "in_global_search": 0,
-   "in_list_view": 0,
-   "in_standard_filter": 0,
-   "label": "Default Unit of Measure",
-   "length": 0,
-   "no_copy": 0,
-   "oldfieldname": "stock_uom",
-   "oldfieldtype": "Link",
-   "options": "UOM",
-   "permlevel": 0,
-   "print_hide": 0,
-   "print_hide_if_no_value": 0,
-   "read_only": 0,
-   "remember_last_selected_value": 0,
-   "report_hide": 0,
-   "reqd": 1,
-   "search_index": 0,
-   "set_only_once": 0,
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "description": "", 
+   "fieldname": "stock_uom", 
+   "fieldtype": "Link", 
+   "hidden": 0, 
+   "ignore_user_permissions": 1, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Default Unit of Measure", 
+   "length": 0, 
+   "no_copy": 0, 
+   "oldfieldname": "stock_uom", 
+   "oldfieldtype": "Link", 
+   "options": "UOM", 
+   "permlevel": 0, 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 1, 
+   "search_index": 0, 
+   "set_only_once": 0, 
    "unique": 0
-  },
+  }, 
   {
-   "allow_bulk_edit": 0,
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "columns": 0,
-   "fieldname": "column_break0",
-   "fieldtype": "Column Break",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "ignore_xss_filter": 0,
-   "in_filter": 0,
-   "in_global_search": 0,
-   "in_list_view": 0,
-   "in_standard_filter": 0,
-   "length": 0,
-   "no_copy": 0,
-   "permlevel": 0,
-   "print_hide": 0,
-   "print_hide_if_no_value": 0,
-   "read_only": 0,
-   "remember_last_selected_value": 0,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 0,
-   "set_only_once": 0,
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "column_break0", 
+   "fieldtype": "Column Break", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
    "unique": 0
-  },
+  }, 
   {
-   "allow_bulk_edit": 0,
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "columns": 0,
-   "fieldname": "disabled",
-   "fieldtype": "Check",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "ignore_xss_filter": 0,
-   "in_filter": 0,
-   "in_global_search": 0,
-   "in_list_view": 0,
-   "in_standard_filter": 0,
-   "label": "Disabled",
-   "length": 0,
-   "no_copy": 0,
-   "permlevel": 0,
-   "precision": "",
-   "print_hide": 0,
-   "print_hide_if_no_value": 0,
-   "read_only": 0,
-   "remember_last_selected_value": 0,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 0,
-   "set_only_once": 0,
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "disabled", 
+   "fieldtype": "Check", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Disabled", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
    "unique": 0
-  },
+  }, 
   {
-   "allow_bulk_edit": 0,
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "columns": 0,
-   "default": "1",
-   "description": "",
-   "fieldname": "is_stock_item",
-   "fieldtype": "Check",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "ignore_xss_filter": 0,
-   "in_filter": 0,
-   "in_global_search": 0,
-   "in_list_view": 0,
-   "in_standard_filter": 0,
-   "label": "Maintain Stock",
-   "length": 0,
-   "no_copy": 0,
-   "oldfieldname": "is_stock_item",
-   "oldfieldtype": "Select",
-   "options": "",
-   "permlevel": 0,
-   "print_hide": 0,
-   "print_hide_if_no_value": 0,
-   "read_only": 0,
-   "remember_last_selected_value": 0,
-   "report_hide": 0,
-   "reqd": 1,
-   "search_index": 0,
-   "set_only_once": 0,
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 1, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "default": "1", 
+   "description": "", 
+   "fieldname": "is_stock_item", 
+   "fieldtype": "Check", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Maintain Stock", 
+   "length": 0, 
+   "no_copy": 0, 
+   "oldfieldname": "is_stock_item", 
+   "oldfieldtype": "Select", 
+   "options": "", 
+   "permlevel": 0, 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 1, 
    "unique": 0
-  },
+  }, 
   {
-   "allow_bulk_edit": 0,
-   "allow_on_submit": 0,
-   "bold": 1,
-   "collapsible": 0,
-   "columns": 0,
-   "depends_on": "eval:(doc.__islocal&&doc.is_stock_item && !doc.has_serial_no && !doc.has_batch_no)",
-   "fieldname": "opening_stock",
-   "fieldtype": "Float",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "ignore_xss_filter": 0,
-   "in_filter": 0,
-   "in_global_search": 0,
-   "in_list_view": 0,
-   "in_standard_filter": 0,
-   "label": "Opening Stock",
-   "length": 0,
-   "no_copy": 0,
-   "permlevel": 0,
-   "precision": "",
-   "print_hide": 0,
-   "print_hide_if_no_value": 0,
-   "read_only": 0,
-   "remember_last_selected_value": 0,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 0,
-   "set_only_once": 0,
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 1, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "depends_on": "eval:(doc.__islocal&&doc.is_stock_item && !doc.has_serial_no && !doc.has_batch_no)", 
+   "fieldname": "opening_stock", 
+   "fieldtype": "Float", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Opening Stock", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
    "unique": 0
-  },
+  }, 
   {
-   "allow_bulk_edit": 0,
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "columns": 0,
-   "depends_on": "eval:(doc.is_stock_item && !doc.has_serial_no && !doc.has_batch_no)",
-   "fieldname": "valuation_rate",
-   "fieldtype": "Currency",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "ignore_xss_filter": 0,
-   "in_filter": 0,
-   "in_global_search": 0,
-   "in_list_view": 0,
-   "in_standard_filter": 0,
-   "label": "Valuation Rate",
-   "length": 0,
-   "no_copy": 0,
-   "permlevel": 0,
-   "precision": "",
-   "print_hide": 0,
-   "print_hide_if_no_value": 0,
-   "read_only": 0,
-   "remember_last_selected_value": 0,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 0,
-   "set_only_once": 0,
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "depends_on": "eval:(doc.is_stock_item && !doc.has_serial_no && !doc.has_batch_no)", 
+   "fieldname": "valuation_rate", 
+   "fieldtype": "Currency", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Valuation Rate", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
    "unique": 0
-  },
+  }, 
   {
-   "allow_bulk_edit": 0,
-   "allow_on_submit": 0,
-   "bold": 1,
-   "collapsible": 0,
-   "columns": 0,
-   "fieldname": "standard_rate",
-   "fieldtype": "Currency",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "ignore_xss_filter": 0,
-   "in_filter": 0,
-   "in_global_search": 0,
-   "in_list_view": 0,
-   "in_standard_filter": 0,
-   "label": "Standard Selling Rate",
-   "length": 0,
-   "no_copy": 0,
-   "permlevel": 0,
-   "precision": "",
-   "print_hide": 0,
-   "print_hide_if_no_value": 0,
-   "read_only": 0,
-   "remember_last_selected_value": 0,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 0,
-   "set_only_once": 0,
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 1, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "standard_rate", 
+   "fieldtype": "Currency", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Standard Selling Rate", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
    "unique": 0
-  },
+  }, 
   {
-   "allow_bulk_edit": 0,
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "columns": 0,
-   "fieldname": "is_fixed_asset",
-   "fieldtype": "Check",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "ignore_xss_filter": 0,
-   "in_filter": 0,
-   "in_global_search": 0,
-   "in_list_view": 0,
-   "in_standard_filter": 0,
-   "label": "Is Fixed Asset",
-   "length": 0,
-   "no_copy": 0,
-   "permlevel": 0,
-   "precision": "",
-   "print_hide": 0,
-   "print_hide_if_no_value": 0,
-   "read_only": 0,
-   "remember_last_selected_value": 0,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 0,
-   "set_only_once": 0,
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "is_fixed_asset", 
+   "fieldtype": "Check", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Is Fixed Asset", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 1, 
    "unique": 0
-  },
+  }, 
   {
-   "allow_bulk_edit": 0,
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "columns": 0,
-   "depends_on": "is_fixed_asset",
-   "fieldname": "asset_category",
-   "fieldtype": "Link",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "ignore_xss_filter": 0,
-   "in_filter": 0,
-   "in_global_search": 0,
-   "in_list_view": 0,
-   "in_standard_filter": 0,
-   "label": "Asset Category",
-   "length": 0,
-   "no_copy": 0,
-   "options": "Asset Category",
-   "permlevel": 0,
-   "precision": "",
-   "print_hide": 0,
-   "print_hide_if_no_value": 0,
-   "read_only": 0,
-   "remember_last_selected_value": 0,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 0,
-   "set_only_once": 0,
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "depends_on": "is_fixed_asset", 
+   "fieldname": "asset_category", 
+   "fieldtype": "Link", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Asset Category", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "Asset Category", 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
    "unique": 0
-  },
+  }, 
   {
-   "allow_bulk_edit": 0,
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "columns": 0,
-   "depends_on": "eval:!doc.__islocal",
-   "description": "",
-   "fieldname": "tolerance",
-   "fieldtype": "Float",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "ignore_xss_filter": 0,
-   "in_filter": 0,
-   "in_global_search": 0,
-   "in_list_view": 0,
-   "in_standard_filter": 0,
-   "label": "Allow over delivery or receipt upto this percent",
-   "length": 0,
-   "no_copy": 0,
-   "oldfieldname": "tolerance",
-   "oldfieldtype": "Currency",
-   "permlevel": 0,
-   "print_hide": 0,
-   "print_hide_if_no_value": 0,
-   "read_only": 0,
-   "remember_last_selected_value": 0,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 0,
-   "set_only_once": 0,
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "depends_on": "eval:!doc.__islocal", 
+   "description": "", 
+   "fieldname": "tolerance", 
+   "fieldtype": "Float", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Allow over delivery or receipt upto this percent", 
+   "length": 0, 
+   "no_copy": 0, 
+   "oldfieldname": "tolerance", 
+   "oldfieldtype": "Currency", 
+   "permlevel": 0, 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
    "unique": 0
-  },
+  }, 
   {
-   "allow_bulk_edit": 0,
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "columns": 0,
-   "fieldname": "image",
-   "fieldtype": "Attach Image",
-   "hidden": 1,
-   "ignore_user_permissions": 0,
-   "ignore_xss_filter": 0,
-   "in_filter": 0,
-   "in_global_search": 0,
-   "in_list_view": 0,
-   "in_standard_filter": 0,
-   "label": "Image",
-   "length": 0,
-   "no_copy": 0,
-   "options": "image",
-   "permlevel": 0,
-   "precision": "",
-   "print_hide": 1,
-   "print_hide_if_no_value": 0,
-   "read_only": 0,
-   "remember_last_selected_value": 0,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 0,
-   "set_only_once": 0,
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "image", 
+   "fieldtype": "Attach Image", 
+   "hidden": 1, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Image", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "image", 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 1, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
    "unique": 0
-  },
+  }, 
   {
-   "allow_bulk_edit": 0,
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 1,
-   "columns": 0,
-   "fieldname": "section_break_11",
-   "fieldtype": "Section Break",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "ignore_xss_filter": 0,
-   "in_filter": 0,
-   "in_global_search": 0,
-   "in_list_view": 0,
-   "in_standard_filter": 0,
-   "label": "Description",
-   "length": 0,
-   "no_copy": 0,
-   "permlevel": 0,
-   "precision": "",
-   "print_hide": 0,
-   "print_hide_if_no_value": 0,
-   "read_only": 0,
-   "remember_last_selected_value": 0,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 0,
-   "set_only_once": 0,
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 1, 
+   "columns": 0, 
+   "fieldname": "section_break_11", 
+   "fieldtype": "Section Break", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Description", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
    "unique": 0
-  },
+  }, 
   {
-   "allow_bulk_edit": 0,
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "columns": 0,
-   "fieldname": "brand",
-   "fieldtype": "Link",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "ignore_xss_filter": 0,
-   "in_filter": 0,
-   "in_global_search": 0,
-   "in_list_view": 0,
-   "in_standard_filter": 0,
-   "label": "Brand",
-   "length": 0,
-   "no_copy": 0,
-   "oldfieldname": "brand",
-   "oldfieldtype": "Link",
-   "options": "Brand",
-   "permlevel": 0,
-   "print_hide": 1,
-   "print_hide_if_no_value": 0,
-   "read_only": 0,
-   "remember_last_selected_value": 0,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 0,
-   "set_only_once": 0,
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "brand", 
+   "fieldtype": "Link", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Brand", 
+   "length": 0, 
+   "no_copy": 0, 
+   "oldfieldname": "brand", 
+   "oldfieldtype": "Link", 
+   "options": "Brand", 
+   "permlevel": 0, 
+   "print_hide": 1, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
    "unique": 0
-  },
+  }, 
   {
-   "allow_bulk_edit": 0,
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "columns": 0,
-   "fieldname": "description",
-   "fieldtype": "Text Editor",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "ignore_xss_filter": 0,
-   "in_filter": 0,
-   "in_global_search": 0,
-   "in_list_view": 0,
-   "in_standard_filter": 0,
-   "label": "Description",
-   "length": 0,
-   "no_copy": 0,
-   "oldfieldname": "description",
-   "oldfieldtype": "Text",
-   "permlevel": 0,
-   "print_hide": 0,
-   "print_hide_if_no_value": 0,
-   "read_only": 0,
-   "remember_last_selected_value": 0,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 0,
-   "set_only_once": 0,
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "description", 
+   "fieldtype": "Text Editor", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Description", 
+   "length": 0, 
+   "no_copy": 0, 
+   "oldfieldname": "description", 
+   "oldfieldtype": "Text", 
+   "permlevel": 0, 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
    "unique": 0
-  },
+  }, 
   {
-   "allow_bulk_edit": 0,
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 1,
-   "collapsible_depends_on": "is_stock_item",
-   "columns": 0,
-   "depends_on": "is_stock_item",
-   "fieldname": "inventory",
-   "fieldtype": "Section Break",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "ignore_xss_filter": 0,
-   "in_filter": 0,
-   "in_global_search": 0,
-   "in_list_view": 0,
-   "in_standard_filter": 0,
-   "label": "Inventory",
-   "length": 0,
-   "no_copy": 0,
-   "oldfieldtype": "Section Break",
-   "options": "fa fa-truck",
-   "permlevel": 0,
-   "print_hide": 0,
-   "print_hide_if_no_value": 0,
-   "read_only": 0,
-   "remember_last_selected_value": 0,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 0,
-   "set_only_once": 0,
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 1, 
+   "collapsible_depends_on": "is_stock_item", 
+   "columns": 0, 
+   "depends_on": "is_stock_item", 
+   "fieldname": "inventory", 
+   "fieldtype": "Section Break", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Inventory", 
+   "length": 0, 
+   "no_copy": 0, 
+   "oldfieldtype": "Section Break", 
+   "options": "fa fa-truck", 
+   "permlevel": 0, 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
    "unique": 0
-  },
+  }, 
   {
-   "allow_bulk_edit": 0,
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "columns": 0,
-   "depends_on": "is_stock_item",
-   "description": "",
-   "fieldname": "default_warehouse",
-   "fieldtype": "Link",
-   "hidden": 0,
-   "ignore_user_permissions": 1,
-   "ignore_xss_filter": 0,
-   "in_filter": 0,
-   "in_global_search": 0,
-   "in_list_view": 0,
-   "in_standard_filter": 0,
-   "label": "Default Warehouse",
-   "length": 0,
-   "no_copy": 0,
-   "oldfieldname": "default_warehouse",
-   "oldfieldtype": "Link",
-   "options": "Warehouse",
-   "permlevel": 0,
-   "print_hide": 0,
-   "print_hide_if_no_value": 0,
-   "read_only": 0,
-   "remember_last_selected_value": 0,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 0,
-   "set_only_once": 0,
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "depends_on": "is_stock_item", 
+   "description": "", 
+   "fieldname": "default_warehouse", 
+   "fieldtype": "Link", 
+   "hidden": 0, 
+   "ignore_user_permissions": 1, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Default Warehouse", 
+   "length": 0, 
+   "no_copy": 0, 
+   "oldfieldname": "default_warehouse", 
+   "oldfieldtype": "Link", 
+   "options": "Warehouse", 
+   "permlevel": 0, 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
    "unique": 0
-  },
+  }, 
   {
-   "allow_bulk_edit": 0,
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "columns": 0,
-   "default": "2099-12-31",
-   "depends_on": "is_stock_item",
-   "fieldname": "end_of_life",
-   "fieldtype": "Date",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "ignore_xss_filter": 0,
-   "in_filter": 0,
-   "in_global_search": 0,
-   "in_list_view": 0,
-   "in_standard_filter": 0,
-   "label": "End of Life",
-   "length": 0,
-   "no_copy": 0,
-   "oldfieldname": "end_of_life",
-   "oldfieldtype": "Date",
-   "permlevel": 0,
-   "print_hide": 0,
-   "print_hide_if_no_value": 0,
-   "read_only": 0,
-   "remember_last_selected_value": 0,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 0,
-   "set_only_once": 0,
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "default": "2099-12-31", 
+   "depends_on": "is_stock_item", 
+   "fieldname": "end_of_life", 
+   "fieldtype": "Date", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "End of Life", 
+   "length": 0, 
+   "no_copy": 0, 
+   "oldfieldname": "end_of_life", 
+   "oldfieldtype": "Date", 
+   "permlevel": 0, 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
    "unique": 0
-  },
+  }, 
   {
-   "allow_bulk_edit": 0,
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "columns": 0,
-   "default": "Purchase",
-   "fieldname": "default_material_request_type",
-   "fieldtype": "Select",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "ignore_xss_filter": 0,
-   "in_filter": 0,
-   "in_global_search": 0,
-   "in_list_view": 0,
-   "in_standard_filter": 0,
-   "label": "Default Material Request Type",
-   "length": 0,
-   "no_copy": 0,
-   "options": "Purchase\nMaterial Transfer\nMaterial Issue\nManufacture",
-   "permlevel": 0,
-   "precision": "",
-   "print_hide": 0,
-   "print_hide_if_no_value": 0,
-   "read_only": 0,
-   "remember_last_selected_value": 0,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 0,
-   "set_only_once": 0,
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "default": "Purchase", 
+   "fieldname": "default_material_request_type", 
+   "fieldtype": "Select", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Default Material Request Type", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "Purchase\nMaterial Transfer\nMaterial Issue\nManufacture", 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
    "unique": 0
-  },
+  }, 
   {
-   "allow_bulk_edit": 0,
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "columns": 0,
-   "depends_on": "is_stock_item",
-   "fieldname": "column_break1",
-   "fieldtype": "Column Break",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "ignore_xss_filter": 0,
-   "in_filter": 0,
-   "in_global_search": 0,
-   "in_list_view": 0,
-   "in_standard_filter": 0,
-   "length": 0,
-   "no_copy": 0,
-   "oldfieldtype": "Column Break",
-   "permlevel": 0,
-   "print_hide": 0,
-   "print_hide_if_no_value": 0,
-   "read_only": 0,
-   "remember_last_selected_value": 0,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 0,
-   "set_only_once": 0,
-   "unique": 0,
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "depends_on": "is_stock_item", 
+   "fieldname": "column_break1", 
+   "fieldtype": "Column Break", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "length": 0, 
+   "no_copy": 0, 
+   "oldfieldtype": "Column Break", 
+   "permlevel": 0, 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0, 
    "width": "50%"
-  },
+  }, 
   {
-   "allow_bulk_edit": 0,
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "columns": 0,
-   "depends_on": "is_stock_item",
-   "fieldname": "valuation_method",
-   "fieldtype": "Select",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "ignore_xss_filter": 0,
-   "in_filter": 0,
-   "in_global_search": 0,
-   "in_list_view": 0,
-   "in_standard_filter": 0,
-   "label": "Valuation Method",
-   "length": 0,
-   "no_copy": 0,
-   "options": "\nFIFO\nMoving Average",
-   "permlevel": 0,
-   "print_hide": 0,
-   "print_hide_if_no_value": 0,
-   "read_only": 0,
-   "remember_last_selected_value": 0,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 0,
-   "set_only_once": 0,
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "depends_on": "is_stock_item", 
+   "fieldname": "valuation_method", 
+   "fieldtype": "Select", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Valuation Method", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "\nFIFO\nMoving Average", 
+   "permlevel": 0, 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 1, 
    "unique": 0
-  },
+  }, 
   {
-   "allow_bulk_edit": 0,
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "columns": 0,
-   "depends_on": "eval:doc.is_stock_item",
-   "fieldname": "warranty_period",
-   "fieldtype": "Data",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "ignore_xss_filter": 0,
-   "in_filter": 0,
-   "in_global_search": 0,
-   "in_list_view": 0,
-   "in_standard_filter": 0,
-   "label": "Warranty Period (in days)",
-   "length": 0,
-   "no_copy": 0,
-   "oldfieldname": "warranty_period",
-   "oldfieldtype": "Data",
-   "permlevel": 0,
-   "print_hide": 0,
-   "print_hide_if_no_value": 0,
-   "read_only": 0,
-   "remember_last_selected_value": 0,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 0,
-   "set_only_once": 0,
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "depends_on": "eval:doc.is_stock_item", 
+   "fieldname": "warranty_period", 
+   "fieldtype": "Data", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Warranty Period (in days)", 
+   "length": 0, 
+   "no_copy": 0, 
+   "oldfieldname": "warranty_period", 
+   "oldfieldtype": "Data", 
+   "permlevel": 0, 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
    "unique": 0
-  },
+  }, 
   {
-   "allow_bulk_edit": 0,
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "columns": 0,
-   "depends_on": "is_stock_item",
-   "description": "",
-   "fieldname": "net_weight",
-   "fieldtype": "Float",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "ignore_xss_filter": 0,
-   "in_filter": 0,
-   "in_global_search": 0,
-   "in_list_view": 0,
-   "in_standard_filter": 0,
-   "label": "Net Weight",
-   "length": 0,
-   "no_copy": 0,
-   "permlevel": 0,
-   "print_hide": 0,
-   "print_hide_if_no_value": 0,
-   "read_only": 0,
-   "remember_last_selected_value": 0,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 0,
-   "set_only_once": 0,
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "depends_on": "is_stock_item", 
+   "description": "", 
+   "fieldname": "net_weight", 
+   "fieldtype": "Float", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Net Weight", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
    "unique": 0
-  },
+  }, 
   {
-   "allow_bulk_edit": 0,
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "columns": 0,
-   "depends_on": "eval:doc.is_stock_item",
-   "fieldname": "weight_uom",
-   "fieldtype": "Link",
-   "hidden": 0,
-   "ignore_user_permissions": 1,
-   "ignore_xss_filter": 0,
-   "in_filter": 0,
-   "in_global_search": 0,
-   "in_list_view": 0,
-   "in_standard_filter": 0,
-   "label": "Weight UOM",
-   "length": 0,
-   "no_copy": 0,
-   "options": "UOM",
-   "permlevel": 0,
-   "print_hide": 0,
-   "print_hide_if_no_value": 0,
-   "read_only": 0,
-   "remember_last_selected_value": 0,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 0,
-   "set_only_once": 0,
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "depends_on": "eval:doc.is_stock_item", 
+   "fieldname": "weight_uom", 
+   "fieldtype": "Link", 
+   "hidden": 0, 
+   "ignore_user_permissions": 1, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Weight UOM", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "UOM", 
+   "permlevel": 0, 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
    "unique": 0
-  },
+  }, 
   {
-   "allow_bulk_edit": 0,
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 1,
-   "columns": 0,
-   "depends_on": "is_stock_item",
-   "description": "",
-   "fieldname": "reorder_section",
-   "fieldtype": "Section Break",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "ignore_xss_filter": 0,
-   "in_filter": 0,
-   "in_global_search": 0,
-   "in_list_view": 0,
-   "in_standard_filter": 0,
-   "label": "Auto re-order",
-   "length": 0,
-   "no_copy": 0,
-   "options": "fa fa-rss",
-   "permlevel": 0,
-   "print_hide": 0,
-   "print_hide_if_no_value": 0,
-   "read_only": 0,
-   "remember_last_selected_value": 0,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 0,
-   "set_only_once": 0,
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 1, 
+   "columns": 0, 
+   "depends_on": "is_stock_item", 
+   "description": "", 
+   "fieldname": "reorder_section", 
+   "fieldtype": "Section Break", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Auto re-order", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "fa fa-rss", 
+   "permlevel": 0, 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
    "unique": 0
-  },
+  }, 
   {
-   "allow_bulk_edit": 0,
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "columns": 0,
-   "depends_on": "",
-   "description": "Will also apply for variants unless overrridden",
-   "fieldname": "reorder_levels",
-   "fieldtype": "Table",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "ignore_xss_filter": 0,
-   "in_filter": 0,
-   "in_global_search": 0,
-   "in_list_view": 0,
-   "in_standard_filter": 0,
-   "label": "Reorder level based on Warehouse",
-   "length": 0,
-   "no_copy": 0,
-   "options": "Item Reorder",
-   "permlevel": 0,
-   "print_hide": 0,
-   "print_hide_if_no_value": 0,
-   "read_only": 0,
-   "remember_last_selected_value": 0,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 0,
-   "set_only_once": 0,
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "depends_on": "", 
+   "description": "Will also apply for variants unless overrridden", 
+   "fieldname": "reorder_levels", 
+   "fieldtype": "Table", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Reorder level based on Warehouse", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "Item Reorder", 
+   "permlevel": 0, 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
    "unique": 0
-  },
+  }, 
   {
-   "allow_bulk_edit": 0,
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 1,
-   "columns": 0,
-   "depends_on": "",
-   "fieldname": "unit_of_measure_conversion",
-   "fieldtype": "Section Break",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "ignore_xss_filter": 0,
-   "in_filter": 0,
-   "in_global_search": 0,
-   "in_list_view": 0,
-   "in_standard_filter": 0,
-   "label": "Units of Measure",
-   "length": 0,
-   "no_copy": 0,
-   "permlevel": 0,
-   "precision": "",
-   "print_hide": 0,
-   "print_hide_if_no_value": 0,
-   "read_only": 0,
-   "remember_last_selected_value": 0,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 0,
-   "set_only_once": 0,
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 1, 
+   "columns": 0, 
+   "depends_on": "", 
+   "fieldname": "unit_of_measure_conversion", 
+   "fieldtype": "Section Break", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Units of Measure", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
    "unique": 0
-  },
+  }, 
   {
-   "allow_bulk_edit": 0,
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "columns": 0,
-   "depends_on": "",
-   "description": "Will also apply for variants",
-   "fieldname": "uoms",
-   "fieldtype": "Table",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "ignore_xss_filter": 0,
-   "in_filter": 0,
-   "in_global_search": 0,
-   "in_list_view": 0,
-   "in_standard_filter": 0,
-   "label": "UOMs",
-   "length": 0,
-   "no_copy": 0,
-   "oldfieldname": "uom_conversion_details",
-   "oldfieldtype": "Table",
-   "options": "UOM Conversion Detail",
-   "permlevel": 0,
-   "print_hide": 0,
-   "print_hide_if_no_value": 0,
-   "read_only": 0,
-   "remember_last_selected_value": 0,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 0,
-   "set_only_once": 0,
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "depends_on": "", 
+   "description": "Will also apply for variants", 
+   "fieldname": "uoms", 
+   "fieldtype": "Table", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "UOMs", 
+   "length": 0, 
+   "no_copy": 0, 
+   "oldfieldname": "uom_conversion_details", 
+   "oldfieldtype": "Table", 
+   "options": "UOM Conversion Detail", 
+   "permlevel": 0, 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
    "unique": 0
-  },
+  }, 
   {
-   "allow_bulk_edit": 0,
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 1,
-   "collapsible_depends_on": "eval:doc.has_batch_no || doc.has_serial_no",
-   "columns": 0,
-   "depends_on": "is_stock_item",
-   "fieldname": "serial_nos_and_batches",
-   "fieldtype": "Section Break",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "ignore_xss_filter": 0,
-   "in_filter": 0,
-   "in_global_search": 0,
-   "in_list_view": 0,
-   "in_standard_filter": 0,
-   "label": "Serial Nos and Batches",
-   "length": 0,
-   "no_copy": 0,
-   "permlevel": 0,
-   "precision": "",
-   "print_hide": 0,
-   "print_hide_if_no_value": 0,
-   "read_only": 0,
-   "remember_last_selected_value": 0,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 0,
-   "set_only_once": 0,
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 1, 
+   "collapsible_depends_on": "eval:doc.has_batch_no || doc.has_serial_no", 
+   "columns": 0, 
+   "depends_on": "is_stock_item", 
+   "fieldname": "serial_nos_and_batches", 
+   "fieldtype": "Section Break", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Serial Nos and Batches", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
    "unique": 0
-  },
+  }, 
   {
-   "allow_bulk_edit": 0,
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "columns": 0,
-   "default": "",
-   "depends_on": "eval:doc.is_stock_item",
-   "fieldname": "has_batch_no",
-   "fieldtype": "Check",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "ignore_xss_filter": 0,
-   "in_filter": 0,
-   "in_global_search": 0,
-   "in_list_view": 0,
-   "in_standard_filter": 0,
-   "label": "Has Batch No",
-   "length": 0,
-   "no_copy": 1,
-   "oldfieldname": "has_batch_no",
-   "oldfieldtype": "Select",
-   "options": "",
-   "permlevel": 0,
-   "print_hide": 0,
-   "print_hide_if_no_value": 0,
-   "read_only": 0,
-   "remember_last_selected_value": 0,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 0,
-   "set_only_once": 0,
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "default": "", 
+   "depends_on": "eval:doc.is_stock_item", 
+   "fieldname": "has_batch_no", 
+   "fieldtype": "Check", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Has Batch No", 
+   "length": 0, 
+   "no_copy": 1, 
+   "oldfieldname": "has_batch_no", 
+   "oldfieldtype": "Select", 
+   "options": "", 
+   "permlevel": 0, 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 1, 
    "unique": 0
-  },
+  }, 
   {
-   "allow_bulk_edit": 0,
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "columns": 0,
-   "depends_on": "has_batch_no",
-   "description": "",
-   "fieldname": "create_new_batch",
-   "fieldtype": "Check",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "ignore_xss_filter": 0,
-   "in_filter": 0,
-   "in_global_search": 0,
-   "in_list_view": 0,
-   "in_standard_filter": 0,
-   "label": "Automatically Create New Batch",
-   "length": 0,
-   "no_copy": 0,
-   "permlevel": 0,
-   "precision": "",
-   "print_hide": 0,
-   "print_hide_if_no_value": 0,
-   "read_only": 0,
-   "remember_last_selected_value": 0,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 0,
-   "set_only_once": 0,
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "depends_on": "has_batch_no", 
+   "fieldname": "has_expiry_date", 
+   "fieldtype": "Check", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Has Expiry Date", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
    "unique": 0
-  },
+  }, 
   {
-   "allow_bulk_edit": 0,
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "columns": 0,
-   "fieldname": "column_break_37",
-   "fieldtype": "Column Break",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "ignore_xss_filter": 0,
-   "in_filter": 0,
-   "in_global_search": 0,
-   "in_list_view": 0,
-   "in_standard_filter": 0,
-   "length": 0,
-   "no_copy": 0,
-   "permlevel": 0,
-   "precision": "",
-   "print_hide": 0,
-   "print_hide_if_no_value": 0,
-   "read_only": 0,
-   "remember_last_selected_value": 0,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 0,
-   "set_only_once": 0,
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "depends_on": "has_batch_no", 
+   "description": "", 
+   "fieldname": "create_new_batch", 
+   "fieldtype": "Check", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Automatically Create New Batch", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
    "unique": 0
-  },
+  }, 
   {
-   "allow_bulk_edit": 0,
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "columns": 0,
-   "default": "",
-   "depends_on": "eval:doc.is_stock_item",
-   "description": "",
-   "fieldname": "has_serial_no",
-   "fieldtype": "Check",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "ignore_xss_filter": 0,
-   "in_filter": 0,
-   "in_global_search": 0,
-   "in_list_view": 0,
-   "in_standard_filter": 0,
-   "label": "Has Serial No",
-   "length": 0,
-   "no_copy": 1,
-   "oldfieldname": "has_serial_no",
-   "oldfieldtype": "Select",
-   "options": "",
-   "permlevel": 0,
-   "print_hide": 0,
-   "print_hide_if_no_value": 0,
-   "read_only": 0,
-   "remember_last_selected_value": 0,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 0,
-   "set_only_once": 0,
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "column_break_37", 
+   "fieldtype": "Column Break", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
    "unique": 0
-  },
+  }, 
   {
-   "allow_bulk_edit": 0,
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "columns": 0,
-   "depends_on": "has_serial_no",
-   "description": "Example: ABCD.#####\nIf series is set and Serial No is not mentioned in transactions, then automatic serial number will be created based on this series. If you always want to explicitly mention Serial Nos for this item. leave this blank.",
-   "fieldname": "serial_no_series",
-   "fieldtype": "Data",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "ignore_xss_filter": 0,
-   "in_filter": 0,
-   "in_global_search": 0,
-   "in_list_view": 0,
-   "in_standard_filter": 0,
-   "label": "Serial Number Series",
-   "length": 0,
-   "no_copy": 0,
-   "permlevel": 0,
-   "print_hide": 0,
-   "print_hide_if_no_value": 0,
-   "read_only": 0,
-   "remember_last_selected_value": 0,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 0,
-   "set_only_once": 0,
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "default": "", 
+   "depends_on": "eval:doc.is_stock_item", 
+   "description": "", 
+   "fieldname": "has_serial_no", 
+   "fieldtype": "Check", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Has Serial No", 
+   "length": 0, 
+   "no_copy": 1, 
+   "oldfieldname": "has_serial_no", 
+   "oldfieldtype": "Select", 
+   "options": "", 
+   "permlevel": 0, 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 1, 
    "unique": 0
-  },
+  }, 
   {
-   "allow_bulk_edit": 0,
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 1,
-   "collapsible_depends_on": "attributes",
-   "columns": 0,
-   "depends_on": "",
-   "fieldname": "variants_section",
-   "fieldtype": "Section Break",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "ignore_xss_filter": 0,
-   "in_filter": 0,
-   "in_global_search": 0,
-   "in_list_view": 0,
-   "in_standard_filter": 0,
-   "label": "Variants",
-   "length": 0,
-   "no_copy": 0,
-   "permlevel": 0,
-   "precision": "",
-   "print_hide": 0,
-   "print_hide_if_no_value": 0,
-   "read_only": 0,
-   "remember_last_selected_value": 0,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 0,
-   "set_only_once": 0,
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "depends_on": "has_serial_no", 
+   "description": "Example: ABCD.#####\nIf series is set and Serial No is not mentioned in transactions, then automatic serial number will be created based on this series. If you always want to explicitly mention Serial Nos for this item. leave this blank.", 
+   "fieldname": "serial_no_series", 
+   "fieldtype": "Data", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Serial Number Series", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
    "unique": 0
-  },
+  }, 
   {
-   "allow_bulk_edit": 0,
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "columns": 0,
-   "default": "0",
-   "depends_on": "eval:!doc.variant_of",
-   "description": "If this item has variants, then it cannot be selected in sales orders etc.",
-   "fieldname": "has_variants",
-   "fieldtype": "Check",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "ignore_xss_filter": 0,
-   "in_filter": 0,
-   "in_global_search": 0,
-   "in_list_view": 0,
-   "in_standard_filter": 0,
-   "label": "Has Variants",
-   "length": 0,
-   "no_copy": 1,
-   "options": "",
-   "permlevel": 0,
-   "precision": "",
-   "print_hide": 0,
-   "print_hide_if_no_value": 0,
-   "read_only": 0,
-   "remember_last_selected_value": 0,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 0,
-   "set_only_once": 0,
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 1, 
+   "collapsible_depends_on": "attributes", 
+   "columns": 0, 
+   "depends_on": "", 
+   "fieldname": "variants_section", 
+   "fieldtype": "Section Break", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Variants", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
    "unique": 0
-  },
+  }, 
   {
-   "allow_bulk_edit": 0,
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "columns": 0,
-   "default": "Item Attribute",
-   "depends_on": "has_variants",
-   "fieldname": "variant_based_on",
-   "fieldtype": "Select",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "ignore_xss_filter": 0,
-   "in_filter": 0,
-   "in_global_search": 0,
-   "in_list_view": 0,
-   "in_standard_filter": 0,
-   "label": "Variant Based On",
-   "length": 0,
-   "no_copy": 0,
-   "options": "Item Attribute\nManufacturer",
-   "permlevel": 0,
-   "precision": "",
-   "print_hide": 0,
-   "print_hide_if_no_value": 0,
-   "read_only": 0,
-   "remember_last_selected_value": 0,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 0,
-   "set_only_once": 0,
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "default": "0", 
+   "depends_on": "eval:!doc.variant_of", 
+   "description": "If this item has variants, then it cannot be selected in sales orders etc.", 
+   "fieldname": "has_variants", 
+   "fieldtype": "Check", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Has Variants", 
+   "length": 0, 
+   "no_copy": 1, 
+   "options": "", 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
    "unique": 0
-  },
+  }, 
   {
-   "allow_bulk_edit": 0,
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "columns": 0,
-   "depends_on": "eval:doc.has_variants && doc.variant_based_on==='Item Attribute'",
-   "fieldname": "attributes",
-   "fieldtype": "Table",
-   "hidden": 1,
-   "ignore_user_permissions": 0,
-   "ignore_xss_filter": 0,
-   "in_filter": 0,
-   "in_global_search": 0,
-   "in_list_view": 0,
-   "in_standard_filter": 0,
-   "label": "Attributes",
-   "length": 0,
-   "no_copy": 1,
-   "options": "Item Variant Attribute",
-   "permlevel": 0,
-   "precision": "",
-   "print_hide": 0,
-   "print_hide_if_no_value": 0,
-   "read_only": 0,
-   "remember_last_selected_value": 0,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 0,
-   "set_only_once": 0,
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "default": "Item Attribute", 
+   "depends_on": "has_variants", 
+   "fieldname": "variant_based_on", 
+   "fieldtype": "Select", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Variant Based On", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "Item Attribute\nManufacturer", 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 1, 
    "unique": 0
-  },
+  }, 
   {
-   "allow_bulk_edit": 0,
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 1,
-   "columns": 0,
-   "fieldname": "purchase_details",
-   "fieldtype": "Section Break",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "ignore_xss_filter": 0,
-   "in_filter": 0,
-   "in_global_search": 0,
-   "in_list_view": 0,
-   "in_standard_filter": 0,
-   "label": "Purchase Details",
-   "length": 0,
-   "no_copy": 0,
-   "oldfieldtype": "Section Break",
-   "options": "fa fa-shopping-cart",
-   "permlevel": 0,
-   "print_hide": 0,
-   "print_hide_if_no_value": 0,
-   "read_only": 0,
-   "remember_last_selected_value": 0,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 0,
-   "set_only_once": 0,
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "depends_on": "eval:(doc.has_variants || doc.variant_of) && doc.variant_based_on==='Item Attribute'", 
+   "fieldname": "attributes", 
+   "fieldtype": "Table", 
+   "hidden": 1, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Attributes", 
+   "length": 0, 
+   "no_copy": 1, 
+   "options": "Item Variant Attribute", 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 1, 
    "unique": 0
-  },
+  }, 
   {
-   "allow_bulk_edit": 0,
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "columns": 0,
-   "default": "1",
-   "fieldname": "is_purchase_item",
-   "fieldtype": "Check",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "ignore_xss_filter": 0,
-   "in_filter": 0,
-   "in_global_search": 0,
-   "in_list_view": 0,
-   "in_standard_filter": 0,
-   "label": "Is Purchase Item",
-   "length": 0,
-   "no_copy": 0,
-   "permlevel": 0,
-   "precision": "",
-   "print_hide": 0,
-   "print_hide_if_no_value": 0,
-   "read_only": 0,
-   "remember_last_selected_value": 0,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 0,
-   "set_only_once": 0,
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 1, 
+   "columns": 0, 
+   "fieldname": "purchase_details", 
+   "fieldtype": "Section Break", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Purchase Details", 
+   "length": 0, 
+   "no_copy": 0, 
+   "oldfieldtype": "Section Break", 
+   "options": "fa fa-shopping-cart", 
+   "permlevel": 0, 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
    "unique": 0
-  },
+  }, 
   {
-   "allow_bulk_edit": 0,
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "columns": 0,
-   "fieldname": "purchase_uom",
-   "fieldtype": "Link",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "ignore_xss_filter": 0,
-   "in_filter": 0,
-   "in_global_search": 0,
-   "in_list_view": 0,
-   "in_standard_filter": 0,
-   "label": "Default Purchase Unit of Measure",
-   "length": 0,
-   "no_copy": 0,
-   "options": "UOM",
-   "permlevel": 0,
-   "precision": "",
-   "print_hide": 0,
-   "print_hide_if_no_value": 0,
-   "read_only": 0,
-   "remember_last_selected_value": 0,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 0,
-   "set_only_once": 0,
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "default": "1", 
+   "fieldname": "is_purchase_item", 
+   "fieldtype": "Check", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Is Purchase Item", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
    "unique": 0
-  },
+  }, 
   {
-   "allow_bulk_edit": 0,
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "columns": 0,
-   "default": "0.00",
-   "depends_on": "is_stock_item",
-   "description": "",
-   "fieldname": "min_order_qty",
-   "fieldtype": "Float",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "ignore_xss_filter": 0,
-   "in_filter": 0,
-   "in_global_search": 0,
-   "in_list_view": 0,
-   "in_standard_filter": 0,
-   "label": "Minimum Order Qty",
-   "length": 0,
-   "no_copy": 0,
-   "oldfieldname": "min_order_qty",
-   "oldfieldtype": "Currency",
-   "permlevel": 0,
-   "print_hide": 0,
-   "print_hide_if_no_value": 0,
-   "read_only": 0,
-   "remember_last_selected_value": 0,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 0,
-   "set_only_once": 0,
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "purchase_uom", 
+   "fieldtype": "Link", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Default Purchase Unit of Measure", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "UOM", 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
    "unique": 0
-  },
+  }, 
   {
-   "allow_bulk_edit": 0,
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "columns": 0,
-   "fieldname": "safety_stock",
-   "fieldtype": "Float",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "ignore_xss_filter": 0,
-   "in_filter": 0,
-   "in_global_search": 0,
-   "in_list_view": 0,
-   "in_standard_filter": 0,
-   "label": "Safety Stock",
-   "length": 0,
-   "no_copy": 0,
-   "permlevel": 0,
-   "precision": "",
-   "print_hide": 0,
-   "print_hide_if_no_value": 0,
-   "read_only": 0,
-   "remember_last_selected_value": 0,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 0,
-   "set_only_once": 0,
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "default": "0.00", 
+   "depends_on": "is_stock_item", 
+   "description": "", 
+   "fieldname": "min_order_qty", 
+   "fieldtype": "Float", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Minimum Order Qty", 
+   "length": 0, 
+   "no_copy": 0, 
+   "oldfieldname": "min_order_qty", 
+   "oldfieldtype": "Currency", 
+   "permlevel": 0, 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
    "unique": 0
-  },
+  }, 
   {
-   "allow_bulk_edit": 0,
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "columns": 0,
-   "depends_on": "",
-   "description": "Average time taken by the supplier to deliver",
-   "fieldname": "lead_time_days",
-   "fieldtype": "Int",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "ignore_xss_filter": 0,
-   "in_filter": 0,
-   "in_global_search": 0,
-   "in_list_view": 0,
-   "in_standard_filter": 0,
-   "label": "Lead Time in days",
-   "length": 0,
-   "no_copy": 0,
-   "oldfieldname": "lead_time_days",
-   "oldfieldtype": "Int",
-   "permlevel": 0,
-   "print_hide": 0,
-   "print_hide_if_no_value": 0,
-   "read_only": 0,
-   "remember_last_selected_value": 0,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 0,
-   "set_only_once": 0,
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "safety_stock", 
+   "fieldtype": "Float", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Safety Stock", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
    "unique": 0
-  },
+  }, 
   {
-   "allow_bulk_edit": 0,
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "columns": 0,
-   "depends_on": "",
-   "description": "",
-   "fieldname": "buying_cost_center",
-   "fieldtype": "Link",
-   "hidden": 0,
-   "ignore_user_permissions": 1,
-   "ignore_xss_filter": 0,
-   "in_filter": 0,
-   "in_global_search": 0,
-   "in_list_view": 0,
-   "in_standard_filter": 0,
-   "label": "Default Buying Cost Center",
-   "length": 0,
-   "no_copy": 0,
-   "oldfieldname": "cost_center",
-   "oldfieldtype": "Link",
-   "options": "Cost Center",
-   "permlevel": 0,
-   "print_hide": 0,
-   "print_hide_if_no_value": 0,
-   "read_only": 0,
-   "remember_last_selected_value": 0,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 0,
-   "set_only_once": 0,
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "depends_on": "", 
+   "description": "Average time taken by the supplier to deliver", 
+   "fieldname": "lead_time_days", 
+   "fieldtype": "Int", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Lead Time in days", 
+   "length": 0, 
+   "no_copy": 0, 
+   "oldfieldname": "lead_time_days", 
+   "oldfieldtype": "Int", 
+   "permlevel": 0, 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
    "unique": 0
-  },
+  }, 
   {
-   "allow_bulk_edit": 0,
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "columns": 0,
-   "depends_on": "",
-   "description": "",
-   "fieldname": "expense_account",
-   "fieldtype": "Link",
-   "hidden": 0,
-   "ignore_user_permissions": 1,
-   "ignore_xss_filter": 0,
-   "in_filter": 0,
-   "in_global_search": 0,
-   "in_list_view": 0,
-   "in_standard_filter": 0,
-   "label": "Default Expense Account",
-   "length": 0,
-   "no_copy": 0,
-   "oldfieldname": "purchase_account",
-   "oldfieldtype": "Link",
-   "options": "Account",
-   "permlevel": 0,
-   "print_hide": 0,
-   "print_hide_if_no_value": 0,
-   "read_only": 0,
-   "remember_last_selected_value": 0,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 0,
-   "set_only_once": 0,
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "depends_on": "", 
+   "description": "", 
+   "fieldname": "buying_cost_center", 
+   "fieldtype": "Link", 
+   "hidden": 0, 
+   "ignore_user_permissions": 1, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Default Buying Cost Center", 
+   "length": 0, 
+   "no_copy": 0, 
+   "oldfieldname": "cost_center", 
+   "oldfieldtype": "Link", 
+   "options": "Cost Center", 
+   "permlevel": 0, 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
    "unique": 0
-  },
+  }, 
   {
-   "allow_bulk_edit": 0,
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "columns": 0,
-   "depends_on": "",
-   "fieldname": "last_purchase_rate",
-   "fieldtype": "Float",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "ignore_xss_filter": 0,
-   "in_filter": 0,
-   "in_global_search": 0,
-   "in_list_view": 0,
-   "in_standard_filter": 0,
-   "label": "Last Purchase Rate",
-   "length": 0,
-   "no_copy": 1,
-   "oldfieldname": "last_purchase_rate",
-   "oldfieldtype": "Currency",
-   "permlevel": 0,
-   "print_hide": 0,
-   "print_hide_if_no_value": 0,
-   "read_only": 1,
-   "remember_last_selected_value": 0,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 0,
-   "set_only_once": 0,
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "depends_on": "", 
+   "description": "", 
+   "fieldname": "expense_account", 
+   "fieldtype": "Link", 
+   "hidden": 0, 
+   "ignore_user_permissions": 1, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Default Expense Account", 
+   "length": 0, 
+   "no_copy": 0, 
+   "oldfieldname": "purchase_account", 
+   "oldfieldtype": "Link", 
+   "options": "Account", 
+   "permlevel": 0, 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
    "unique": 0
-  },
+  }, 
   {
-   "allow_bulk_edit": 0,
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 1,
-   "columns": 0,
-   "depends_on": "",
-   "fieldname": "supplier_details",
-   "fieldtype": "Section Break",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "ignore_xss_filter": 0,
-   "in_filter": 0,
-   "in_global_search": 0,
-   "in_list_view": 0,
-   "in_standard_filter": 0,
-   "label": "Supplier Details",
-   "length": 0,
-   "no_copy": 0,
-   "permlevel": 0,
-   "precision": "",
-   "print_hide": 0,
-   "print_hide_if_no_value": 0,
-   "read_only": 0,
-   "remember_last_selected_value": 0,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 0,
-   "set_only_once": 0,
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "depends_on": "", 
+   "fieldname": "last_purchase_rate", 
+   "fieldtype": "Float", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Last Purchase Rate", 
+   "length": 0, 
+   "no_copy": 1, 
+   "oldfieldname": "last_purchase_rate", 
+   "oldfieldtype": "Currency", 
+   "permlevel": 0, 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 1, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
    "unique": 0
-  },
+  }, 
   {
-   "allow_bulk_edit": 0,
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "columns": 0,
-   "depends_on": "",
-   "fieldname": "default_supplier",
-   "fieldtype": "Link",
-   "hidden": 0,
-   "ignore_user_permissions": 1,
-   "ignore_xss_filter": 0,
-   "in_filter": 0,
-   "in_global_search": 0,
-   "in_list_view": 0,
-   "in_standard_filter": 0,
-   "label": "Default Supplier",
-   "length": 0,
-   "no_copy": 0,
-   "options": "Supplier",
-   "permlevel": 0,
-   "print_hide": 0,
-   "print_hide_if_no_value": 0,
-   "read_only": 0,
-   "remember_last_selected_value": 0,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 0,
-   "set_only_once": 0,
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 1, 
+   "columns": 0, 
+   "depends_on": "", 
+   "fieldname": "supplier_details", 
+   "fieldtype": "Section Break", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Supplier Details", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
    "unique": 0
-  },
+  }, 
   {
-   "allow_bulk_edit": 0,
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "columns": 0,
-   "fieldname": "delivered_by_supplier",
-   "fieldtype": "Check",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "ignore_xss_filter": 0,
-   "in_filter": 0,
-   "in_global_search": 0,
-   "in_list_view": 0,
-   "in_standard_filter": 0,
-   "label": "Delivered by Supplier (Drop Ship)",
-   "length": 0,
-   "no_copy": 0,
-   "permlevel": 0,
-   "precision": "",
-   "print_hide": 1,
-   "print_hide_if_no_value": 0,
-   "read_only": 0,
-   "remember_last_selected_value": 0,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 0,
-   "set_only_once": 0,
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "depends_on": "", 
+   "fieldname": "default_supplier", 
+   "fieldtype": "Link", 
+   "hidden": 0, 
+   "ignore_user_permissions": 1, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Default Supplier", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "Supplier", 
+   "permlevel": 0, 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
    "unique": 0
-  },
+  }, 
   {
-   "allow_bulk_edit": 0,
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "columns": 0,
-   "depends_on": "",
-   "fieldname": "manufacturer",
-   "fieldtype": "Link",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "ignore_xss_filter": 0,
-   "in_filter": 0,
-   "in_global_search": 0,
-   "in_list_view": 0,
-   "in_standard_filter": 0,
-   "label": "Manufacturer",
-   "length": 0,
-   "no_copy": 0,
-   "options": "Manufacturer",
-   "permlevel": 0,
-   "print_hide": 0,
-   "print_hide_if_no_value": 0,
-   "read_only": 0,
-   "remember_last_selected_value": 0,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 0,
-   "set_only_once": 0,
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "delivered_by_supplier", 
+   "fieldtype": "Check", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Delivered by Supplier (Drop Ship)", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 1, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
    "unique": 0
-  },
+  }, 
   {
-   "allow_bulk_edit": 0,
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "columns": 0,
-   "depends_on": "",
-   "fieldname": "manufacturer_part_no",
-   "fieldtype": "Data",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "ignore_xss_filter": 0,
-   "in_filter": 0,
-   "in_global_search": 0,
-   "in_list_view": 0,
-   "in_standard_filter": 0,
-   "label": "Manufacturer Part Number",
-   "length": 0,
-   "no_copy": 0,
-   "permlevel": 0,
-   "print_hide": 0,
-   "print_hide_if_no_value": 0,
-   "read_only": 0,
-   "remember_last_selected_value": 0,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 0,
-   "set_only_once": 0,
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "depends_on": "", 
+   "fieldname": "manufacturer", 
+   "fieldtype": "Link", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Manufacturer", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "Manufacturer", 
+   "permlevel": 0, 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
    "unique": 0
-  },
+  }, 
   {
-   "allow_bulk_edit": 0,
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "columns": 0,
-   "depends_on": "",
-   "fieldname": "column_break2",
-   "fieldtype": "Column Break",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "ignore_xss_filter": 0,
-   "in_filter": 0,
-   "in_global_search": 0,
-   "in_list_view": 0,
-   "in_standard_filter": 0,
-   "label": "Item Code for Suppliers",
-   "length": 0,
-   "no_copy": 0,
-   "oldfieldtype": "Column Break",
-   "permlevel": 0,
-   "print_hide": 0,
-   "print_hide_if_no_value": 0,
-   "read_only": 0,
-   "remember_last_selected_value": 0,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 0,
-   "set_only_once": 0,
-   "unique": 0,
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "depends_on": "", 
+   "fieldname": "manufacturer_part_no", 
+   "fieldtype": "Data", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Manufacturer Part Number", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "depends_on": "", 
+   "fieldname": "column_break2", 
+   "fieldtype": "Column Break", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Item Code for Suppliers", 
+   "length": 0, 
+   "no_copy": 0, 
+   "oldfieldtype": "Column Break", 
+   "permlevel": 0, 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0, 
    "width": "50%"
-  },
+  }, 
   {
-   "allow_bulk_edit": 0,
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "columns": 0,
-   "depends_on": "",
-   "fieldname": "supplier_items",
-   "fieldtype": "Table",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "ignore_xss_filter": 0,
-   "in_filter": 0,
-   "in_global_search": 0,
-   "in_list_view": 0,
-   "in_standard_filter": 0,
-   "label": "Supplier Items",
-   "length": 0,
-   "no_copy": 0,
-   "options": "Item Supplier",
-   "permlevel": 0,
-   "print_hide": 0,
-   "print_hide_if_no_value": 0,
-   "read_only": 0,
-   "remember_last_selected_value": 0,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 0,
-   "set_only_once": 0,
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "depends_on": "", 
+   "fieldname": "supplier_items", 
+   "fieldtype": "Table", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Supplier Items", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "Item Supplier", 
+   "permlevel": 0, 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
    "unique": 0
-  },
+  }, 
   {
-   "allow_bulk_edit": 0,
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 1,
-   "columns": 0,
-   "fieldname": "foreign_trade_details",
-   "fieldtype": "Section Break",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "ignore_xss_filter": 0,
-   "in_filter": 0,
-   "in_global_search": 0,
-   "in_list_view": 0,
-   "in_standard_filter": 0,
-   "label": "Foreign Trade Details",
-   "length": 0,
-   "no_copy": 0,
-   "permlevel": 0,
-   "precision": "",
-   "print_hide": 0,
-   "print_hide_if_no_value": 0,
-   "read_only": 0,
-   "remember_last_selected_value": 0,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 0,
-   "set_only_once": 0,
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 1, 
+   "columns": 0, 
+   "fieldname": "foreign_trade_details", 
+   "fieldtype": "Section Break", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Foreign Trade Details", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
    "unique": 0
-  },
+  }, 
   {
-   "allow_bulk_edit": 0,
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "columns": 0,
-   "fieldname": "country_of_origin",
-   "fieldtype": "Link",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "ignore_xss_filter": 0,
-   "in_filter": 0,
-   "in_global_search": 0,
-   "in_list_view": 0,
-   "in_standard_filter": 0,
-   "label": "Country of Origin",
-   "length": 0,
-   "no_copy": 0,
-   "options": "Country",
-   "permlevel": 0,
-   "precision": "",
-   "print_hide": 0,
-   "print_hide_if_no_value": 0,
-   "read_only": 0,
-   "remember_last_selected_value": 0,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 0,
-   "set_only_once": 0,
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "country_of_origin", 
+   "fieldtype": "Link", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Country of Origin", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "Country", 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
    "unique": 0
-  },
+  }, 
   {
-   "allow_bulk_edit": 0,
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "columns": 0,
-   "fieldname": "column_break_59",
-   "fieldtype": "Column Break",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "ignore_xss_filter": 0,
-   "in_filter": 0,
-   "in_global_search": 0,
-   "in_list_view": 0,
-   "in_standard_filter": 0,
-   "length": 0,
-   "no_copy": 0,
-   "permlevel": 0,
-   "precision": "",
-   "print_hide": 0,
-   "print_hide_if_no_value": 0,
-   "read_only": 0,
-   "remember_last_selected_value": 0,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 0,
-   "set_only_once": 0,
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "column_break_59", 
+   "fieldtype": "Column Break", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
    "unique": 0
-  },
+  }, 
   {
-   "allow_bulk_edit": 0,
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "columns": 0,
-   "fieldname": "customs_tariff_number",
-   "fieldtype": "Link",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "ignore_xss_filter": 0,
-   "in_filter": 0,
-   "in_global_search": 0,
-   "in_list_view": 0,
-   "in_standard_filter": 0,
-   "label": "Customs Tariff Number",
-   "length": 0,
-   "no_copy": 0,
-   "options": "Customs Tariff Number",
-   "permlevel": 0,
-   "precision": "",
-   "print_hide": 0,
-   "print_hide_if_no_value": 0,
-   "read_only": 0,
-   "remember_last_selected_value": 0,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 0,
-   "set_only_once": 0,
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "customs_tariff_number", 
+   "fieldtype": "Link", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Customs Tariff Number", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "Customs Tariff Number", 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
    "unique": 0
-  },
+  }, 
   {
-   "allow_bulk_edit": 0,
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 1,
-   "columns": 0,
-   "fieldname": "sales_details",
-   "fieldtype": "Section Break",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "ignore_xss_filter": 0,
-   "in_filter": 0,
-   "in_global_search": 0,
-   "in_list_view": 0,
-   "in_standard_filter": 0,
-   "label": "Sales Details",
-   "length": 0,
-   "no_copy": 0,
-   "oldfieldtype": "Section Break",
-   "options": "fa fa-tag",
-   "permlevel": 0,
-   "print_hide": 0,
-   "print_hide_if_no_value": 0,
-   "read_only": 0,
-   "remember_last_selected_value": 0,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 0,
-   "set_only_once": 0,
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 1, 
+   "columns": 0, 
+   "fieldname": "sales_details", 
+   "fieldtype": "Section Break", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Sales Details", 
+   "length": 0, 
+   "no_copy": 0, 
+   "oldfieldtype": "Section Break", 
+   "options": "fa fa-tag", 
+   "permlevel": 0, 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
    "unique": 0
-  },
+  }, 
   {
-   "allow_bulk_edit": 0,
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "columns": 0,
-   "default": "1",
-   "fieldname": "is_sales_item",
-   "fieldtype": "Check",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "ignore_xss_filter": 0,
-   "in_filter": 0,
-   "in_global_search": 0,
-   "in_list_view": 0,
-   "in_standard_filter": 0,
-   "label": "Is Sales Item",
-   "length": 0,
-   "no_copy": 0,
-   "permlevel": 0,
-   "precision": "",
-   "print_hide": 0,
-   "print_hide_if_no_value": 0,
-   "read_only": 0,
-   "remember_last_selected_value": 0,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 0,
-   "set_only_once": 0,
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "default": "1", 
+   "fieldname": "is_sales_item", 
+   "fieldtype": "Check", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Is Sales Item", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
    "unique": 0
-  },
+  }, 
   {
-   "allow_bulk_edit": 0,
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "columns": 0,
-   "fieldname": "sales_uom",
-   "fieldtype": "Link",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "ignore_xss_filter": 0,
-   "in_filter": 0,
-   "in_global_search": 0,
-   "in_list_view": 0,
-   "in_standard_filter": 0,
-   "label": "Default Sales Unit of Measure",
-   "length": 0,
-   "no_copy": 0,
-   "options": "UOM",
-   "permlevel": 0,
-   "precision": "",
-   "print_hide": 0,
-   "print_hide_if_no_value": 0,
-   "read_only": 0,
-   "remember_last_selected_value": 0,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 0,
-   "set_only_once": 0,
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "sales_uom", 
+   "fieldtype": "Link", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Default Sales Unit of Measure", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "UOM", 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
    "unique": 0
-  },
+  }, 
   {
-   "allow_bulk_edit": 0,
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "columns": 0,
-   "depends_on": "",
-   "fieldname": "income_account",
-   "fieldtype": "Link",
-   "hidden": 0,
-   "ignore_user_permissions": 1,
-   "ignore_xss_filter": 0,
-   "in_filter": 0,
-   "in_global_search": 0,
-   "in_list_view": 0,
-   "in_standard_filter": 0,
-   "label": "Default Income Account",
-   "length": 0,
-   "no_copy": 0,
-   "options": "Account",
-   "permlevel": 0,
-   "print_hide": 0,
-   "print_hide_if_no_value": 0,
-   "read_only": 0,
-   "remember_last_selected_value": 0,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 0,
-   "set_only_once": 0,
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "depends_on": "", 
+   "fieldname": "income_account", 
+   "fieldtype": "Link", 
+   "hidden": 0, 
+   "ignore_user_permissions": 1, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Default Income Account", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "Account", 
+   "permlevel": 0, 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
    "unique": 0
-  },
+  }, 
   {
-   "allow_bulk_edit": 0,
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "columns": 0,
-   "depends_on": "",
-   "fieldname": "selling_cost_center",
-   "fieldtype": "Link",
-   "hidden": 0,
-   "ignore_user_permissions": 1,
-   "ignore_xss_filter": 0,
-   "in_filter": 0,
-   "in_global_search": 0,
-   "in_list_view": 0,
-   "in_standard_filter": 0,
-   "label": "Default Selling Cost Center",
-   "length": 0,
-   "no_copy": 0,
-   "options": "Cost Center",
-   "permlevel": 0,
-   "print_hide": 0,
-   "print_hide_if_no_value": 0,
-   "read_only": 0,
-   "remember_last_selected_value": 0,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 0,
-   "set_only_once": 0,
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "depends_on": "", 
+   "fieldname": "selling_cost_center", 
+   "fieldtype": "Link", 
+   "hidden": 0, 
+   "ignore_user_permissions": 1, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Default Selling Cost Center", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "Cost Center", 
+   "permlevel": 0, 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
    "unique": 0
-  },
+  }, 
   {
-   "allow_bulk_edit": 0,
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "columns": 0,
-   "depends_on": "",
-   "fieldname": "column_break3",
-   "fieldtype": "Column Break",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "ignore_xss_filter": 0,
-   "in_filter": 0,
-   "in_global_search": 0,
-   "in_list_view": 0,
-   "in_standard_filter": 0,
-   "label": "Customer Item Codes",
-   "length": 0,
-   "no_copy": 0,
-   "oldfieldtype": "Column Break",
-   "permlevel": 0,
-   "print_hide": 0,
-   "print_hide_if_no_value": 0,
-   "read_only": 0,
-   "remember_last_selected_value": 0,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 0,
-   "set_only_once": 0,
-   "unique": 0,
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "depends_on": "", 
+   "fieldname": "column_break3", 
+   "fieldtype": "Column Break", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Customer Item Codes", 
+   "length": 0, 
+   "no_copy": 0, 
+   "oldfieldtype": "Column Break", 
+   "permlevel": 0, 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0, 
    "width": "50%"
-  },
+  }, 
   {
-   "allow_bulk_edit": 0,
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "columns": 0,
-   "depends_on": "",
-   "description": "",
-   "fieldname": "customer_items",
-   "fieldtype": "Table",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "ignore_xss_filter": 0,
-   "in_filter": 0,
-   "in_global_search": 0,
-   "in_list_view": 0,
-   "in_standard_filter": 0,
-   "label": "Customer Items",
-   "length": 0,
-   "no_copy": 0,
-   "options": "Item Customer Detail",
-   "permlevel": 0,
-   "print_hide": 0,
-   "print_hide_if_no_value": 0,
-   "read_only": 0,
-   "remember_last_selected_value": 0,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 0,
-   "set_only_once": 0,
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "depends_on": "", 
+   "description": "", 
+   "fieldname": "customer_items", 
+   "fieldtype": "Table", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Customer Items", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "Item Customer Detail", 
+   "permlevel": 0, 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
    "unique": 0
-  },
+  }, 
   {
-   "allow_bulk_edit": 0,
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "columns": 0,
-   "depends_on": "",
-   "fieldname": "max_discount",
-   "fieldtype": "Float",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "ignore_xss_filter": 0,
-   "in_filter": 0,
-   "in_global_search": 0,
-   "in_list_view": 0,
-   "in_standard_filter": 0,
-   "label": "Max Discount (%)",
-   "length": 0,
-   "no_copy": 0,
-   "oldfieldname": "max_discount",
-   "oldfieldtype": "Currency",
-   "permlevel": 0,
-   "print_hide": 0,
-   "print_hide_if_no_value": 0,
-   "read_only": 0,
-   "remember_last_selected_value": 0,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 0,
-   "set_only_once": 0,
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "depends_on": "", 
+   "fieldname": "max_discount", 
+   "fieldtype": "Float", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Max Discount (%)", 
+   "length": 0, 
+   "no_copy": 0, 
+   "oldfieldname": "max_discount", 
+   "oldfieldtype": "Currency", 
+   "permlevel": 0, 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
    "unique": 0
-  },
+  }, 
   {
-   "allow_bulk_edit": 0,
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 1,
-   "columns": 0,
-   "fieldname": "item_tax_section_break",
-   "fieldtype": "Section Break",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "ignore_xss_filter": 0,
-   "in_filter": 0,
-   "in_global_search": 0,
-   "in_list_view": 0,
-   "in_standard_filter": 0,
-   "label": "Item Tax",
-   "length": 0,
-   "no_copy": 0,
-   "oldfieldtype": "Section Break",
-   "options": "fa fa-money",
-   "permlevel": 0,
-   "print_hide": 0,
-   "print_hide_if_no_value": 0,
-   "read_only": 0,
-   "remember_last_selected_value": 0,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 0,
-   "set_only_once": 0,
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 1, 
+   "columns": 0, 
+   "fieldname": "item_tax_section_break", 
+   "fieldtype": "Section Break", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Item Tax", 
+   "length": 0, 
+   "no_copy": 0, 
+   "oldfieldtype": "Section Break", 
+   "options": "fa fa-money", 
+   "permlevel": 0, 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
    "unique": 0
-  },
+  }, 
   {
-   "allow_bulk_edit": 0,
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "columns": 0,
-   "description": "Will also apply for variants",
-   "fieldname": "taxes",
-   "fieldtype": "Table",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "ignore_xss_filter": 0,
-   "in_filter": 0,
-   "in_global_search": 0,
-   "in_list_view": 0,
-   "in_standard_filter": 0,
-   "label": "Taxes",
-   "length": 0,
-   "no_copy": 0,
-   "oldfieldname": "item_tax",
-   "oldfieldtype": "Table",
-   "options": "Item Tax",
-   "permlevel": 0,
-   "print_hide": 0,
-   "print_hide_if_no_value": 0,
-   "read_only": 0,
-   "remember_last_selected_value": 0,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 0,
-   "set_only_once": 0,
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "description": "Will also apply for variants", 
+   "fieldname": "taxes", 
+   "fieldtype": "Table", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Taxes", 
+   "length": 0, 
+   "no_copy": 0, 
+   "oldfieldname": "item_tax", 
+   "oldfieldtype": "Table", 
+   "options": "Item Tax", 
+   "permlevel": 0, 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
    "unique": 0
-  },
+  }, 
   {
-   "allow_bulk_edit": 0,
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 1,
-   "columns": 0,
-   "fieldname": "inspection_criteria",
-   "fieldtype": "Section Break",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "ignore_xss_filter": 0,
-   "in_filter": 0,
-   "in_global_search": 0,
-   "in_list_view": 0,
-   "in_standard_filter": 0,
-   "label": "Inspection Criteria",
-   "length": 0,
-   "no_copy": 0,
-   "oldfieldtype": "Section Break",
-   "options": "fa fa-search",
-   "permlevel": 0,
-   "print_hide": 0,
-   "print_hide_if_no_value": 0,
-   "read_only": 0,
-   "remember_last_selected_value": 0,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 0,
-   "set_only_once": 0,
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 1, 
+   "columns": 0, 
+   "fieldname": "inspection_criteria", 
+   "fieldtype": "Section Break", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Inspection Criteria", 
+   "length": 0, 
+   "no_copy": 0, 
+   "oldfieldtype": "Section Break", 
+   "options": "fa fa-search", 
+   "permlevel": 0, 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
    "unique": 0
-  },
+  }, 
   {
-   "allow_bulk_edit": 0,
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "columns": 0,
-   "default": "",
-   "fieldname": "inspection_required_before_purchase",
-   "fieldtype": "Check",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "ignore_xss_filter": 0,
-   "in_filter": 0,
-   "in_global_search": 0,
-   "in_list_view": 0,
-   "in_standard_filter": 0,
-   "label": "Inspection Required before Purchase",
-   "length": 0,
-   "no_copy": 0,
-   "oldfieldname": "inspection_required",
-   "oldfieldtype": "Select",
-   "options": "",
-   "permlevel": 0,
-   "print_hide": 0,
-   "print_hide_if_no_value": 0,
-   "read_only": 0,
-   "remember_last_selected_value": 0,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 0,
-   "set_only_once": 0,
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "default": "", 
+   "fieldname": "inspection_required_before_purchase", 
+   "fieldtype": "Check", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Inspection Required before Purchase", 
+   "length": 0, 
+   "no_copy": 0, 
+   "oldfieldname": "inspection_required", 
+   "oldfieldtype": "Select", 
+   "options": "", 
+   "permlevel": 0, 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
    "unique": 0
-  },
+  }, 
   {
-   "allow_bulk_edit": 0,
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "columns": 0,
-   "fieldname": "inspection_required_before_delivery",
-   "fieldtype": "Check",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "ignore_xss_filter": 0,
-   "in_filter": 0,
-   "in_global_search": 0,
-   "in_list_view": 0,
-   "in_standard_filter": 0,
-   "label": "Inspection Required before Delivery",
-   "length": 0,
-   "no_copy": 0,
-   "permlevel": 0,
-   "precision": "",
-   "print_hide": 0,
-   "print_hide_if_no_value": 0,
-   "read_only": 0,
-   "remember_last_selected_value": 0,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 0,
-   "set_only_once": 0,
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "inspection_required_before_delivery", 
+   "fieldtype": "Check", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Inspection Required before Delivery", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
    "unique": 0
-  },
+  }, 
   {
-   "allow_bulk_edit": 0,
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "columns": 0,
-   "depends_on": "eval:(doc.inspection_required_before_purchase || doc.inspection_required_before_delivery)",
-   "description": "Will also apply to variants",
-   "fieldname": "quality_parameters",
-   "fieldtype": "Table",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "ignore_xss_filter": 0,
-   "in_filter": 0,
-   "in_global_search": 0,
-   "in_list_view": 0,
-   "in_standard_filter": 0,
-   "label": "Quality Parameters",
-   "length": 0,
-   "no_copy": 0,
-   "oldfieldname": "item_specification_details",
-   "oldfieldtype": "Table",
-   "options": "Item Quality Inspection Parameter",
-   "permlevel": 0,
-   "print_hide": 0,
-   "print_hide_if_no_value": 0,
-   "read_only": 0,
-   "remember_last_selected_value": 0,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 0,
-   "set_only_once": 0,
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "depends_on": "eval:(doc.inspection_required_before_purchase || doc.inspection_required_before_delivery)", 
+   "description": "Will also apply to variants", 
+   "fieldname": "quality_parameters", 
+   "fieldtype": "Table", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Quality Parameters", 
+   "length": 0, 
+   "no_copy": 0, 
+   "oldfieldname": "item_specification_details", 
+   "oldfieldtype": "Table", 
+   "options": "Item Quality Inspection Parameter", 
+   "permlevel": 0, 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
    "unique": 0
-  },
+  }, 
   {
-   "allow_bulk_edit": 0,
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 1,
-   "columns": 0,
-   "depends_on": "is_stock_item",
-   "fieldname": "manufacturing",
-   "fieldtype": "Section Break",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "ignore_xss_filter": 0,
-   "in_filter": 0,
-   "in_global_search": 0,
-   "in_list_view": 0,
-   "in_standard_filter": 0,
-   "label": "Manufacturing",
-   "length": 0,
-   "no_copy": 0,
-   "oldfieldtype": "Section Break",
-   "options": "fa fa-cogs",
-   "permlevel": 0,
-   "print_hide": 0,
-   "print_hide_if_no_value": 0,
-   "read_only": 0,
-   "remember_last_selected_value": 0,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 0,
-   "set_only_once": 0,
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 1, 
+   "columns": 0, 
+   "depends_on": "is_stock_item", 
+   "fieldname": "manufacturing", 
+   "fieldtype": "Section Break", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Manufacturing", 
+   "length": 0, 
+   "no_copy": 0, 
+   "oldfieldtype": "Section Break", 
+   "options": "fa fa-cogs", 
+   "permlevel": 0, 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
    "unique": 0
-  },
+  }, 
   {
-   "allow_bulk_edit": 0,
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "columns": 0,
-   "depends_on": "",
-   "fieldname": "default_bom",
-   "fieldtype": "Link",
-   "hidden": 0,
-   "ignore_user_permissions": 1,
-   "ignore_xss_filter": 0,
-   "in_filter": 0,
-   "in_global_search": 0,
-   "in_list_view": 0,
-   "in_standard_filter": 0,
-   "label": "Default BOM",
-   "length": 0,
-   "no_copy": 1,
-   "oldfieldname": "default_bom",
-   "oldfieldtype": "Link",
-   "options": "BOM",
-   "permlevel": 0,
-   "print_hide": 0,
-   "print_hide_if_no_value": 0,
-   "read_only": 1,
-   "remember_last_selected_value": 0,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 0,
-   "set_only_once": 0,
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "depends_on": "", 
+   "fieldname": "default_bom", 
+   "fieldtype": "Link", 
+   "hidden": 0, 
+   "ignore_user_permissions": 1, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Default BOM", 
+   "length": 0, 
+   "no_copy": 1, 
+   "oldfieldname": "default_bom", 
+   "oldfieldtype": "Link", 
+   "options": "BOM", 
+   "permlevel": 0, 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 1, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
    "unique": 0
-  },
+  }, 
   {
-   "allow_bulk_edit": 0,
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "columns": 0,
-   "default": "",
-   "description": "If subcontracted to a vendor",
-   "fieldname": "is_sub_contracted_item",
-   "fieldtype": "Check",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "ignore_xss_filter": 0,
-   "in_filter": 0,
-   "in_global_search": 0,
-   "in_list_view": 0,
-   "in_standard_filter": 0,
-   "label": "Supply Raw Materials for Purchase",
-   "length": 0,
-   "no_copy": 0,
-   "oldfieldname": "is_sub_contracted_item",
-   "oldfieldtype": "Select",
-   "options": "",
-   "permlevel": 0,
-   "print_hide": 0,
-   "print_hide_if_no_value": 0,
-   "read_only": 0,
-   "remember_last_selected_value": 0,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 0,
-   "set_only_once": 0,
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "default": "", 
+   "description": "If subcontracted to a vendor", 
+   "fieldname": "is_sub_contracted_item", 
+   "fieldtype": "Check", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Supply Raw Materials for Purchase", 
+   "length": 0, 
+   "no_copy": 0, 
+   "oldfieldname": "is_sub_contracted_item", 
+   "oldfieldtype": "Select", 
+   "options": "", 
+   "permlevel": 0, 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
    "unique": 0
-  },
+  }, 
   {
-   "allow_bulk_edit": 0,
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "columns": 0,
-   "fieldname": "column_break_74",
-   "fieldtype": "Column Break",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "ignore_xss_filter": 0,
-   "in_filter": 0,
-   "in_global_search": 0,
-   "in_list_view": 0,
-   "in_standard_filter": 0,
-   "length": 0,
-   "no_copy": 0,
-   "permlevel": 0,
-   "precision": "",
-   "print_hide": 0,
-   "print_hide_if_no_value": 0,
-   "read_only": 0,
-   "remember_last_selected_value": 0,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 0,
-   "set_only_once": 0,
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "column_break_74", 
+   "fieldtype": "Column Break", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
    "unique": 0
-  },
+  }, 
   {
-   "allow_bulk_edit": 0,
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "columns": 0,
-   "fieldname": "customer_code",
-   "fieldtype": "Data",
-   "hidden": 1,
-   "ignore_user_permissions": 0,
-   "ignore_xss_filter": 0,
-   "in_filter": 0,
-   "in_global_search": 0,
-   "in_list_view": 0,
-   "in_standard_filter": 0,
-   "label": "Customer Code",
-   "length": 0,
-   "no_copy": 1,
-   "permlevel": 0,
-   "print_hide": 1,
-   "print_hide_if_no_value": 0,
-   "read_only": 0,
-   "remember_last_selected_value": 0,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 0,
-   "set_only_once": 0,
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "customer_code", 
+   "fieldtype": "Data", 
+   "hidden": 1, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Customer Code", 
+   "length": 0, 
+   "no_copy": 1, 
+   "permlevel": 0, 
+   "print_hide": 1, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
    "unique": 0
-  },
+  }, 
   {
-   "allow_bulk_edit": 0,
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 1,
-   "columns": 0,
-   "fieldname": "website_section",
-   "fieldtype": "Section Break",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "ignore_xss_filter": 0,
-   "in_filter": 0,
-   "in_global_search": 0,
-   "in_list_view": 0,
-   "in_standard_filter": 0,
-   "label": "Website",
-   "length": 0,
-   "no_copy": 0,
-   "options": "fa fa-globe",
-   "permlevel": 0,
-   "print_hide": 0,
-   "print_hide_if_no_value": 0,
-   "read_only": 0,
-   "remember_last_selected_value": 0,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 0,
-   "set_only_once": 0,
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 1, 
+   "columns": 0, 
+   "fieldname": "website_section", 
+   "fieldtype": "Section Break", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Website", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "fa fa-globe", 
+   "permlevel": 0, 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
    "unique": 0
-  },
+  }, 
   {
-   "allow_bulk_edit": 0,
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "columns": 0,
-   "depends_on": "eval:!doc.variant_of",
-   "fieldname": "show_in_website",
-   "fieldtype": "Check",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "ignore_xss_filter": 0,
-   "in_filter": 0,
-   "in_global_search": 0,
-   "in_list_view": 0,
-   "in_standard_filter": 0,
-   "label": "Show in Website",
-   "length": 0,
-   "no_copy": 0,
-   "permlevel": 0,
-   "print_hide": 0,
-   "print_hide_if_no_value": 0,
-   "read_only": 0,
-   "remember_last_selected_value": 0,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 0,
-   "set_only_once": 0,
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "depends_on": "eval:!doc.variant_of", 
+   "fieldname": "show_in_website", 
+   "fieldtype": "Check", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Show in Website", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
    "unique": 0
-  },
+  }, 
   {
-   "allow_bulk_edit": 0,
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "columns": 0,
-   "depends_on": "variant_of",
-   "fieldname": "show_variant_in_website",
-   "fieldtype": "Check",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "ignore_xss_filter": 0,
-   "in_filter": 0,
-   "in_global_search": 0,
-   "in_list_view": 0,
-   "in_standard_filter": 0,
-   "label": "Show in Website (Variant)",
-   "length": 0,
-   "no_copy": 0,
-   "permlevel": 0,
-   "precision": "",
-   "print_hide": 0,
-   "print_hide_if_no_value": 0,
-   "read_only": 0,
-   "remember_last_selected_value": 0,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 0,
-   "set_only_once": 0,
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "depends_on": "variant_of", 
+   "fieldname": "show_variant_in_website", 
+   "fieldtype": "Check", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Show in Website (Variant)", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
    "unique": 0
-  },
+  }, 
   {
-   "allow_bulk_edit": 0,
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "columns": 0,
-   "depends_on": "eval: doc.show_in_website || doc.show_variant_in_website",
-   "fieldname": "route",
-   "fieldtype": "Small Text",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "ignore_xss_filter": 0,
-   "in_filter": 0,
-   "in_global_search": 0,
-   "in_list_view": 0,
-   "in_standard_filter": 0,
-   "label": "Route",
-   "length": 0,
-   "no_copy": 1,
-   "permlevel": 0,
-   "precision": "",
-   "print_hide": 0,
-   "print_hide_if_no_value": 0,
-   "read_only": 0,
-   "remember_last_selected_value": 0,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 0,
-   "set_only_once": 0,
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "depends_on": "eval: doc.show_in_website || doc.show_variant_in_website", 
+   "fieldname": "route", 
+   "fieldtype": "Small Text", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Route", 
+   "length": 0, 
+   "no_copy": 1, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
    "unique": 0
-  },
+  }, 
   {
-   "allow_bulk_edit": 0,
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "columns": 0,
-   "depends_on": "eval: doc.show_in_website || doc.show_variant_in_website",
-   "description": "Items with higher weightage will be shown higher",
-   "fieldname": "weightage",
-   "fieldtype": "Int",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "ignore_xss_filter": 0,
-   "in_filter": 0,
-   "in_global_search": 0,
-   "in_list_view": 0,
-   "in_standard_filter": 0,
-   "label": "Weightage",
-   "length": 0,
-   "no_copy": 0,
-   "permlevel": 0,
-   "print_hide": 0,
-   "print_hide_if_no_value": 0,
-   "read_only": 0,
-   "remember_last_selected_value": 0,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 1,
-   "set_only_once": 0,
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "depends_on": "eval: doc.show_in_website || doc.show_variant_in_website", 
+   "description": "Items with higher weightage will be shown higher", 
+   "fieldname": "weightage", 
+   "fieldtype": "Int", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Weightage", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 1, 
+   "set_only_once": 0, 
    "unique": 0
-  },
+  }, 
   {
-   "allow_bulk_edit": 0,
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "columns": 0,
-   "depends_on": "eval: doc.show_in_website || doc.show_variant_in_website",
-   "description": "Show a slideshow at the top of the page",
-   "fieldname": "slideshow",
-   "fieldtype": "Link",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "ignore_xss_filter": 0,
-   "in_filter": 0,
-   "in_global_search": 0,
-   "in_list_view": 0,
-   "in_standard_filter": 0,
-   "label": "Slideshow",
-   "length": 0,
-   "no_copy": 0,
-   "options": "Website Slideshow",
-   "permlevel": 0,
-   "print_hide": 0,
-   "print_hide_if_no_value": 0,
-   "read_only": 0,
-   "remember_last_selected_value": 0,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 0,
-   "set_only_once": 0,
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "depends_on": "eval: doc.show_in_website || doc.show_variant_in_website", 
+   "description": "Show a slideshow at the top of the page", 
+   "fieldname": "slideshow", 
+   "fieldtype": "Link", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Slideshow", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "Website Slideshow", 
+   "permlevel": 0, 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
    "unique": 0
-  },
+  }, 
   {
-   "allow_bulk_edit": 0,
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "columns": 0,
-   "depends_on": "eval: doc.show_in_website || doc.show_variant_in_website",
-   "description": "Item Image (if not slideshow)",
-   "fieldname": "website_image",
-   "fieldtype": "Attach",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "ignore_xss_filter": 0,
-   "in_filter": 0,
-   "in_global_search": 0,
-   "in_list_view": 0,
-   "in_standard_filter": 0,
-   "label": "Image",
-   "length": 0,
-   "no_copy": 0,
-   "options": "",
-   "permlevel": 0,
-   "print_hide": 0,
-   "print_hide_if_no_value": 0,
-   "read_only": 0,
-   "remember_last_selected_value": 0,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 0,
-   "set_only_once": 0,
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "depends_on": "eval: doc.show_in_website || doc.show_variant_in_website", 
+   "description": "Item Image (if not slideshow)", 
+   "fieldname": "website_image", 
+   "fieldtype": "Attach", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Image", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "", 
+   "permlevel": 0, 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
    "unique": 0
-  },
+  }, 
   {
-   "allow_bulk_edit": 0,
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "columns": 0,
-   "fieldname": "thumbnail",
-   "fieldtype": "Data",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "ignore_xss_filter": 0,
-   "in_filter": 0,
-   "in_global_search": 0,
-   "in_list_view": 0,
-   "in_standard_filter": 0,
-   "label": "Thumbnail",
-   "length": 0,
-   "no_copy": 0,
-   "permlevel": 0,
-   "precision": "",
-   "print_hide": 0,
-   "print_hide_if_no_value": 0,
-   "read_only": 1,
-   "remember_last_selected_value": 0,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 0,
-   "set_only_once": 0,
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "thumbnail", 
+   "fieldtype": "Data", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Thumbnail", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 1, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
    "unique": 0
-  },
+  }, 
   {
-   "allow_bulk_edit": 0,
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "columns": 0,
-   "fieldname": "cb72",
-   "fieldtype": "Column Break",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "ignore_xss_filter": 0,
-   "in_filter": 0,
-   "in_global_search": 0,
-   "in_list_view": 0,
-   "in_standard_filter": 0,
-   "length": 0,
-   "no_copy": 0,
-   "permlevel": 0,
-   "print_hide": 0,
-   "print_hide_if_no_value": 0,
-   "read_only": 0,
-   "remember_last_selected_value": 0,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 0,
-   "set_only_once": 0,
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "cb72", 
+   "fieldtype": "Column Break", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
    "unique": 0
-  },
+  }, 
   {
-   "allow_bulk_edit": 0,
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "columns": 0,
-   "depends_on": "eval: doc.show_in_website || doc.show_variant_in_website",
-   "description": "Show \"In Stock\" or \"Not in Stock\" based on stock available in this warehouse.",
-   "fieldname": "website_warehouse",
-   "fieldtype": "Link",
-   "hidden": 0,
-   "ignore_user_permissions": 1,
-   "ignore_xss_filter": 0,
-   "in_filter": 0,
-   "in_global_search": 0,
-   "in_list_view": 0,
-   "in_standard_filter": 0,
-   "label": "Website Warehouse",
-   "length": 0,
-   "no_copy": 0,
-   "options": "Warehouse",
-   "permlevel": 0,
-   "print_hide": 0,
-   "print_hide_if_no_value": 0,
-   "read_only": 0,
-   "remember_last_selected_value": 0,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 0,
-   "set_only_once": 0,
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "depends_on": "eval: doc.show_in_website || doc.show_variant_in_website", 
+   "description": "Show \"In Stock\" or \"Not in Stock\" based on stock available in this warehouse.", 
+   "fieldname": "website_warehouse", 
+   "fieldtype": "Link", 
+   "hidden": 0, 
+   "ignore_user_permissions": 1, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Website Warehouse", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "Warehouse", 
+   "permlevel": 0, 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
    "unique": 0
-  },
+  }, 
   {
-   "allow_bulk_edit": 0,
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "columns": 0,
-   "depends_on": "eval: doc.show_in_website || doc.show_variant_in_website",
-   "description": "List this Item in multiple groups on the website.",
-   "fieldname": "website_item_groups",
-   "fieldtype": "Table",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "ignore_xss_filter": 0,
-   "in_filter": 0,
-   "in_global_search": 0,
-   "in_list_view": 0,
-   "in_standard_filter": 0,
-   "label": "Website Item Groups",
-   "length": 0,
-   "no_copy": 0,
-   "options": "Website Item Group",
-   "permlevel": 0,
-   "print_hide": 0,
-   "print_hide_if_no_value": 0,
-   "read_only": 0,
-   "remember_last_selected_value": 0,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 0,
-   "set_only_once": 0,
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "depends_on": "eval: doc.show_in_website || doc.show_variant_in_website", 
+   "description": "List this Item in multiple groups on the website.", 
+   "fieldname": "website_item_groups", 
+   "fieldtype": "Table", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Website Item Groups", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "Website Item Group", 
+   "permlevel": 0, 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
    "unique": 0
-  },
+  }, 
   {
-   "allow_bulk_edit": 0,
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 1,
-   "collapsible_depends_on": "website_specifications",
-   "columns": 0,
-   "depends_on": "eval: doc.show_in_website || doc.show_variant_in_website",
-   "fieldname": "sb72",
-   "fieldtype": "Section Break",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "ignore_xss_filter": 0,
-   "in_filter": 0,
-   "in_global_search": 0,
-   "in_list_view": 0,
-   "in_standard_filter": 0,
-   "label": "Website Specifications",
-   "length": 0,
-   "no_copy": 0,
-   "permlevel": 0,
-   "print_hide": 0,
-   "print_hide_if_no_value": 0,
-   "read_only": 0,
-   "remember_last_selected_value": 0,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 0,
-   "set_only_once": 0,
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 1, 
+   "collapsible_depends_on": "website_specifications", 
+   "columns": 0, 
+   "depends_on": "eval: doc.show_in_website || doc.show_variant_in_website", 
+   "fieldname": "sb72", 
+   "fieldtype": "Section Break", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Website Specifications", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
    "unique": 0
-  },
+  }, 
   {
-   "allow_bulk_edit": 0,
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "columns": 0,
-   "depends_on": "eval: doc.show_in_website || doc.show_variant_in_website",
-   "fieldname": "copy_from_item_group",
-   "fieldtype": "Button",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "ignore_xss_filter": 0,
-   "in_filter": 0,
-   "in_global_search": 0,
-   "in_list_view": 0,
-   "in_standard_filter": 0,
-   "label": "Copy From Item Group",
-   "length": 0,
-   "no_copy": 0,
-   "permlevel": 0,
-   "print_hide": 0,
-   "print_hide_if_no_value": 0,
-   "read_only": 0,
-   "remember_last_selected_value": 0,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 0,
-   "set_only_once": 0,
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "depends_on": "eval: doc.show_in_website || doc.show_variant_in_website", 
+   "fieldname": "copy_from_item_group", 
+   "fieldtype": "Button", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Copy From Item Group", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
    "unique": 0
-  },
+  }, 
   {
-   "allow_bulk_edit": 0,
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "columns": 0,
-   "depends_on": "eval: doc.show_in_website || doc.show_variant_in_website",
-   "fieldname": "website_specifications",
-   "fieldtype": "Table",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "ignore_xss_filter": 0,
-   "in_filter": 0,
-   "in_global_search": 0,
-   "in_list_view": 0,
-   "in_standard_filter": 0,
-   "label": "Website Specifications",
-   "length": 0,
-   "no_copy": 0,
-   "options": "Item Website Specification",
-   "permlevel": 0,
-   "print_hide": 0,
-   "print_hide_if_no_value": 0,
-   "read_only": 0,
-   "remember_last_selected_value": 0,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 0,
-   "set_only_once": 0,
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "depends_on": "eval: doc.show_in_website || doc.show_variant_in_website", 
+   "fieldname": "website_specifications", 
+   "fieldtype": "Table", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Website Specifications", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "Item Website Specification", 
+   "permlevel": 0, 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
    "unique": 0
-  },
+  }, 
   {
-   "allow_bulk_edit": 0,
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "columns": 0,
-   "depends_on": "eval: doc.show_in_website || doc.show_variant_in_website",
-   "fieldname": "web_long_description",
-   "fieldtype": "Text Editor",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "ignore_xss_filter": 0,
-   "in_filter": 0,
-   "in_global_search": 0,
-   "in_list_view": 0,
-   "in_standard_filter": 0,
-   "label": "Website Description",
-   "length": 0,
-   "no_copy": 0,
-   "permlevel": 0,
-   "print_hide": 0,
-   "print_hide_if_no_value": 0,
-   "read_only": 0,
-   "remember_last_selected_value": 0,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 0,
-   "set_only_once": 0,
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "depends_on": "eval: doc.show_in_website || doc.show_variant_in_website", 
+   "fieldname": "web_long_description", 
+   "fieldtype": "Text Editor", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Website Description", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
    "unique": 0
-  },
+  }, 
   {
-   "allow_bulk_edit": 0,
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "columns": 0,
-   "fieldname": "total_projected_qty",
-   "fieldtype": "Float",
-   "hidden": 1,
-   "ignore_user_permissions": 0,
-   "ignore_xss_filter": 0,
-   "in_filter": 0,
-   "in_global_search": 0,
-   "in_list_view": 0,
-   "in_standard_filter": 0,
-   "label": "Total Projected Qty",
-   "length": 0,
-   "no_copy": 0,
-   "permlevel": 0,
-   "precision": "",
-   "print_hide": 1,
-   "print_hide_if_no_value": 0,
-   "read_only": 1,
-   "remember_last_selected_value": 0,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 0,
-   "set_only_once": 0,
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "total_projected_qty", 
+   "fieldtype": "Float", 
+   "hidden": 1, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Total Projected Qty", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 1, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 1, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
    "unique": 0
-  },
+  }, 
   {
-   "allow_bulk_edit": 0,
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "columns": 0,
-   "depends_on": "eval:(!doc.is_item_from_hub)",
-   "fieldname": "hub_publishing_sb",
-   "fieldtype": "Section Break",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "ignore_xss_filter": 0,
-   "in_filter": 0,
-   "in_global_search": 0,
-   "in_list_view": 0,
-   "in_standard_filter": 0,
-   "label": "Hub Publishing Details",
-   "length": 0,
-   "no_copy": 0,
-   "permlevel": 0,
-   "precision": "",
-   "print_hide": 0,
-   "print_hide_if_no_value": 0,
-   "read_only": 0,
-   "remember_last_selected_value": 0,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 0,
-   "set_only_once": 0,
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "depends_on": "eval:(!doc.is_item_from_hub)", 
+   "fieldname": "hub_publishing_sb", 
+   "fieldtype": "Section Break", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Hub Publishing Details", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
    "unique": 0
-  },
+  }, 
   {
-   "allow_bulk_edit": 0,
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "columns": 0,
-   "default": "0",
-   "description": "Publish Item to hub.erpnext.com",
-   "fieldname": "publish_in_hub",
-   "fieldtype": "Check",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "ignore_xss_filter": 0,
-   "in_filter": 0,
-   "in_global_search": 0,
-   "in_list_view": 0,
-   "in_standard_filter": 0,
-   "label": "Publish in Hub",
-   "length": 0,
-   "no_copy": 0,
-   "permlevel": 0,
-   "precision": "",
-   "print_hide": 0,
-   "print_hide_if_no_value": 0,
-   "read_only": 0,
-   "remember_last_selected_value": 0,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 0,
-   "set_only_once": 0,
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "default": "0", 
+   "description": "Publish Item to hub.erpnext.com", 
+   "fieldname": "publish_in_hub", 
+   "fieldtype": "Check", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Publish in Hub", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
    "unique": 0
-  },
+  }, 
   {
-   "allow_bulk_edit": 0,
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "columns": 0,
-   "fieldname": "hub_category_to_publish",
-   "fieldtype": "Link",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "ignore_xss_filter": 0,
-   "in_filter": 0,
-   "in_global_search": 0,
-   "in_list_view": 0,
-   "in_standard_filter": 0,
-   "label": "Hub Category to Publish",
-   "length": 0,
-   "no_copy": 0,
-   "options": "Hub Category",
-   "permlevel": 0,
-   "precision": "",
-   "print_hide": 0,
-   "print_hide_if_no_value": 0,
-   "read_only": 0,
-   "remember_last_selected_value": 0,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 0,
-   "set_only_once": 0,
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "hub_category_to_publish", 
+   "fieldtype": "Link", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Hub Category to Publish", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "Hub Category", 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
    "unique": 0
-  },
+  }, 
   {
-   "allow_bulk_edit": 0,
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "columns": 0,
-   "description": "Publish \"In Stock\" or \"Not in Stock\" on Hub based on stock available in this warehouse.",
-   "fieldname": "hub_warehouse",
-   "fieldtype": "Link",
-   "hidden": 0,
-   "ignore_user_permissions": 1,
-   "ignore_xss_filter": 0,
-   "in_filter": 0,
-   "in_global_search": 0,
-   "in_list_view": 0,
-   "in_standard_filter": 0,
-   "label": "Hub Warehouse",
-   "length": 0,
-   "no_copy": 0,
-   "options": "Warehouse",
-   "permlevel": 0,
-   "precision": "",
-   "print_hide": 0,
-   "print_hide_if_no_value": 0,
-   "read_only": 0,
-   "remember_last_selected_value": 0,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 0,
-   "set_only_once": 0,
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "description": "Publish \"In Stock\" or \"Not in Stock\" on Hub based on stock available in this warehouse.", 
+   "fieldname": "hub_warehouse", 
+   "fieldtype": "Link", 
+   "hidden": 0, 
+   "ignore_user_permissions": 1, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Hub Warehouse", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "Warehouse", 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
    "unique": 0
-  },
+  }, 
   {
-   "allow_bulk_edit": 0,
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "columns": 0,
-   "default": "0",
-   "fieldname": "synced_with_hub",
-   "fieldtype": "Check",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "ignore_xss_filter": 0,
-   "in_filter": 0,
-   "in_global_search": 0,
-   "in_list_view": 0,
-   "in_standard_filter": 0,
-   "label": "Synced With Hub",
-   "length": 0,
-   "no_copy": 0,
-   "permlevel": 0,
-   "precision": "",
-   "print_hide": 0,
-   "print_hide_if_no_value": 0,
-   "read_only": 1,
-   "remember_last_selected_value": 0,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 0,
-   "set_only_once": 0,
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "default": "0", 
+   "fieldname": "synced_with_hub", 
+   "fieldtype": "Check", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Synced With Hub", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 1, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
    "unique": 0
   }
- ],
- "has_web_view": 0,
- "hide_heading": 0,
- "hide_toolbar": 0,
- "icon": "fa fa-tag",
- "idx": 2,
- "image_field": "image",
- "image_view": 0,
- "in_create": 0,
- "is_submittable": 0,
- "issingle": 0,
- "istable": 0,
- "max_attachments": 1,
- "modified": "2017-10-25 14:08:02.948326",
- "modified_by": "Administrator",
- "module": "Stock",
- "name": "Item",
- "owner": "Administrator",
+ ], 
+ "has_web_view": 0, 
+ "hide_heading": 0, 
+ "hide_toolbar": 0, 
+ "icon": "fa fa-tag", 
+ "idx": 2, 
+ "image_field": "image", 
+ "image_view": 0, 
+ "in_create": 0, 
+ "is_submittable": 0, 
+ "issingle": 0, 
+ "istable": 0, 
+ "max_attachments": 1, 
+ "modified": "2017-11-13 15:49:13.213990", 
+ "modified_by": "Administrator", 
+ "module": "Stock", 
+ "name": "Item", 
+ "owner": "Administrator", 
  "permissions": [
   {
-   "amend": 0,
-   "apply_user_permissions": 0,
-   "cancel": 0,
-   "create": 1,
-   "delete": 1,
-   "email": 1,
-   "export": 0,
-   "if_owner": 0,
-   "import": 1,
-   "permlevel": 0,
-   "print": 1,
-   "read": 1,
-   "report": 1,
-   "role": "Item Manager",
-   "set_user_permissions": 0,
-   "share": 1,
-   "submit": 0,
+   "amend": 0, 
+   "apply_user_permissions": 0, 
+   "cancel": 0, 
+   "create": 1, 
+   "delete": 1, 
+   "email": 1, 
+   "export": 0, 
+   "if_owner": 0, 
+   "import": 1, 
+   "permlevel": 0, 
+   "print": 1, 
+   "read": 1, 
+   "report": 1, 
+   "role": "Item Manager", 
+   "set_user_permissions": 0, 
+   "share": 1, 
+   "submit": 0, 
    "write": 1
-  },
+  }, 
   {
-   "amend": 0,
-   "apply_user_permissions": 0,
-   "cancel": 0,
-   "create": 0,
-   "delete": 0,
-   "email": 1,
-   "export": 0,
-   "if_owner": 0,
-   "import": 0,
-   "permlevel": 0,
-   "print": 1,
-   "read": 1,
-   "report": 1,
-   "role": "Stock Manager",
-   "set_user_permissions": 0,
-   "share": 0,
-   "submit": 0,
+   "amend": 0, 
+   "apply_user_permissions": 0, 
+   "cancel": 0, 
+   "create": 0, 
+   "delete": 0, 
+   "email": 1, 
+   "export": 0, 
+   "if_owner": 0, 
+   "import": 0, 
+   "permlevel": 0, 
+   "print": 1, 
+   "read": 1, 
+   "report": 1, 
+   "role": "Stock Manager", 
+   "set_user_permissions": 0, 
+   "share": 0, 
+   "submit": 0, 
    "write": 0
-  },
+  }, 
   {
-   "amend": 0,
-   "apply_user_permissions": 0,
-   "cancel": 0,
-   "create": 0,
-   "delete": 0,
-   "email": 1,
-   "export": 0,
-   "if_owner": 0,
-   "import": 0,
-   "permlevel": 0,
-   "print": 1,
-   "read": 1,
-   "report": 1,
-   "role": "Stock User",
-   "set_user_permissions": 0,
-   "share": 0,
-   "submit": 0,
+   "amend": 0, 
+   "apply_user_permissions": 0, 
+   "cancel": 0, 
+   "create": 0, 
+   "delete": 0, 
+   "email": 1, 
+   "export": 0, 
+   "if_owner": 0, 
+   "import": 0, 
+   "permlevel": 0, 
+   "print": 1, 
+   "read": 1, 
+   "report": 1, 
+   "role": "Stock User", 
+   "set_user_permissions": 0, 
+   "share": 0, 
+   "submit": 0, 
    "write": 0
-  },
+  }, 
   {
-   "amend": 0,
-   "apply_user_permissions": 0,
-   "cancel": 0,
-   "create": 0,
-   "delete": 0,
-   "email": 0,
-   "export": 0,
-   "if_owner": 0,
-   "import": 0,
-   "permlevel": 0,
-   "print": 0,
-   "read": 1,
-   "report": 0,
-   "role": "Sales User",
-   "set_user_permissions": 0,
-   "share": 0,
-   "submit": 0,
+   "amend": 0, 
+   "apply_user_permissions": 0, 
+   "cancel": 0, 
+   "create": 0, 
+   "delete": 0, 
+   "email": 0, 
+   "export": 0, 
+   "if_owner": 0, 
+   "import": 0, 
+   "permlevel": 0, 
+   "print": 0, 
+   "read": 1, 
+   "report": 0, 
+   "role": "Sales User", 
+   "set_user_permissions": 0, 
+   "share": 0, 
+   "submit": 0, 
    "write": 0
-  },
+  }, 
   {
-   "amend": 0,
-   "apply_user_permissions": 0,
-   "cancel": 0,
-   "create": 0,
-   "delete": 0,
-   "email": 0,
-   "export": 0,
-   "if_owner": 0,
-   "import": 0,
-   "permlevel": 0,
-   "print": 0,
-   "read": 1,
-   "report": 0,
-   "role": "Purchase User",
-   "set_user_permissions": 0,
-   "share": 0,
-   "submit": 0,
+   "amend": 0, 
+   "apply_user_permissions": 0, 
+   "cancel": 0, 
+   "create": 0, 
+   "delete": 0, 
+   "email": 0, 
+   "export": 0, 
+   "if_owner": 0, 
+   "import": 0, 
+   "permlevel": 0, 
+   "print": 0, 
+   "read": 1, 
+   "report": 0, 
+   "role": "Purchase User", 
+   "set_user_permissions": 0, 
+   "share": 0, 
+   "submit": 0, 
    "write": 0
-  },
+  }, 
   {
-   "amend": 0,
-   "apply_user_permissions": 0,
-   "cancel": 0,
-   "create": 0,
-   "delete": 0,
-   "email": 0,
-   "export": 0,
-   "if_owner": 0,
-   "import": 0,
-   "permlevel": 0,
-   "print": 0,
-   "read": 1,
-   "report": 0,
-   "role": "Maintenance User",
-   "set_user_permissions": 0,
-   "share": 0,
-   "submit": 0,
+   "amend": 0, 
+   "apply_user_permissions": 0, 
+   "cancel": 0, 
+   "create": 0, 
+   "delete": 0, 
+   "email": 0, 
+   "export": 0, 
+   "if_owner": 0, 
+   "import": 0, 
+   "permlevel": 0, 
+   "print": 0, 
+   "read": 1, 
+   "report": 0, 
+   "role": "Maintenance User", 
+   "set_user_permissions": 0, 
+   "share": 0, 
+   "submit": 0, 
    "write": 0
-  },
+  }, 
   {
-   "amend": 0,
-   "apply_user_permissions": 0,
-   "cancel": 0,
-   "create": 0,
-   "delete": 0,
-   "email": 0,
-   "export": 0,
-   "if_owner": 0,
-   "import": 0,
-   "permlevel": 0,
-   "print": 0,
-   "read": 1,
-   "report": 0,
-   "role": "Accounts User",
-   "set_user_permissions": 0,
-   "share": 0,
-   "submit": 0,
+   "amend": 0, 
+   "apply_user_permissions": 0, 
+   "cancel": 0, 
+   "create": 0, 
+   "delete": 0, 
+   "email": 0, 
+   "export": 0, 
+   "if_owner": 0, 
+   "import": 0, 
+   "permlevel": 0, 
+   "print": 0, 
+   "read": 1, 
+   "report": 0, 
+   "role": "Accounts User", 
+   "set_user_permissions": 0, 
+   "share": 0, 
+   "submit": 0, 
    "write": 0
-  },
+  }, 
   {
-   "amend": 0,
-   "apply_user_permissions": 0,
-   "cancel": 0,
-   "create": 0,
-   "delete": 0,
-   "email": 0,
-   "export": 0,
-   "if_owner": 0,
-   "import": 0,
-   "permlevel": 0,
-   "print": 0,
-   "read": 1,
-   "report": 0,
-   "role": "Manufacturing User",
-   "set_user_permissions": 0,
-   "share": 0,
-   "submit": 0,
+   "amend": 0, 
+   "apply_user_permissions": 0, 
+   "cancel": 0, 
+   "create": 0, 
+   "delete": 0, 
+   "email": 0, 
+   "export": 0, 
+   "if_owner": 0, 
+   "import": 0, 
+   "permlevel": 0, 
+   "print": 0, 
+   "read": 1, 
+   "report": 0, 
+   "role": "Manufacturing User", 
+   "set_user_permissions": 0, 
+   "share": 0, 
+   "submit": 0, 
    "write": 0
   }
- ],
- "quick_entry": 1,
- "read_only": 0,
- "read_only_onload": 0,
- "search_fields": "item_name,description,item_group,customer_code",
- "show_name_in_global_search": 1,
- "sort_field": "idx desc, modified desc",
- "sort_order": "DESC",
- "title_field": "item_name",
- "track_changes": 1,
+ ], 
+ "quick_entry": 1, 
+ "read_only": 0, 
+ "read_only_onload": 0, 
+ "search_fields": "item_name,description,item_group,customer_code", 
+ "show_name_in_global_search": 1, 
+ "sort_field": "idx desc, modified desc", 
+ "sort_order": "DESC", 
+ "title_field": "item_name", 
+ "track_changes": 1, 
  "track_seen": 0
 }
\ No newline at end of file
diff --git a/erpnext/stock/doctype/item/item.py b/erpnext/stock/doctype/item/item.py
index 6790176..5a35e81 100644
--- a/erpnext/stock/doctype/item/item.py
+++ b/erpnext/stock/doctype/item/item.py
@@ -9,6 +9,7 @@
 from frappe import msgprint, _
 from frappe.utils import (cstr, flt, cint, getdate, now_datetime, formatdate,
 	strip, get_timestamp, random_string)
+from frappe.utils.html_utils import clean_html
 from frappe.website.website_generator import WebsiteGenerator
 from erpnext.setup.doctype.item_group.item_group import invalidate_cache_for, get_parent_item_groups
 from frappe.website.render import clear_cache
@@ -30,14 +31,11 @@
 	def onload(self):
 		super(Item, self).onload()
 
-		self.set_onload('sle_exists', self.check_if_sle_exists())
+		self.set_onload('stock_exists', self.stock_ledger_created())
 		if self.is_fixed_asset:
 			asset = frappe.db.get_all("Asset", filters={"item_code": self.name, "docstatus": 1}, limit=1)
 			self.set_onload("asset_exists", True if asset else False)
 
-		if frappe.db.get_value('Stock Ledger Entry', {'item_code': self.name}):
-			self.set_onload('stock_exists', True)
-
 	def autoname(self):
 		if frappe.db.get_default("item_naming_by")=="Naming Series":
 			if self.variant_of:
@@ -69,9 +67,7 @@
 			self.set_opening_stock()
 
 	def validate(self):
-		self.before_update = None
-		if frappe.db.exists('Item', self.name):
-			self.before_update = frappe.get_doc('Item', self.name)
+		self.get_doc_before_save()
 
 		super(Item, self).validate()
 
@@ -82,6 +78,7 @@
 			self.description = self.item_name
 
 		self.validate_uom()
+		self.validate_description()
 		self.add_default_uom_in_conversion_factor_table()
 		self.validate_conversion_factor()
 		self.validate_item_type()
@@ -89,7 +86,6 @@
 		self.fill_customer_code()
 		self.check_item_tax()
 		self.validate_barcode()
-		self.cant_change()
 		self.validate_warehouse_for_reorder()
 		self.update_bom_item_desc()
 		self.synced_with_hub = 0
@@ -115,6 +111,11 @@
 		self.update_item_price()
 		self.update_template_item()
 
+	def validate_description(self):
+		'''Clean HTML description if set'''
+		if cint(frappe.db.get_single_value('Stock Settings', 'clean_description_html')):
+			self.description = clean_html(self.description)
+
 	def add_price(self, price_list=None):
 		'''Add a new price'''
 		if not price_list:
@@ -247,6 +248,14 @@
 			if not self.asset_category:
 				frappe.throw(_("Asset Category is mandatory for Fixed Asset item"))
 
+			if self.stock_ledger_created():
+				frappe.throw(_("Cannot be a fixed asset item as Stock Ledger is created."))
+
+		if not self.is_fixed_asset:
+			asset = frappe.db.get_all("Asset", filters={"item_code": self.name, "docstatus": 1}, limit=1)
+			if asset:
+				frappe.throw(_('"Is Fixed Asset" cannot be unchecked, as Asset record exists against the item'))
+
 	def get_context(self, context):
 		context.show_search=True
 		context.search_link = '/product_search'
@@ -456,62 +465,27 @@
 			if duplicate:
 				frappe.throw(_("Barcode {0} already used in Item {1}").format(self.barcode, duplicate[0][0]))
 
-	def cant_change(self):
-		if not self.get("__islocal"):
-			to_check = ("has_serial_no", "is_stock_item",
-				"valuation_method", "has_batch_no", "is_fixed_asset")
 
-			vals = frappe.db.get_value("Item", self.name, to_check, as_dict=True)
-			if not vals.get('valuation_method') and self.get('valuation_method'):
-				vals['valuation_method'] = frappe.db.get_single_value("Stock Settings", "valuation_method") or "FIFO"
-
-			if vals:
-				for key in to_check:
-					if cstr(self.get(key)) != cstr(vals.get(key)):
-						if not self.check_if_linked_document_exists(key):
-							break # no linked document, allowed
-						else:
-							frappe.throw(_("As there are existing transactions against item {0}, you can not change the value of {1}").format(self.name, frappe.bold(self.meta.get_label(key))))
-
-			if vals and not self.is_fixed_asset and self.is_fixed_asset != vals.is_fixed_asset:
-				asset = frappe.db.get_all("Asset", filters={"item_code": self.name, "docstatus": 1}, limit=1)
-				if asset:
-					frappe.throw(_('"Is Fixed Asset" cannot be unchecked, as Asset record exists against the item'))
-
-	def check_if_linked_document_exists(self, key):
-		linked_doctypes = ["Delivery Note Item", "Sales Invoice Item", "Purchase Receipt Item",
-			"Purchase Invoice Item", "Stock Entry Detail", "Stock Reconciliation Item"]
-
-		# For "Is Stock Item", following doctypes is important
-		# because reserved_qty, ordered_qty and requested_qty updated from these doctypes
-		if key == "is_stock_item":
-			linked_doctypes += ["Sales Order Item", "Purchase Order Item", "Material Request Item"]
-
-		for doctype in linked_doctypes:
-			if frappe.db.get_value(doctype, filters={"item_code": self.name, "docstatus": 1}) or \
-				frappe.db.get_value("Production Order",
-					filters={"production_item": self.name, "docstatus": 1}):
-				return True
-
+	def validate_warehouse_for_reorder(self):
+		'''Validate Reorder level table for duplicate and conditional mandatory'''
+		warehouse = []
 		for d in self.get("reorder_levels"):
+			if not d.warehouse_group:
+				d.warehouse_group = d.warehouse
+			if d.get("warehouse") and d.get("warehouse") not in warehouse:
+				warehouse += [d.get("warehouse")]
+			else:
+				frappe.throw(_("Row {0}: An Reorder entry already exists for this warehouse {1}")
+					.format(d.idx, d.warehouse), DuplicateReorderRows)
+
 			if d.warehouse_reorder_level and not d.warehouse_reorder_qty:
 				frappe.throw(_("Row #{0}: Please set reorder quantity").format(d.idx))
 
-	def validate_warehouse_for_reorder(self):
-		warehouse = []
-		for i in self.get("reorder_levels"):
-			if not i.warehouse_group:
-				i.warehouse_group = i.warehouse
-			if i.get("warehouse") and i.get("warehouse") not in warehouse:
-				warehouse += [i.get("warehouse")]
-			else:
-				frappe.throw(_("Row {0}: An Reorder entry already exists for this warehouse {1}")
-					.format(i.idx, i.warehouse), DuplicateReorderRows)
-
-	def check_if_sle_exists(self):
-		sle = frappe.db.sql("""select name from `tabStock Ledger Entry`
-			where item_code = %s""", self.name)
-		return sle and 'exists' or 'not exists'
+	def stock_ledger_created(self):
+		if not hasattr(self, '_stock_ledger_created'):
+			self._stock_ledger_created = len(frappe.db.sql("""select name from `tabStock Ledger Entry`
+				where item_code = %s limit 1""", self.name))
+		return self._stock_ledger_created
 
 	def validate_name_with_item_group(self):
 		# causes problem with tree build
@@ -638,19 +612,19 @@
 				template_item.save()
 
 	def update_variants(self):
-			if self.flags.dont_update_variants or \
-				frappe.db.get_single_value('Item Variant Settings', 'do_not_update_variants'):
-				return
-			if self.has_variants:
-				updated = []
-				variants = frappe.db.get_all("Item", fields=["item_code"], filters={"variant_of": self.name })
-				for d in variants:
-					variant = frappe.get_doc("Item", d)
-					copy_attributes_to_variant(self, variant)
-					variant.save()
-					updated.append(d.item_code)
-				if updated:
-					frappe.msgprint(_("Item Variants {0} updated").format(", ".join(updated)))
+		if self.flags.dont_update_variants or \
+			frappe.db.get_single_value('Item Variant Settings', 'do_not_update_variants'):
+			return
+		if self.has_variants:
+			updated = []
+			variants = frappe.db.get_all("Item", fields=["item_code"], filters={"variant_of": self.name })
+			for d in variants:
+				variant = frappe.get_doc("Item", d)
+				copy_attributes_to_variant(self, variant)
+				variant.save()
+				updated.append(d.item_code)
+			if updated:
+				frappe.msgprint(_("Item Variants {0} updated").format(", ".join(updated)))
 
 	def validate_has_variants(self):
 		if not self.has_variants and frappe.db.get_value("Item", self.name, "has_variants"):
@@ -658,10 +632,16 @@
 				frappe.throw(_("Item has variants."))
 
 	def validate_stock_exists_for_template_item(self):
-		if self.has_variants and \
-			frappe.db.get_value('Stock Ledger Entry', {'item_code': self.name}):
-			frappe.throw(_("As stock exists against an item {0}, you can not enable has variants property")
-				.format(self.name), StockExistsForTemplate)
+		if self.stock_ledger_created():
+			if ((self._doc_before_save
+				and self._doc_before_save.has_variants != self.has_variants)
+				or self.variant_of != self._doc_before_save.variant_of):
+				frappe.throw(_("Cannot change Variant properties after stock transction. You will have to make a new Item to do this.").format(self.name),
+					StockExistsForTemplate)
+
+			if self.has_variants or self.variant_of:
+				if not self.is_child_table_same('attributes'):
+					frappe.throw(_('Cannot change Attributes after stock transaction. Make a new Item and transfer stock to the new Item'))
 
 	def validate_uom(self):
 		if not self.get("__islocal"):
diff --git a/erpnext/crm/doctype/item/test_item.js b/erpnext/stock/doctype/item/tests/test_item.js
similarity index 98%
rename from erpnext/crm/doctype/item/test_item.js
rename to erpnext/stock/doctype/item/tests/test_item.js
index c9b14ca..5e3524e 100644
--- a/erpnext/crm/doctype/item/test_item.js
+++ b/erpnext/stock/doctype/item/tests/test_item.js
@@ -1,3 +1,4 @@
+QUnit.module('stock');
 QUnit.test("test: item", function (assert) {
 	assert.expect(6);
 	let done = assert.async();
diff --git a/erpnext/stock/doctype/item_price/test_item_price.js b/erpnext/stock/doctype/item_price/test_item_price.js
new file mode 100644
index 0000000..6383fb0
--- /dev/null
+++ b/erpnext/stock/doctype/item_price/test_item_price.js
@@ -0,0 +1,22 @@
+QUnit.module('Stock');
+
+QUnit.test("test item price", function(assert) {
+	assert.expect(2);
+	let done = assert.async();
+	frappe.run_serially([
+		() => {
+			return frappe.tests.make('Item Price', [
+				{price_list:'Test-Selling-USD'},
+				{item_code: 'Test Product 3'},
+				{price_list_rate: 200}
+			]);
+		},
+		() => cur_frm.save(),
+		() => {
+			assert.ok(cur_frm.doc.item_name == 'Test Product 3', "Item name correct");
+			assert.ok(cur_frm.doc.price_list_rate == 200, "Price list rate correct");
+		},
+		() => frappe.timeout(0.3),
+		() => done()
+	]);
+});
\ No newline at end of file
diff --git a/erpnext/stock/doctype/item_variant_settings/item_variant_settings.json b/erpnext/stock/doctype/item_variant_settings/item_variant_settings.json
index 8bdd46c..8ad73d1 100644
--- a/erpnext/stock/doctype/item_variant_settings/item_variant_settings.json
+++ b/erpnext/stock/doctype/item_variant_settings/item_variant_settings.json
@@ -47,7 +47,7 @@
    "bold": 0, 
    "collapsible": 0, 
    "columns": 0, 
-   "description": "If enabled then system will not update the fields of variants from the template but will copy the data of below mentioned fields while making new variant", 
+   "description": "Fields will be copied over only at time of creation.", 
    "fieldname": "do_not_update_variants", 
    "fieldtype": "Check", 
    "hidden": 0, 
@@ -57,7 +57,7 @@
    "in_global_search": 0, 
    "in_list_view": 0, 
    "in_standard_filter": 0, 
-   "label": "Do not Update Variants", 
+   "label": "Do not update variants on save", 
    "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
@@ -144,7 +144,7 @@
  "issingle": 1, 
  "istable": 0, 
  "max_attachments": 0, 
- "modified": "2017-11-08 11:38:12.821404", 
+ "modified": "2017-11-14 15:54:12.190518", 
  "modified_by": "Administrator", 
  "module": "Stock", 
  "name": "Item Variant Settings", 
diff --git a/erpnext/stock/doctype/packing_slip/packing_slip.py b/erpnext/stock/doctype/packing_slip/packing_slip.py
index 25fde08..ec5392f 100644
--- a/erpnext/stock/doctype/packing_slip/packing_slip.py
+++ b/erpnext/stock/doctype/packing_slip/packing_slip.py
@@ -2,11 +2,13 @@
 # License: GNU General Public License v3. See license.txt
 
 from __future__ import unicode_literals
-import frappe
-from frappe.utils import flt, cint
-from frappe import _
 
+import frappe
+from frappe import _
+from frappe.model import no_value_fields
 from frappe.model.document import Document
+from frappe.utils import cint, flt
+
 
 class PackingSlip(Document):
 
@@ -84,11 +86,12 @@
 			* No. of Cases of this packing slip
 		"""
 
-		# also pick custom fields from delivery note
 		rows = [d.item_code for d in self.get("items")]
 
-		custom_fields = ', '.join(['dni.`{0}`'.format(d.fieldname) for d in \
-			frappe.get_meta("Delivery Note Item").get_custom_fields()])
+		# also pick custom fields from delivery note
+		custom_fields = ', '.join(['dni.`{0}`'.format(d.fieldname)
+			for d in frappe.get_meta("Delivery Note Item").get_custom_fields()
+			if d.fieldtype not in no_value_fields])
 
 		if custom_fields:
 			custom_fields = ', ' + custom_fields
diff --git a/erpnext/stock/doctype/stock_settings/stock_settings.json b/erpnext/stock/doctype/stock_settings/stock_settings.json
index 4801d40..16726be 100644
--- a/erpnext/stock/doctype/stock_settings/stock_settings.json
+++ b/erpnext/stock/doctype/stock_settings/stock_settings.json
@@ -1,5 +1,6 @@
 {
  "allow_copy": 0, 
+ "allow_guest_to_view": 0, 
  "allow_import": 0, 
  "allow_rename": 0, 
  "beta": 0, 
@@ -11,6 +12,7 @@
  "editable_grid": 0, 
  "fields": [
   {
+   "allow_bulk_edit": 0, 
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
@@ -22,6 +24,7 @@
    "ignore_user_permissions": 0, 
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
+   "in_global_search": 0, 
    "in_list_view": 1, 
    "in_standard_filter": 0, 
    "label": "Item Naming By", 
@@ -40,6 +43,7 @@
    "unique": 0
   }, 
   {
+   "allow_bulk_edit": 0, 
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
@@ -51,6 +55,7 @@
    "ignore_user_permissions": 0, 
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
+   "in_global_search": 0, 
    "in_list_view": 1, 
    "in_standard_filter": 0, 
    "label": "Default Item Group", 
@@ -69,6 +74,7 @@
    "unique": 0
   }, 
   {
+   "allow_bulk_edit": 0, 
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
@@ -79,6 +85,7 @@
    "ignore_user_permissions": 0, 
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
+   "in_global_search": 0, 
    "in_list_view": 1, 
    "in_standard_filter": 0, 
    "label": "Default Stock UOM", 
@@ -97,6 +104,7 @@
    "unique": 0
   }, 
   {
+   "allow_bulk_edit": 0, 
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
@@ -107,6 +115,7 @@
    "ignore_user_permissions": 0, 
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
+   "in_global_search": 0, 
    "in_list_view": 0, 
    "in_standard_filter": 0, 
    "label": "Default Warehouse", 
@@ -126,6 +135,38 @@
    "unique": 0
   }, 
   {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "default": "1", 
+   "fieldname": "clean_description_html", 
+   "fieldtype": "Check", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Convert Item Description to Clean HTML", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
@@ -136,6 +177,7 @@
    "ignore_user_permissions": 0, 
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
+   "in_global_search": 0, 
    "in_list_view": 0, 
    "in_standard_filter": 0, 
    "length": 0, 
@@ -152,6 +194,7 @@
    "unique": 0
   }, 
   {
+   "allow_bulk_edit": 0, 
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
@@ -162,6 +205,7 @@
    "ignore_user_permissions": 0, 
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
+   "in_global_search": 0, 
    "in_list_view": 0, 
    "in_standard_filter": 0, 
    "label": "Default Valuation Method", 
@@ -180,6 +224,7 @@
    "unique": 0
   }, 
   {
+   "allow_bulk_edit": 0, 
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
@@ -191,6 +236,7 @@
    "ignore_user_permissions": 0, 
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
+   "in_global_search": 0, 
    "in_list_view": 0, 
    "in_standard_filter": 0, 
    "label": "Limit Percent", 
@@ -208,6 +254,7 @@
    "unique": 0
   }, 
   {
+   "allow_bulk_edit": 0, 
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
@@ -219,6 +266,7 @@
    "ignore_user_permissions": 0, 
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
+   "in_global_search": 0, 
    "in_list_view": 0, 
    "in_standard_filter": 0, 
    "label": "Show Barcode Field", 
@@ -237,6 +285,7 @@
    "unique": 0
   }, 
   {
+   "allow_bulk_edit": 0, 
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
@@ -247,6 +296,7 @@
    "ignore_user_permissions": 0, 
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
+   "in_global_search": 0, 
    "in_list_view": 0, 
    "in_standard_filter": 0, 
    "length": 0, 
@@ -264,6 +314,7 @@
    "unique": 0
   }, 
   {
+   "allow_bulk_edit": 0, 
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
@@ -274,6 +325,7 @@
    "ignore_user_permissions": 0, 
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
+   "in_global_search": 0, 
    "in_list_view": 0, 
    "in_standard_filter": 0, 
    "label": "Auto insert Price List rate if missing", 
@@ -292,6 +344,7 @@
    "unique": 0
   }, 
   {
+   "allow_bulk_edit": 0, 
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
@@ -302,6 +355,7 @@
    "ignore_user_permissions": 0, 
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
+   "in_global_search": 0, 
    "in_list_view": 0, 
    "in_standard_filter": 0, 
    "label": "Allow Negative Stock", 
@@ -319,6 +373,7 @@
    "unique": 0
   }, 
   {
+   "allow_bulk_edit": 0, 
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
@@ -329,6 +384,7 @@
    "ignore_user_permissions": 0, 
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
+   "in_global_search": 0, 
    "in_list_view": 0, 
    "in_standard_filter": 0, 
    "length": 0, 
@@ -346,6 +402,7 @@
    "unique": 0
   }, 
   {
+   "allow_bulk_edit": 0, 
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
@@ -357,6 +414,7 @@
    "ignore_user_permissions": 0, 
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
+   "in_global_search": 0, 
    "in_list_view": 0, 
    "in_standard_filter": 0, 
    "label": "Automatically Set Serial Nos based on FIFO", 
@@ -375,6 +433,7 @@
    "unique": 0
   }, 
   {
+   "allow_bulk_edit": 0, 
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
@@ -385,6 +444,7 @@
    "ignore_user_permissions": 0, 
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
+   "in_global_search": 0, 
    "in_list_view": 0, 
    "in_standard_filter": 0, 
    "label": "Auto Material Request", 
@@ -402,6 +462,7 @@
    "unique": 0
   }, 
   {
+   "allow_bulk_edit": 0, 
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
@@ -412,6 +473,7 @@
    "ignore_user_permissions": 0, 
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
+   "in_global_search": 0, 
    "in_list_view": 0, 
    "in_standard_filter": 0, 
    "label": "Raise Material Request when stock reaches re-order level", 
@@ -429,6 +491,7 @@
    "unique": 0
   }, 
   {
+   "allow_bulk_edit": 0, 
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
@@ -439,6 +502,7 @@
    "ignore_user_permissions": 0, 
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
+   "in_global_search": 0, 
    "in_list_view": 0, 
    "in_standard_filter": 0, 
    "label": "Notify by Email on creation of automatic Material Request", 
@@ -456,6 +520,7 @@
    "unique": 0
   }, 
   {
+   "allow_bulk_edit": 0, 
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
@@ -466,6 +531,7 @@
    "ignore_user_permissions": 0, 
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
+   "in_global_search": 0, 
    "in_list_view": 0, 
    "in_standard_filter": 0, 
    "label": "Freeze Stock Entries", 
@@ -483,6 +549,7 @@
    "unique": 0
   }, 
   {
+   "allow_bulk_edit": 0, 
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
@@ -493,6 +560,7 @@
    "ignore_user_permissions": 0, 
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
+   "in_global_search": 0, 
    "in_list_view": 0, 
    "in_standard_filter": 0, 
    "label": "Stock Frozen Upto", 
@@ -510,6 +578,7 @@
    "unique": 0
   }, 
   {
+   "allow_bulk_edit": 0, 
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
@@ -520,6 +589,7 @@
    "ignore_user_permissions": 0, 
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
+   "in_global_search": 0, 
    "in_list_view": 0, 
    "in_standard_filter": 0, 
    "label": "Freeze Stocks Older Than [Days]", 
@@ -537,6 +607,7 @@
    "unique": 0
   }, 
   {
+   "allow_bulk_edit": 0, 
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
@@ -547,6 +618,7 @@
    "ignore_user_permissions": 0, 
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
+   "in_global_search": 0, 
    "in_list_view": 0, 
    "in_standard_filter": 0, 
    "label": "Role Allowed to edit frozen stock", 
@@ -565,18 +637,18 @@
    "unique": 0
   }
  ], 
+ "has_web_view": 0, 
  "hide_heading": 0, 
  "hide_toolbar": 0, 
  "icon": "icon-cog", 
  "idx": 1, 
  "image_view": 0, 
  "in_create": 0, 
- "in_dialog": 0, 
  "is_submittable": 0, 
  "issingle": 1, 
  "istable": 0, 
  "max_attachments": 0, 
- "modified": "2016-12-16 02:18:58.187847", 
+ "modified": "2017-11-14 16:19:50.274518", 
  "modified_by": "Administrator", 
  "module": "Stock", 
  "name": "Stock Settings", 
@@ -592,7 +664,6 @@
    "export": 0, 
    "if_owner": 0, 
    "import": 0, 
-   "is_custom": 0, 
    "permlevel": 0, 
    "print": 1, 
    "read": 1, 
@@ -607,6 +678,8 @@
  "quick_entry": 1, 
  "read_only": 0, 
  "read_only_onload": 0, 
+ "show_name_in_global_search": 0, 
  "sort_order": "ASC", 
+ "track_changes": 0, 
  "track_seen": 0
 }
\ No newline at end of file
diff --git a/erpnext/stock/doctype/stock_settings/stock_settings.py b/erpnext/stock/doctype/stock_settings/stock_settings.py
index 186eaee..89ece33 100644
--- a/erpnext/stock/doctype/stock_settings/stock_settings.py
+++ b/erpnext/stock/doctype/stock_settings/stock_settings.py
@@ -7,6 +7,7 @@
 import frappe
 from frappe import _
 from frappe.model.document import Document
+from frappe.utils.html_utils import clean_html
 
 class StockSettings(Document):
 	def validate(self):
@@ -26,19 +27,34 @@
 		# show/hide barcode field
 		frappe.make_property_setter({'fieldname': 'barcode', 'property': 'hidden',
 			'value': 0 if self.show_barcode_field else 1})
-			
+
 		self.cant_change_valuation_method()
-		
+		self.validate_clean_description_html()
+
 	def cant_change_valuation_method(self):
 		db_valuation_method = frappe.db.get_single_value("Stock Settings", "valuation_method")
-		
+
 		if db_valuation_method and db_valuation_method != self.valuation_method:
-			# check if there are any stock ledger entries against items 
+			# check if there are any stock ledger entries against items
 			# which does not have it's own valuation method
 			sle = frappe.db.sql("""select name from `tabStock Ledger Entry` sle
-				where exists(select name from tabItem 
-					where name=sle.item_code and (valuation_method is null or valuation_method=''))
+				where exists(select name from tabItem
+					where name=sle.item_code and (valuation_method is null or valuation_method='')) limit 1
 			""")
-			
+
 			if sle:
-				frappe.throw(_("Can't change valuation method, as there are transactions against some items which does not have it's own valuation method"))
\ No newline at end of file
+				frappe.throw(_("Can't change valuation method, as there are transactions against some items which does not have it's own valuation method"))
+
+	def validate_clean_description_html(self):
+		if int(self.clean_description_html or 0) \
+			and not int(self.db_get('clean_description_html') or 0):
+			# changed to text
+			frappe.enqueue('erpnext.stock.doctype.stock_settings.stock_settings.clean_all_descriptions', now=frappe.flags.in_test)
+
+
+def clean_all_descriptions():
+	for item in frappe.get_all('Item', ['name', 'description']):
+		if item.description:
+			clean_description = clean_html(item.description)
+		if item.description != clean_description:
+			frappe.db.set_value('Item', item.name, 'description', clean_description)
diff --git a/erpnext/stock/doctype/stock_settings/test_stock_settings.js b/erpnext/stock/doctype/stock_settings/test_stock_settings.js
new file mode 100644
index 0000000..57d9fc6
--- /dev/null
+++ b/erpnext/stock/doctype/stock_settings/test_stock_settings.js
@@ -0,0 +1,23 @@
+/* eslint-disable */
+// rename this file from _test_[name] to test_[name] to activate
+// and remove above this line
+
+QUnit.test("test: Stock Settings", function (assert) {
+	let done = assert.async();
+
+	// number of asserts
+	assert.expect(1);
+
+	frappe.run_serially([
+		// insert a new Stock Settings
+		() => frappe.tests.make('Stock Settings', [
+			// values to be set
+			{key: 'value'}
+		]),
+		() => {
+			assert.equal(cur_frm.doc.key, 'value');
+		},
+		() => done()
+	]);
+
+});
diff --git a/erpnext/stock/doctype/stock_settings/test_stock_settings.py b/erpnext/stock/doctype/stock_settings/test_stock_settings.py
new file mode 100644
index 0000000..43c0c57
--- /dev/null
+++ b/erpnext/stock/doctype/stock_settings/test_stock_settings.py
@@ -0,0 +1,54 @@
+# -*- coding: utf-8 -*-
+# Copyright (c) 2017, Frappe Technologies Pvt. Ltd. and Contributors
+# See license.txt
+from __future__ import unicode_literals
+
+import frappe
+import unittest
+
+class TestStockSettings(unittest.TestCase):
+	def setUp(self):
+		settings = frappe.get_single('Stock Settings')
+		settings.clean_description_html = 0
+		settings.save()
+
+		frappe.delete_doc('Item', 'Item for description test')
+
+	def tearDown(self):
+		settings = frappe.get_single('Stock Settings')
+		settings.clean_description_html = 1
+		settings.save()
+
+	def test_settings(self):
+		item = frappe.get_doc(dict(
+			doctype = 'Item',
+			item_code = 'Item for description test',
+			item_group = 'Products',
+			description = '<p><span style="font-size: 12px;">Drawing No. 07-xxx-PO132<br></span><span style="font-size: 12px;">1800 x 1685 x 750<br></span><span style="font-size: 12px;">All parts made of Marine Ply<br></span><span style="font-size: 12px;">Top w/ Corian dd<br></span><span style="font-size: 12px;">CO, CS, VIP Day Cabin</span></p>'
+		)).insert()
+
+		settings = frappe.get_single('Stock Settings')
+		settings.clean_description_html = 1
+		settings.save()
+
+		item.reload()
+
+		self.assertEquals(item.description, '<p>Drawing No. 07-xxx-PO132<br>1800 x 1685 x 750<br>All parts made of Marine Ply<br>Top w/ Corian dd<br>CO, CS, VIP Day Cabin</p>')
+
+		item.delete()
+
+	def test_clean_html(self):
+		settings = frappe.get_single('Stock Settings')
+		settings.clean_description_html = 1
+		settings.save()
+
+		item = frappe.get_doc(dict(
+			doctype = 'Item',
+			item_code = 'Item for description test',
+			item_group = 'Products',
+			description = '<p><span style="font-size: 12px;">Drawing No. 07-xxx-PO132<br></span><span style="font-size: 12px;">1800 x 1685 x 750<br></span><span style="font-size: 12px;">All parts made of Marine Ply<br></span><span style="font-size: 12px;">Top w/ Corian dd<br></span><span style="font-size: 12px;">CO, CS, VIP Day Cabin</span></p>'
+		)).insert()
+
+		self.assertEquals(item.description, '<p>Drawing No. 07-xxx-PO132<br>1800 x 1685 x 750<br>All parts made of Marine Ply<br>Top w/ Corian dd<br>CO, CS, VIP Day Cabin</p>')
+
+		item.delete()
diff --git a/erpnext/stock/doctype/warehouse/warehouse.py b/erpnext/stock/doctype/warehouse/warehouse.py
index b0335d7..5186408 100644
--- a/erpnext/stock/doctype/warehouse/warehouse.py
+++ b/erpnext/stock/doctype/warehouse/warehouse.py
@@ -57,13 +57,15 @@
 
 	def check_if_sle_exists(self):
 		return frappe.db.sql("""select name from `tabStock Ledger Entry`
-			where warehouse = %s""", self.name)
+			where warehouse = %s limit 1""", self.name)
 
 	def check_if_child_exists(self):
 		return frappe.db.sql("""select name from `tabWarehouse`
-			where parent_warehouse = %s""", self.name)
+			where parent_warehouse = %s limit 1""", self.name)
 
 	def before_rename(self, old_name, new_name, merge=False):
+		super(Warehouse, self).before_rename(old_name, new_name, merge)
+
 		# Add company abbr if not provided
 		new_warehouse = erpnext.encode_company_abbr(new_name, self.company)
 
@@ -77,19 +79,21 @@
 		return new_warehouse
 
 	def after_rename(self, old_name, new_name, merge=False):
+		super(Warehouse, self).after_rename(old_name, new_name, merge)
+
 		new_warehouse_name = self.get_new_warehouse_name_without_abbr(new_name)
 		self.db_set("warehouse_name", new_warehouse_name)
-				
+
 		if merge:
 			self.recalculate_bin_qty(new_name)
-			
+
 	def get_new_warehouse_name_without_abbr(self, name):
 		company_abbr = frappe.db.get_value("Company", self.company, "abbr")
 		parts = name.rsplit(" - ", 1)
-		
+
 		if parts[-1].lower() == company_abbr.lower():
 			name = parts[0]
-			
+
 		return name
 
 	def recalculate_bin_qty(self, new_name):
@@ -135,25 +139,19 @@
 			return 1
 
 @frappe.whitelist()
-def get_children():
+def get_children(doctype, parent=None, company=None, is_root=False):
 	from erpnext.stock.utils import get_stock_value_on
-	doctype = frappe.local.form_dict.get('doctype')
-	company = frappe.local.form_dict.get('company')
 
-	parent_field = 'parent_' + doctype.lower().replace(' ', '_')
-	parent = frappe.form_dict.get("parent") or ""
-
-	if parent == "Warehouses":
+	if is_root:
 		parent = ""
 
 	warehouses = frappe.db.sql("""select name as value,
 		is_group as expandable
-		from `tab{doctype}`
+		from `tabWarehouse`
 		where docstatus < 2
-		and ifnull(`{parent_field}`,'') = %s
+		and ifnull(`parent_warehouse`,'') = %s
 		and (`company` = %s or company is null or company = '')
-		order by name""".format(doctype=frappe.db.escape(doctype),
-		parent_field=frappe.db.escape(parent_field)), (parent, company), as_dict=1)
+		order by name""", (parent, company), as_dict=1)
 
 	# return warehouses
 	for wh in warehouses:
diff --git a/erpnext/stock/reorder_item.py b/erpnext/stock/reorder_item.py
index 01a6a6d..46b8840 100644
--- a/erpnext/stock/reorder_item.py
+++ b/erpnext/stock/reorder_item.py
@@ -90,11 +90,12 @@
 		
 		warehouse_doc = frappe.get_doc("Warehouse", warehouse)
 		
-		if warehouse_doc.parent_warehouse:
+		while warehouse_doc.parent_warehouse:
 			if not item_warehouse_projected_qty.get(item_code, {}).get(warehouse_doc.parent_warehouse):
 				item_warehouse_projected_qty.setdefault(item_code, {})[warehouse_doc.parent_warehouse] = flt(projected_qty)
 			else:
 				item_warehouse_projected_qty[item_code][warehouse_doc.parent_warehouse] += flt(projected_qty)
+			warehouse_doc = frappe.get_doc("Warehouse", warehouse_doc.parent_warehouse)
 				
 	return item_warehouse_projected_qty
 
diff --git a/erpnext/stock/report/ordered_items_to_be_delivered/ordered_items_to_be_delivered.json b/erpnext/stock/report/ordered_items_to_be_delivered/ordered_items_to_be_delivered.json
index ed48a0f..58b1be4 100644
--- a/erpnext/stock/report/ordered_items_to_be_delivered/ordered_items_to_be_delivered.json
+++ b/erpnext/stock/report/ordered_items_to_be_delivered/ordered_items_to_be_delivered.json
@@ -1,5 +1,5 @@
 {
- "add_total_row": 0, 
+ "add_total_row": 1, 
  "apply_user_permissions": 1, 
  "creation": "2013-02-22 18:01:55", 
  "disabled": 0, 
@@ -7,7 +7,7 @@
  "doctype": "Report", 
  "idx": 3, 
  "is_standard": "Yes", 
- "modified": "2017-09-18 12:28:49.322622", 
+ "modified": "2017-11-06 13:05:38.965229", 
  "modified_by": "Administrator", 
  "module": "Stock", 
  "name": "Ordered Items To Be Delivered", 
diff --git a/erpnext/support/doctype/issue/issue.js b/erpnext/support/doctype/issue/issue.js
index 306736f..77c59f4 100644
--- a/erpnext/support/doctype/issue/issue.js
+++ b/erpnext/support/doctype/issue/issue.js
@@ -4,7 +4,7 @@
 	},
 
 	"refresh": function(frm) {
-		if(frm.doc.status==="Open") {
+		if(frm.doc.status!=="Closed") {
 			frm.add_custom_button(__("Close"), function() {
 				frm.set_value("status", "Closed");
 				frm.save();
diff --git a/erpnext/tests/ui/tests.txt b/erpnext/tests/ui/tests.txt
index e7de604..3e40485 100644
--- a/erpnext/tests/ui/tests.txt
+++ b/erpnext/tests/ui/tests.txt
@@ -9,7 +9,7 @@
 erpnext/crm/doctype/lead/test_lead.js
 erpnext/crm/doctype/opportunity/test_opportunity.js
 erpnext/setup/doctype/company/tests/test_company_production.js
-erpnext/crm/doctype/item/test_item.js
+erpnext/stock/doctype/item/tests/test_item.js
 erpnext/selling/doctype/quotation/tests/test_quotation_with_discount_on_grand_total.js
 erpnext/selling/doctype/quotation/tests/test_quotation_with_item_wise_discount.js
 erpnext/selling/doctype/quotation/tests/test_quotation_with_multi_uom.js
@@ -50,8 +50,8 @@
 erpnext/schools/doctype/instructor/test_instructor.js
 erpnext/stock/doctype/warehouse/test_warehouse.js
 erpnext/manufacturing/doctype/production_order/test_production_order.js #long
-erpnext/selling/page/point_of_sale/tests/test_point_of_sale.js
 erpnext/accounts/page/pos/test_pos.js
+erpnext/selling/page/point_of_sale/tests/test_point_of_sale.js
 erpnext/selling/doctype/product_bundle/test_product_bundle.js
 erpnext/stock/doctype/delivery_note/test_delivery_note.js
 erpnext/stock/doctype/material_request/tests/test_material_request.js
@@ -133,3 +133,9 @@
 erpnext/restaurant/doctype/restaurant_table/test_restaurant_table.js
 erpnext/restaurant/doctype/restaurant_menu/test_restaurant_menu.js
 erpnext/restaurant/doctype/restaurant_order_entry/restaurant_order_entry.js
+erpnext/projects/doctype/task/tests/test_task_tree.js
+erpnext/stock/doctype/item_price/test_item_price.js
+erpnext/stock/doctype/delivery_note/test_delivery_note_with_margin.js
+erpnext/selling/doctype/sales_order/tests/test_sales_order_with_margin.js
+erpnext/selling/doctype/quotation/tests/test_quotation_with_margin.js
+erpnext/accounts/doctype/sales_invoice/tests/test_sales_invoice_with_margin.js
diff --git a/requirements.txt b/requirements.txt
index 0e81b15..0bfd3df 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -1,2 +1,3 @@
 frappe
 unidecode
+pygithub