Merge pull request #7038 from KanchanChauhan/pricing-rule-in-shopping-cart

Apply Pricing Rule in Shopping Cart
diff --git a/erpnext/__init__.py b/erpnext/__init__.py
index b9846c8..85ac910 100644
--- a/erpnext/__init__.py
+++ b/erpnext/__init__.py
@@ -2,7 +2,7 @@
 from __future__ import unicode_literals
 import frappe
 
-__version__ = '7.1.15'
+__version__ = '7.1.20'
 
 def get_default_company(user=None):
 	'''Get default company for user'''
diff --git a/erpnext/accounts/doctype/account/account_tree.js b/erpnext/accounts/doctype/account/account_tree.js
index e63c797..fc6a1b4 100644
--- a/erpnext/accounts/doctype/account/account_tree.js
+++ b/erpnext/accounts/doctype/account/account_tree.js
@@ -27,9 +27,12 @@
 		{fieldtype:'Check', fieldname:'is_group', label:__('Is Group'),
 			description: __('Further accounts can be made under Groups, but entries can be made against non-Groups')},
 		{fieldtype:'Select', fieldname:'root_type', label:__('Root Type'),
-			options: ['Asset', 'Liability', 'Equity', 'Income', 'Expense'].join('\n')},
+			options: ['Asset', 'Liability', 'Equity', 'Income', 'Expense'].join('\n'),
+			depends_on: 'eval:doc.is_group && !doc.parent_account'},
 		{fieldtype:'Select', fieldname:'account_type', label:__('Account Type'),
-			options: ['', 'Bank', 'Cash', 'Stock', 'Tax', 'Chargeable', 'Fixed Asset'].join('\n'),
+			options: ['', 'Accumulated Depreciation', 'Bank', 'Cash', 'Chargeable', 'Cost of Goods Sold', 'Depreciation', 
+				'Equity', 'Expense Account', 'Expenses Included In Valuation', 'Fixed Asset', 'Income Account', 'Payable', 'Receivable', 
+				'Round Off', 'Stock', 'Stock Adjustment', 'Stock Received But Not Billed', 'Tax', 'Temporary'].join('\n'),
 			description: __("Optional. This setting will be used to filter in various transactions.")
 		},
 		{fieldtype:'Float', fieldname:'tax_rate', label:__('Tax Rate'),
@@ -79,4 +82,4 @@
 		}
 	],
 	extend_toolbar: true
-}
\ No newline at end of file
+}
diff --git a/erpnext/accounts/doctype/account/chart_of_accounts/chart_of_accounts.py b/erpnext/accounts/doctype/account/chart_of_accounts/chart_of_accounts.py
index 5c82142..e26e354 100644
--- a/erpnext/accounts/doctype/account/chart_of_accounts/chart_of_accounts.py
+++ b/erpnext/accounts/doctype/account/chart_of_accounts/chart_of_accounts.py
@@ -6,9 +6,8 @@
 from frappe.utils import cstr
 from unidecode import unidecode
 
-def create_charts(chart_name, company):
-	chart = get_chart(chart_name)
-	
+def create_charts(company, chart_template=None, existing_company=None):
+	chart = get_chart(chart_template, existing_company)
 	if chart:
 		accounts = []
 
@@ -17,7 +16,7 @@
 				if root_account:
 					root_type = child.get("root_type")
 
-				if account_name not in ["account_type", "root_type", "is_group"]:
+				if account_name not in ["account_type", "root_type", "is_group", "tax_rate"]:
 
 					account_name_in_db = unidecode(account_name.strip().lower())
 					if account_name_in_db in accounts:
@@ -57,16 +56,19 @@
 def identify_is_group(child):
 	if child.get("is_group"):
 		is_group = child.get("is_group")
-	elif len(set(child.keys()) - set(["account_type", "root_type", "is_group"])):
+	elif len(set(child.keys()) - set(["account_type", "root_type", "is_group", "tax_rate"])):
 		is_group = 1
 	else:
 		is_group = 0
 
 	return is_group
 
-def get_chart(chart_name):
+def get_chart(chart_template, existing_company=None):
 	chart = {}
-	if chart_name == "Standard":
+	if existing_company:
+		return get_account_tree_from_existing_company(existing_company)
+	
+	elif chart_template == "Standard":
 		from erpnext.accounts.doctype.account.chart_of_accounts.verified import standard_chart_of_accounts
 		return standard_chart_of_accounts.get()
 	else:
@@ -79,7 +81,7 @@
 				if fname.endswith(".json"):
 					with open(os.path.join(path, fname), "r") as f:
 						chart = f.read()
-						if chart and json.loads(chart).get("name") == chart_name:
+						if chart and json.loads(chart).get("name") == chart_template:
 							return json.loads(chart).get("tree")
 
 @frappe.whitelist()
@@ -111,3 +113,47 @@
 		charts.append("Standard")
 
 	return charts
+
+
+def get_account_tree_from_existing_company(existing_company):
+	all_accounts = frappe.get_all('Account', 
+		filters={'company': existing_company}, 
+		fields = ["name", "account_name", "parent_account", "account_type", 
+			"is_group", "root_type", "tax_rate"], 
+		order_by="lft, rgt")
+	
+	account_tree = {}
+
+	# fill in tree starting with root accounts (those with no parent)
+	build_account_tree(account_tree, None, all_accounts)
+	
+	return account_tree
+	
+def build_account_tree(tree, parent, all_accounts):
+	# find children
+	parent_account = parent.name if parent else None
+	children  = [acc for acc in all_accounts if acc.parent_account == parent_account]
+			
+	# if no children, but a group account
+	if not children and parent.is_group:
+		tree["is_group"] = 1
+
+	# build a subtree for each child
+	for child in children:
+		if child.account_type == "Stock" and not child.is_group:
+			tree["is_group"] = 1
+			continue
+		
+		# start new subtree
+		tree[child.account_name] = {}
+		
+		# assign account_type and root_type
+		if child.account_type:
+			tree[child.account_name]["account_type"] = child.account_type
+		if child.tax_rate:
+			tree[child.account_name]["tax_rate"] = child.tax_rate
+		if not parent:
+			tree[child.account_name]["root_type"] = child.root_type
+			
+		# call recursively to build a subtree for current account
+		build_account_tree(tree[child.account_name], child, all_accounts)
\ No newline at end of file
diff --git a/erpnext/accounts/doctype/asset/asset.js b/erpnext/accounts/doctype/asset/asset.js
index 8ff4b83..664ed4d 100644
--- a/erpnext/accounts/doctype/asset/asset.js
+++ b/erpnext/accounts/doctype/asset/asset.js
@@ -28,6 +28,7 @@
 	refresh: function(frm) {
 		frappe.ui.form.trigger("Asset", "is_existing_asset");
 		frm.toggle_display("next_depreciation_date", frm.doc.docstatus < 1);
+		frm.events.make_schedules_editable(frm);
 				
 		if (frm.doc.docstatus==1) {
 			if (frm.doc.status=='Submitted' && !frm.doc.is_existing_asset && !frm.doc.purchase_invoice) {
@@ -141,6 +142,22 @@
 		frm.toggle_enable("supplier", frm.doc.is_existing_asset);
 		frm.toggle_reqd("next_depreciation_date", !frm.doc.is_existing_asset);
 	},
+	
+	opening_accumulated_depreciation: function(frm) {
+		erpnext.asset.set_accululated_depreciation(frm);
+	},
+	
+	depreciation_method: function(frm) {
+		frm.events.make_schedules_editable(frm);
+	},
+	
+	make_schedules_editable: function(frm) {
+		var is_editable = frm.doc.depreciation_method==="Manual" ? true : false;
+		frm.toggle_enable("schedules", is_editable);
+		frm.fields_dict["schedules"].grid.toggle_enable("schedule_date", is_editable);
+		frm.fields_dict["schedules"].grid.toggle_enable("depreciation_amount", is_editable);
+	}
+	
 });
 
 frappe.ui.form.on('Depreciation Schedule', {
@@ -159,9 +176,25 @@
 				}
 			})
 		}
+	},
+	
+	depreciation_amount: function(frm, cdt, cdn) {
+		erpnext.asset.set_accululated_depreciation(frm);
 	}
+
 })
 
+erpnext.asset.set_accululated_depreciation = function(frm) {
+	if(frm.doc.depreciation_method != "Manual") return;
+	
+	accumulated_depreciation = flt(frm.doc.opening_accumulated_depreciation);
+	$.each(frm.doc.schedules || [], function(i, row) {
+		accumulated_depreciation  += flt(row.depreciation_amount);
+		frappe.model.set_value(row.doctype, row.name, 
+			"accumulated_depreciation_amount", accumulated_depreciation);
+	})
+}
+
 erpnext.asset.make_purchase_invoice = function(frm) {
 	frappe.call({
 		args: {
diff --git a/erpnext/accounts/doctype/asset/asset.json b/erpnext/accounts/doctype/asset/asset.json
index 0ee3bf7..d093e69 100644
--- a/erpnext/accounts/doctype/asset/asset.json
+++ b/erpnext/accounts/doctype/asset/asset.json
@@ -534,7 +534,7 @@
    "columns": 0, 
    "fieldname": "value_after_depreciation", 
    "fieldtype": "Currency", 
-   "hidden": 0, 
+   "hidden": 1, 
    "ignore_user_permissions": 0, 
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
@@ -601,7 +601,7 @@
    "label": "Depreciation Method", 
    "length": 0, 
    "no_copy": 0, 
-   "options": "\nStraight Line\nDouble Declining Balance", 
+   "options": "\nStraight Line\nDouble Declining Balance\nManual", 
    "permlevel": 0, 
    "precision": "", 
    "print_hide": 0, 
@@ -777,7 +777,7 @@
    "precision": "", 
    "print_hide": 0, 
    "print_hide_if_no_value": 0, 
-   "read_only": 1, 
+   "read_only": 0, 
    "remember_last_selected_value": 0, 
    "report_hide": 0, 
    "reqd": 0, 
@@ -825,7 +825,7 @@
  "issingle": 0, 
  "istable": 0, 
  "max_attachments": 0, 
- "modified": "2016-11-07 05:48:01.360878", 
+ "modified": "2016-11-18 15:59:19.774500", 
  "modified_by": "Administrator", 
  "module": "Accounts", 
  "name": "Asset", 
diff --git a/erpnext/accounts/doctype/asset/asset.py b/erpnext/accounts/doctype/asset/asset.py
index da73218..9caac07 100644
--- a/erpnext/accounts/doctype/asset/asset.py
+++ b/erpnext/accounts/doctype/asset/asset.py
@@ -18,6 +18,7 @@
 		self.set_missing_values()
 		self.validate_asset_values()
 		self.make_depreciation_schedule()
+		self.set_accumulated_depreciation()
 		self.validate_expected_value_after_useful_life()
 		# Validate depreciation related accounts
 		get_depreciation_accounts(self)
@@ -48,7 +49,7 @@
 			for field, value in item_details.items():
 				if not self.get(field):
 					self.set(field, value)
-					
+
 		self.value_after_depreciation = (flt(self.gross_purchase_amount) - 
 			flt(self.opening_accumulated_depreciation))
 
@@ -87,9 +88,10 @@
 				frappe.throw(_("Please set Next Depreciation Date"))
 
 	def make_depreciation_schedule(self):
-		self.schedules = []
+		if self.depreciation_method != 'Manual':
+			self.schedules = []
+			
 		if not self.get("schedules") and self.next_depreciation_date:
-			accumulated_depreciation = flt(self.opening_accumulated_depreciation)
 			value_after_depreciation = flt(self.value_after_depreciation)
 			
 			number_of_pending_depreciations = cint(self.total_number_of_depreciations) - \
@@ -100,18 +102,21 @@
 						n * cint(self.frequency_of_depreciation))
 
 					depreciation_amount = self.get_depreciation_amount(value_after_depreciation)
-				
-					accumulated_depreciation += flt(depreciation_amount)
 					value_after_depreciation -= flt(depreciation_amount)
 
 					self.append("schedules", {
 						"schedule_date": schedule_date,
-						"depreciation_amount": depreciation_amount,
-						"accumulated_depreciation_amount": accumulated_depreciation
+						"depreciation_amount": depreciation_amount
 					})
+					
+	def set_accumulated_depreciation(self):
+		accumulated_depreciation = flt(self.opening_accumulated_depreciation)
+		for d in self.get("schedules"):
+			accumulated_depreciation  += flt(d.depreciation_amount)
+			d.accumulated_depreciation_amount = accumulated_depreciation
 
 	def get_depreciation_amount(self, depreciable_value):
-		if self.depreciation_method == "Straight Line":
+		if self.depreciation_method in ("Straight Line", "Manual"):
 			depreciation_amount = (flt(self.value_after_depreciation) -
 				flt(self.expected_value_after_useful_life)) / (cint(self.total_number_of_depreciations) - 
 				cint(self.number_of_depreciations_booked))
@@ -126,16 +131,15 @@
 		return depreciation_amount
 		
 	def validate_expected_value_after_useful_life(self):
-		if self.depreciation_method == "Double Declining Balance":
-			accumulated_depreciation_after_full_schedule = \
-				max([d.accumulated_depreciation_amount for d in self.get("schedules")])
-			
-			asset_value_after_full_schedule = (flt(self.gross_purchase_amount) - 
-				flt(accumulated_depreciation_after_full_schedule))
-			
-			if self.expected_value_after_useful_life < asset_value_after_full_schedule:
-				frappe.throw(_("Expected value after useful life must be greater than or equal to {0}")
-					.format(asset_value_after_full_schedule))
+		accumulated_depreciation_after_full_schedule = \
+			max([d.accumulated_depreciation_amount for d in self.get("schedules")])
+		
+		asset_value_after_full_schedule = (flt(self.gross_purchase_amount) - 
+			flt(accumulated_depreciation_after_full_schedule))
+		
+		if self.expected_value_after_useful_life < asset_value_after_full_schedule:
+			frappe.throw(_("Expected value after useful life must be greater than or equal to {0}")
+				.format(asset_value_after_full_schedule))
 
 	def validate_cancellation(self):
 		if self.status not in ("Submitted", "Partially Depreciated", "Fully Depreciated"):
diff --git a/erpnext/accounts/doctype/asset/test_asset.py b/erpnext/accounts/doctype/asset/test_asset.py
index b409ec3..51496b9 100644
--- a/erpnext/accounts/doctype/asset/test_asset.py
+++ b/erpnext/accounts/doctype/asset/test_asset.py
@@ -119,6 +119,30 @@
 			for d in asset.get("schedules")]
 
 		self.assertEqual(schedules, expected_schedules)
+		
+	def test_schedule_for_manual_method(self):
+		asset = frappe.get_doc("Asset", "Macbook Pro 1")
+		asset.depreciation_method = "Manual"
+		asset.schedules = []
+		for schedule_date, amount in [["2020-12-31", 40000], ["2021-06-30", 30000], ["2021-10-31", 20000]]:
+			asset.append("schedules", {
+				"schedule_date": schedule_date,
+				"depreciation_amount": amount
+			})
+		asset.save()
+
+		self.assertEqual(asset.status, "Draft")
+
+		expected_schedules = [
+			["2020-12-31", 40000, 40000],
+			["2021-06-30", 30000, 70000],
+			["2021-10-31", 20000, 90000]
+		]
+
+		schedules = [[cstr(d.schedule_date), d.depreciation_amount, d.accumulated_depreciation_amount]
+			for d in asset.get("schedules")]
+
+		self.assertEqual(schedules, expected_schedules)
 
 	def test_depreciation(self):
 		asset = frappe.get_doc("Asset", "Macbook Pro 1")
diff --git a/erpnext/accounts/doctype/bank_reconciliation/bank_reconciliation.js b/erpnext/accounts/doctype/bank_reconciliation/bank_reconciliation.js
index 85d3187..f1ccd9f 100644
--- a/erpnext/accounts/doctype/bank_reconciliation/bank_reconciliation.js
+++ b/erpnext/accounts/doctype/bank_reconciliation/bank_reconciliation.js
@@ -46,6 +46,12 @@
 			callback: function(r, rt) {
 				frm.refresh_field("payment_entries");
 				frm.refresh_fields();
+
+				$(frm.fields_dict.payment_entries.wrapper).find("[data-fieldname=amount]").each(function(i,v){
+					if (i !=0){
+						$(v).addClass("text-right")
+					}
+				})
 			}
 		});
 	}
diff --git a/erpnext/accounts/doctype/bank_reconciliation/bank_reconciliation.py b/erpnext/accounts/doctype/bank_reconciliation/bank_reconciliation.py
index a56170d..abc6eba 100644
--- a/erpnext/accounts/doctype/bank_reconciliation/bank_reconciliation.py
+++ b/erpnext/accounts/doctype/bank_reconciliation/bank_reconciliation.py
@@ -3,7 +3,7 @@
 
 from __future__ import unicode_literals
 import frappe
-from frappe.utils import flt, getdate, nowdate
+from frappe.utils import flt, getdate, nowdate, fmt_money
 from frappe import msgprint, _
 from frappe.model.document import Document
 
@@ -26,8 +26,8 @@
 			select 
 				"Journal Entry" as payment_document, t1.name as payment_entry, 
 				t1.cheque_no as cheque_number, t1.cheque_date, 
-				abs(t2.debit_in_account_currency - t2.credit_in_account_currency) as amount, 
-				t1.posting_date, t2.against_account, t1.clearance_date
+				t2.debit_in_account_currency as debit, t2.credit_in_account_currency as credit, 
+				t1.posting_date, t2.against_account, t1.clearance_date, t2.account_currency 
 			from
 				`tabJournal Entry` t1, `tabJournal Entry Account` t2
 			where
@@ -36,21 +36,23 @@
 				and ifnull(t1.is_opening, 'No') = 'No' {0}
 			order by t1.posting_date ASC, t1.name DESC
 		""".format(condition), (self.bank_account, self.from_date, self.to_date), as_dict=1)
-				
+
 		payment_entries = frappe.db.sql("""
 			select 
 				"Payment Entry" as payment_document, name as payment_entry, 
 				reference_no as cheque_number, reference_date as cheque_date, 
-				if(paid_from=%s, paid_amount, received_amount) as amount, 
-				posting_date, party as against_account, clearance_date
+				if(paid_from=%(account)s, paid_amount, "") as credit, 
+				if(paid_from=%(account)s, "", received_amount) as debit, 
+				posting_date, ifnull(party,if(paid_from=%(account)s,paid_to,paid_from)) as against_account, clearance_date,
+				if(paid_to=%(account)s, paid_to_account_currency, paid_from_account_currency) as account_currency
 			from `tabPayment Entry`
 			where
-				(paid_from=%s or paid_to=%s) and docstatus=1
-				and posting_date >= %s and posting_date <= %s {0}
+				(paid_from=%(account)s or paid_to=%(account)s) and docstatus=1
+				and posting_date >= %(from)s and posting_date <= %(to)s {0}
 			order by 
 				posting_date ASC, name DESC
 		""".format(condition), 
-		(self.bank_account, self.bank_account, self.bank_account, self.from_date, self.to_date), as_dict=1)
+		        {"account":self.bank_account, "from":self.from_date, "to":self.to_date}, as_dict=1)
 		
 		entries = sorted(list(payment_entries)+list(journal_entries), 
 			key=lambda k: k['posting_date'] or getdate(nowdate()))
@@ -60,6 +62,11 @@
 
 		for d in entries:
 			row = self.append('payment_entries', {})
+
+			d.amount = fmt_money(d.debit if d.debit else d.credit, 2, d.account_currency) + " " + (_("Dr") if d.debit else _("Cr"))
+			d.pop("credit")
+			d.pop("debit")
+			d.pop("account_currency")
 			row.update(d)
 			self.total_amount += flt(d.amount)
 
diff --git a/erpnext/accounts/doctype/bank_reconciliation_detail/bank_reconciliation_detail.json b/erpnext/accounts/doctype/bank_reconciliation_detail/bank_reconciliation_detail.json
index 0f30fee..2e4af26 100644
--- a/erpnext/accounts/doctype/bank_reconciliation_detail/bank_reconciliation_detail.json
+++ b/erpnext/accounts/doctype/bank_reconciliation_detail/bank_reconciliation_detail.json
@@ -40,14 +40,14 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
-   "columns": 0, 
+   "columns": 1, 
    "fieldname": "payment_entry", 
    "fieldtype": "Dynamic Link", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
-   "in_list_view": 0, 
+   "in_list_view": 1, 
    "label": "Payment Entry", 
    "length": 0, 
    "no_copy": 0, 
@@ -69,7 +69,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
-   "columns": 3, 
+   "columns": 2, 
    "fieldname": "against_account", 
    "fieldtype": "Data", 
    "hidden": 0, 
@@ -99,7 +99,7 @@
    "collapsible": 0, 
    "columns": 2, 
    "fieldname": "amount", 
-   "fieldtype": "Currency", 
+   "fieldtype": "Data", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
    "ignore_xss_filter": 0, 
@@ -110,7 +110,7 @@
    "no_copy": 0, 
    "oldfieldname": "debit", 
    "oldfieldtype": "Currency", 
-   "options": "account_currency", 
+   "options": "", 
    "permlevel": 0, 
    "print_hide": 0, 
    "print_hide_if_no_value": 0, 
@@ -151,7 +151,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
-   "columns": 0, 
+   "columns": 2, 
    "fieldname": "posting_date", 
    "fieldtype": "Date", 
    "hidden": 0, 
@@ -178,7 +178,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
-   "columns": 3, 
+   "columns": 1, 
    "fieldname": "cheque_number", 
    "fieldtype": "Data", 
    "hidden": 0, 
@@ -267,7 +267,7 @@
  "istable": 1, 
  "max_attachments": 0, 
  "menu_index": 0, 
- "modified": "2016-08-26 01:51:36.123941", 
+ "modified": "2016-11-17 11:39:00.308624", 
  "modified_by": "Administrator", 
  "module": "Accounts", 
  "name": "Bank Reconciliation Detail", 
diff --git a/erpnext/accounts/doctype/depreciation_schedule/depreciation_schedule.json b/erpnext/accounts/doctype/depreciation_schedule/depreciation_schedule.json
index 57c14b7..1fadf5e 100644
--- a/erpnext/accounts/doctype/depreciation_schedule/depreciation_schedule.json
+++ b/erpnext/accounts/doctype/depreciation_schedule/depreciation_schedule.json
@@ -10,11 +10,13 @@
  "doctype": "DocType", 
  "document_type": "Document", 
  "editable_grid": 1, 
+ "engine": "InnoDB", 
  "fields": [
   {
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "schedule_date", 
    "fieldtype": "Date", 
    "hidden": 0, 
@@ -29,7 +31,8 @@
    "precision": "", 
    "print_hide": 0, 
    "print_hide_if_no_value": 0, 
-   "read_only": 1, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
    "report_hide": 0, 
    "reqd": 1, 
    "search_index": 0, 
@@ -40,6 +43,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "depreciation_amount", 
    "fieldtype": "Currency", 
    "hidden": 0, 
@@ -55,7 +59,8 @@
    "precision": "", 
    "print_hide": 0, 
    "print_hide_if_no_value": 0, 
-   "read_only": 1, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
    "report_hide": 0, 
    "reqd": 1, 
    "search_index": 0, 
@@ -66,6 +71,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "column_break_3", 
    "fieldtype": "Column Break", 
    "hidden": 0, 
@@ -80,6 +86,7 @@
    "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, 
@@ -90,6 +97,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "accumulated_depreciation_amount", 
    "fieldtype": "Currency", 
    "hidden": 0, 
@@ -106,8 +114,9 @@
    "print_hide": 0, 
    "print_hide_if_no_value": 0, 
    "read_only": 1, 
+   "remember_last_selected_value": 0, 
    "report_hide": 0, 
-   "reqd": 1, 
+   "reqd": 0, 
    "search_index": 0, 
    "set_only_once": 0, 
    "unique": 0
@@ -116,6 +125,8 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
+   "depends_on": "eval:doc.docstatus==1", 
    "fieldname": "journal_entry", 
    "fieldtype": "Link", 
    "hidden": 0, 
@@ -132,6 +143,7 @@
    "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, 
@@ -142,7 +154,8 @@
    "allow_on_submit": 1, 
    "bold": 0, 
    "collapsible": 0, 
-   "depends_on": "eval:(!doc.journal_entry && doc.schedule_date <= get_today())", 
+   "columns": 0, 
+   "depends_on": "eval:(doc.docstatus==1 && !doc.journal_entry && doc.schedule_date <= get_today())", 
    "fieldname": "make_depreciation_entry", 
    "fieldtype": "Button", 
    "hidden": 0, 
@@ -158,6 +171,7 @@
    "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, 
@@ -175,7 +189,7 @@
  "issingle": 0, 
  "istable": 1, 
  "max_attachments": 0, 
- "modified": "2016-07-11 03:27:59.603924", 
+ "modified": "2016-11-18 16:42:19.543657", 
  "modified_by": "Administrator", 
  "module": "Accounts", 
  "name": "Depreciation Schedule", 
diff --git a/erpnext/accounts/doctype/journal_entry/journal_entry.py b/erpnext/accounts/doctype/journal_entry/journal_entry.py
index 9d891a5..2f3b101 100644
--- a/erpnext/accounts/doctype/journal_entry/journal_entry.py
+++ b/erpnext/accounts/doctype/journal_entry/journal_entry.py
@@ -68,7 +68,7 @@
 	def on_cancel(self):
 		from erpnext.accounts.utils import unlink_ref_doc_from_payment_entries
 		from erpnext.hr.doctype.salary_slip.salary_slip import unlink_ref_doc_from_salary_slip
-		unlink_ref_doc_from_payment_entries(self.doctype, self.name)
+		unlink_ref_doc_from_payment_entries(self)
 		unlink_ref_doc_from_salary_slip(self.name)
 		self.make_gl_entries(1)
 		self.update_advance_paid()
diff --git a/erpnext/accounts/doctype/monthly_distribution/monthly_distribution.json b/erpnext/accounts/doctype/monthly_distribution/monthly_distribution.json
index 2c71834..47c15e6 100644
--- a/erpnext/accounts/doctype/monthly_distribution/monthly_distribution.json
+++ b/erpnext/accounts/doctype/monthly_distribution/monthly_distribution.json
@@ -114,7 +114,7 @@
  "issingle": 0, 
  "istable": 0, 
  "max_attachments": 0, 
- "modified": "2016-11-07 05:30:20.409675", 
+ "modified": "2016-11-21 14:54:35.998761", 
  "modified_by": "Administrator", 
  "module": "Accounts", 
  "name": "Monthly Distribution", 
@@ -164,7 +164,7 @@
    "write": 0
   }
  ], 
- "quick_entry": 1, 
+ "quick_entry": 0, 
  "read_only": 0, 
  "read_only_onload": 0, 
  "sort_field": "modified", 
diff --git a/erpnext/accounts/doctype/payment_entry/payment_entry.js b/erpnext/accounts/doctype/payment_entry/payment_entry.js
index ce0cb50..ea1a2e3 100644
--- a/erpnext/accounts/doctype/payment_entry/payment_entry.js
+++ b/erpnext/accounts/doctype/payment_entry/payment_entry.js
@@ -120,50 +120,21 @@
 	set_dynamic_labels: function(frm) {
 		var company_currency = frappe.get_doc(":Company", frm.doc.company).default_currency;
 
-		var field_label_map = {};
-		var grid_field_label_map = {};
-
-		var setup_field_label_map = function(fields_list, currency, parentfield) {
-			var doctype = parentfield ? frm.fields_dict[parentfield].grid.doctype : frm.doc.doctype;
-			$.each(fields_list, function(i, fname) {
-				var docfield = frappe.meta.docfield_map[doctype][fname];
-				if(docfield) {
-					var label = __(docfield.label || "").replace(/\([^\)]*\)/g, "");
-					if(parentfield) {
-						grid_field_label_map[doctype + "-" + fname] =
-							label.trim() + " (" + __(currency) + ")";
-					} else {
-						field_label_map[fname] = label.trim() + " (" + currency + ")";
-					}
-				}
-			});
-		}
-
-		setup_field_label_map(["base_paid_amount", "base_received_amount", "base_total_allocated_amount",
+		frm.set_currency_labels(["base_paid_amount", "base_received_amount", "base_total_allocated_amount",
 			"difference_amount"], company_currency);
 
-		setup_field_label_map(["paid_amount"], frm.doc.paid_from_account_currency);
-		setup_field_label_map(["received_amount"], frm.doc.paid_to_account_currency);
+		frm.set_currency_labels(["paid_amount"], frm.doc.paid_from_account_currency);
+		frm.set_currency_labels(["received_amount"], frm.doc.paid_to_account_currency);
 
 		var party_account_currency = frm.doc.payment_type=="Receive" ?
 			frm.doc.paid_from_account_currency : frm.doc.paid_to_account_currency;
 
-		setup_field_label_map(["total_allocated_amount", "unallocated_amount"], party_account_currency);
+		frm.set_currency_labels(["total_allocated_amount", "unallocated_amount"], party_account_currency);
 
-		$.each(field_label_map, function(fname, label) {
-			me.frm.fields_dict[fname].set_label(label);
-		});
-
-		setup_field_label_map(["total_amount", "outstanding_amount", "allocated_amount"],
+		frm.set_currency_labels(["total_amount", "outstanding_amount", "allocated_amount"],
 			party_account_currency, "references");
 
-		setup_field_label_map(["amount"], company_currency, "deductions");
-
-		$.each(grid_field_label_map, function(fname, label) {
-			fname = fname.split("-");
-			var df = frappe.meta.get_docfield(fname[0], fname[1], me.frm.doc.name);
-			if(df) df.label = label;
-		});
+		frm.set_currency_labels(["amount"], company_currency, "deductions");
 
 		cur_frm.set_df_property("source_exchange_rate", "description",
 			("1 " + frm.doc.paid_from_account_currency + " = [?] " + company_currency));
diff --git a/erpnext/schools/doctype/scheduling_tool/__init__.py b/erpnext/accounts/doctype/pos_customer_group/__init__.py
similarity index 100%
copy from erpnext/schools/doctype/scheduling_tool/__init__.py
copy to erpnext/accounts/doctype/pos_customer_group/__init__.py
diff --git a/erpnext/accounts/doctype/pos_customer_group/pos_customer_group.json b/erpnext/accounts/doctype/pos_customer_group/pos_customer_group.json
new file mode 100644
index 0000000..4f6a675
--- /dev/null
+++ b/erpnext/accounts/doctype/pos_customer_group/pos_customer_group.json
@@ -0,0 +1,66 @@
+{
+ "allow_copy": 0, 
+ "allow_import": 0, 
+ "allow_rename": 0, 
+ "beta": 0, 
+ "creation": "2016-11-16 15:27:16.413449", 
+ "custom": 0, 
+ "docstatus": 0, 
+ "doctype": "DocType", 
+ "document_type": "", 
+ "editable_grid": 1, 
+ "engine": "InnoDB", 
+ "fields": [
+  {
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "customer_group", 
+   "fieldtype": "Link", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_list_view": 1, 
+   "label": "Customer Group", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "Customer Group", 
+   "permlevel": 0, 
+   "precision": "", 
+   "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
+  }
+ ], 
+ "hide_heading": 0, 
+ "hide_toolbar": 0, 
+ "idx": 0, 
+ "image_view": 0, 
+ "in_create": 0, 
+ "in_dialog": 0, 
+ "is_submittable": 0, 
+ "issingle": 0, 
+ "istable": 1, 
+ "max_attachments": 0, 
+ "modified": "2016-11-16 15:27:25.730507", 
+ "modified_by": "Administrator", 
+ "module": "Accounts", 
+ "name": "POS Customer Group", 
+ "name_case": "", 
+ "owner": "Administrator", 
+ "permissions": [], 
+ "quick_entry": 1, 
+ "read_only": 0, 
+ "read_only_onload": 0, 
+ "sort_field": "modified", 
+ "sort_order": "DESC", 
+ "track_seen": 0
+}
\ No newline at end of file
diff --git a/erpnext/accounts/doctype/pos_customer_group/pos_customer_group.py b/erpnext/accounts/doctype/pos_customer_group/pos_customer_group.py
new file mode 100644
index 0000000..85c1c9f
--- /dev/null
+++ b/erpnext/accounts/doctype/pos_customer_group/pos_customer_group.py
@@ -0,0 +1,10 @@
+# -*- coding: utf-8 -*-
+# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and contributors
+# For license information, please see license.txt
+
+from __future__ import unicode_literals
+import frappe
+from frappe.model.document import Document
+
+class POSCustomerGroup(Document):
+	pass
diff --git a/erpnext/schools/doctype/scheduling_tool/__init__.py b/erpnext/accounts/doctype/pos_item_group/__init__.py
similarity index 100%
copy from erpnext/schools/doctype/scheduling_tool/__init__.py
copy to erpnext/accounts/doctype/pos_item_group/__init__.py
diff --git a/erpnext/accounts/doctype/pos_item_group/pos_item_group.json b/erpnext/accounts/doctype/pos_item_group/pos_item_group.json
new file mode 100644
index 0000000..b278765
--- /dev/null
+++ b/erpnext/accounts/doctype/pos_item_group/pos_item_group.json
@@ -0,0 +1,66 @@
+{
+ "allow_copy": 0, 
+ "allow_import": 0, 
+ "allow_rename": 0, 
+ "beta": 0, 
+ "creation": "2016-11-16 15:26:47.706713", 
+ "custom": 0, 
+ "docstatus": 0, 
+ "doctype": "DocType", 
+ "document_type": "", 
+ "editable_grid": 1, 
+ "engine": "InnoDB", 
+ "fields": [
+  {
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "item_group", 
+   "fieldtype": "Link", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_list_view": 1, 
+   "label": "Item Group", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "Item Group", 
+   "permlevel": 0, 
+   "precision": "", 
+   "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
+  }
+ ], 
+ "hide_heading": 0, 
+ "hide_toolbar": 0, 
+ "idx": 0, 
+ "image_view": 0, 
+ "in_create": 0, 
+ "in_dialog": 0, 
+ "is_submittable": 0, 
+ "issingle": 0, 
+ "istable": 1, 
+ "max_attachments": 0, 
+ "modified": "2016-11-16 15:27:32.263630", 
+ "modified_by": "Administrator", 
+ "module": "Accounts", 
+ "name": "POS Item Group", 
+ "name_case": "", 
+ "owner": "Administrator", 
+ "permissions": [], 
+ "quick_entry": 1, 
+ "read_only": 0, 
+ "read_only_onload": 0, 
+ "sort_field": "modified", 
+ "sort_order": "DESC", 
+ "track_seen": 0
+}
\ No newline at end of file
diff --git a/erpnext/accounts/doctype/pos_item_group/pos_item_group.py b/erpnext/accounts/doctype/pos_item_group/pos_item_group.py
new file mode 100644
index 0000000..ceaa57b
--- /dev/null
+++ b/erpnext/accounts/doctype/pos_item_group/pos_item_group.py
@@ -0,0 +1,10 @@
+# -*- coding: utf-8 -*-
+# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and contributors
+# For license information, please see license.txt
+
+from __future__ import unicode_literals
+import frappe
+from frappe.model.document import Document
+
+class POSItemGroup(Document):
+	pass
diff --git a/erpnext/accounts/doctype/pos_profile/pos_profile.js b/erpnext/accounts/doctype/pos_profile/pos_profile.js
index c1aa0c3..bbbab73 100755
--- a/erpnext/accounts/doctype/pos_profile/pos_profile.js
+++ b/erpnext/accounts/doctype/pos_profile/pos_profile.js
@@ -26,6 +26,30 @@
 	});
 });
 
+frappe.ui.form.on("POS Profile", {
+	setup: function(frm) {
+		frm.trigger("get_query_for_groups")
+	},
+
+	get_query_for_groups: function(frm) {
+		frm.fields_dict['item_groups'].grid.get_field('item_group').get_query = function(frm, cdt, cdn) {
+			return{
+				filters: {
+					'is_group': 0
+				}
+			}
+		}
+
+		frm.fields_dict['customer_groups'].grid.get_field('customer_group').get_query = function(frm, cdt, cdn) {
+			return{
+				filters: {
+					'is_group': 0
+				}
+			}
+		}
+	}
+})
+
 // Income Account
 // --------------------------------
 cur_frm.fields_dict['income_account'].get_query = function(doc,cdt,cdn) {
diff --git a/erpnext/accounts/doctype/pos_profile/pos_profile.json b/erpnext/accounts/doctype/pos_profile/pos_profile.json
index ae858db..3541202 100644
--- a/erpnext/accounts/doctype/pos_profile/pos_profile.json
+++ b/erpnext/accounts/doctype/pos_profile/pos_profile.json
@@ -393,6 +393,114 @@
    "bold": 0, 
    "collapsible": 0, 
    "columns": 0, 
+   "fieldname": "section_break_14", 
+   "fieldtype": "Section Break", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_list_view": 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_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "item_groups", 
+   "fieldtype": "Table", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "label": "Item Groups", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "POS Item Group", 
+   "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_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "column_break_16", 
+   "fieldtype": "Column Break", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_list_view": 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_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "customer_groups", 
+   "fieldtype": "Table", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "label": "Customer Groups", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "POS Customer Group", 
+   "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_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "section_break_16", 
    "fieldtype": "Section Break", 
    "hidden": 0, 
@@ -567,35 +675,6 @@
    "bold": 0, 
    "collapsible": 0, 
    "columns": 0, 
-   "fieldname": "customer_group", 
-   "fieldtype": "Link", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "ignore_xss_filter": 0, 
-   "in_filter": 0, 
-   "in_list_view": 0, 
-   "in_standard_filter": 0, 
-   "label": "Customer Group", 
-   "length": 0, 
-   "no_copy": 0, 
-   "options": "Customer Group", 
-   "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_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "columns": 0, 
    "description": "", 
    "fieldname": "territory", 
    "fieldtype": "Link", 
@@ -984,7 +1063,7 @@
  "issingle": 0, 
  "istable": 0, 
  "max_attachments": 0, 
- "modified": "2016-11-07 05:19:52.335433", 
+ "modified": "2016-11-17 05:19:52.335433", 
  "modified_by": "Administrator", 
  "module": "Accounts", 
  "name": "POS Profile", 
diff --git a/erpnext/accounts/doctype/pos_profile/pos_profile.py b/erpnext/accounts/doctype/pos_profile/pos_profile.py
index 5f4d5bc..ef497bf 100644
--- a/erpnext/accounts/doctype/pos_profile/pos_profile.py
+++ b/erpnext/accounts/doctype/pos_profile/pos_profile.py
@@ -13,6 +13,7 @@
 	def validate(self):
 		self.check_for_duplicate()
 		self.validate_all_link_fields()
+		self.validate_duplicate_groups()
 
 	def check_for_duplicate(self):
 		res = frappe.db.sql("""select name, user from `tabPOS Profile`
@@ -37,6 +38,16 @@
 						"company": self.company, "name": link_dn}):
 					frappe.throw(_("{0} does not belong to Company {1}").format(link_dn, self.company))
 
+	def validate_duplicate_groups(self):
+		item_groups = [d.item_group for d in self.item_groups]
+		customer_groups = [d.customer_group for d in self.customer_groups]
+
+		if len(item_groups) != len(set(item_groups)):
+			frappe.throw(_("Duplicate item group found in the item group table"), title = "Duplicate Item Group")
+
+		if len(customer_groups) != len(set(customer_groups)):
+			frappe.throw(_("Duplicate customer group found in the cutomer group table"), title = "Duplicate Customer Group")
+
 	def before_save(self):
 		set_account_for_mode_of_payment(self)
 
diff --git a/erpnext/accounts/doctype/pos_profile/test_pos_profile.py b/erpnext/accounts/doctype/pos_profile/test_pos_profile.py
index 62274a3..9c6a114 100644
--- a/erpnext/accounts/doctype/pos_profile/test_pos_profile.py
+++ b/erpnext/accounts/doctype/pos_profile/test_pos_profile.py
@@ -5,8 +5,47 @@
 
 import frappe
 import unittest
-
-# test_records = frappe.get_test_records('POS Profile')
+from erpnext.stock.get_item_details import get_pos_profile
+from erpnext.accounts.doctype.sales_invoice.pos import get_items_list, get_customers_list
 
 class TestPOSProfile(unittest.TestCase):
-	pass
+	def test_pos_profile(self):
+		make_pos_profile()
+
+		pos_profile = get_pos_profile("_Test Company") or {}
+		if pos_profile:
+			doc = frappe.get_doc("POS Profile", pos_profile.get("name"))
+			doc.append('item_groups', {'item_group': '_Test Item Group'})
+			doc.append('customer_groups', {'customer_group': '_Test Customer Group'})
+			doc.save()
+
+			items = get_items_list(doc)
+			customers = get_customers_list(doc)
+
+			products_count = frappe.db.sql(""" select count(name) from tabItem where item_group = '_Test Item Group'""", as_list=1)
+			customers_count = frappe.db.sql(""" select count(name) from tabCustomer where customer_group = '_Test Customer Group'""")
+
+			self.assertEquals(len(items), products_count[0][0])
+			self.assertEquals(len(customers), customers_count[0][0])
+
+		frappe.db.sql("delete from `tabPOS Profile`")
+
+def make_pos_profile():
+	pos_profile = frappe.get_doc({
+		"company": "_Test Company",
+		"cost_center": "_Test Cost Center - _TC",
+		"currency": "INR",
+		"doctype": "POS Profile",
+		"expense_account": "_Test Account Cost for Goods Sold - _TC",
+		"income_account": "Sales - _TC",
+		"name": "_Test POS Profile",
+		"naming_series": "_T-POS Profile-",
+		"selling_price_list": "_Test Price List",
+		"territory": "_Test Territory",
+		"warehouse": "_Test Warehouse - _TC",
+		"write_off_account": "_Test Write Off - _TC",
+		"write_off_cost_center": "_Test Write Off Cost Center - _TC"
+	})
+
+	if not frappe.db.exists("POS Profile", "_Test POS Profile"):
+		pos_profile.insert()
\ No newline at end of file
diff --git a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js
index ccdd87f..bf2e43d 100644
--- a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js
+++ b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js
@@ -8,7 +8,7 @@
 erpnext.accounts.PurchaseInvoice = erpnext.buying.BuyingController.extend({
 	onload: function() {
 		this._super();
-
+		
 		if(!this.frm.doc.__islocal) {
 			// show credit_to in print format
 			if(!this.frm.doc.supplier && this.frm.doc.credit_to) {
@@ -32,7 +32,7 @@
 		if(doc.update_stock==1 && doc.docstatus==1) {
 			this.show_stock_ledger();
 		}
-
+		
 		if(!doc.is_return && doc.docstatus==1) {
 			if(doc.outstanding_amount != 0) {
 				this.frm.add_custom_button(__('Payment'), this.make_payment_entry, __("Make"));
diff --git a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py
index 5c2b62c..14459fa 100644
--- a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py
+++ b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py
@@ -583,7 +583,7 @@
 		if not self.is_return:
 			from erpnext.accounts.utils import unlink_ref_doc_from_payment_entries
 			if frappe.db.get_single_value('Accounts Settings', 'unlink_payment_on_cancellation_of_invoice'):
-				unlink_ref_doc_from_payment_entries(self.doctype, self.name)
+				unlink_ref_doc_from_payment_entries(self)
 
 			self.update_prevdoc_status()
 			self.update_billing_status_for_zero_amount_refdoc("Purchase Order")
diff --git a/erpnext/accounts/doctype/purchase_invoice_item/purchase_invoice_item.json b/erpnext/accounts/doctype/purchase_invoice_item/purchase_invoice_item.json
index d4e20f9..6f8e219 100755
--- a/erpnext/accounts/doctype/purchase_invoice_item/purchase_invoice_item.json
+++ b/erpnext/accounts/doctype/purchase_invoice_item/purchase_invoice_item.json
@@ -23,6 +23,7 @@
    "ignore_xss_filter": 0, 
    "in_filter": 1, 
    "in_list_view": 1, 
+   "in_standard_filter": 0, 
    "label": "Item", 
    "length": 0, 
    "no_copy": 0, 
@@ -33,6 +34,7 @@
    "print_hide": 1, 
    "print_hide_if_no_value": 0, 
    "read_only": 0, 
+   "remember_last_selected_value": 0, 
    "report_hide": 0, 
    "reqd": 0, 
    "search_index": 1, 
@@ -51,12 +53,14 @@
    "ignore_xss_filter": 0, 
    "in_filter": 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, 
@@ -75,6 +79,7 @@
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "in_standard_filter": 0, 
    "label": "Item Name", 
    "length": 0, 
    "no_copy": 0, 
@@ -84,6 +89,7 @@
    "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, 
@@ -102,6 +108,7 @@
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "in_standard_filter": 0, 
    "label": "Description", 
    "length": 0, 
    "no_copy": 0, 
@@ -110,6 +117,7 @@
    "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, 
@@ -128,6 +136,7 @@
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "in_standard_filter": 0, 
    "label": "Description", 
    "length": 0, 
    "no_copy": 0, 
@@ -138,6 +147,7 @@
    "print_hide_if_no_value": 0, 
    "print_width": "300px", 
    "read_only": 0, 
+   "remember_last_selected_value": 0, 
    "report_hide": 0, 
    "reqd": 0, 
    "search_index": 0, 
@@ -157,6 +167,7 @@
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "in_standard_filter": 0, 
    "label": "Image", 
    "length": 0, 
    "no_copy": 0, 
@@ -165,6 +176,7 @@
    "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, 
@@ -183,6 +195,7 @@
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "in_standard_filter": 0, 
    "label": "Image View", 
    "length": 0, 
    "no_copy": 0, 
@@ -192,6 +205,7 @@
    "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, 
@@ -210,6 +224,7 @@
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "in_standard_filter": 0, 
    "label": "Quantity and Rate", 
    "length": 0, 
    "no_copy": 0, 
@@ -217,6 +232,7 @@
    "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, 
@@ -235,6 +251,7 @@
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "in_standard_filter": 0, 
    "label": "Received Qty", 
    "length": 0, 
    "no_copy": 0, 
@@ -243,6 +260,7 @@
    "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, 
@@ -261,6 +279,7 @@
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 1, 
+   "in_standard_filter": 0, 
    "label": "Qty", 
    "length": 0, 
    "no_copy": 0, 
@@ -270,6 +289,7 @@
    "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, 
@@ -288,6 +308,7 @@
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "in_standard_filter": 0, 
    "label": "Rejected Qty", 
    "length": 0, 
    "no_copy": 0, 
@@ -296,6 +317,7 @@
    "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, 
@@ -314,12 +336,14 @@
    "ignore_xss_filter": 0, 
    "in_filter": 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, 
@@ -338,6 +362,7 @@
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "in_standard_filter": 0, 
    "label": "UOM", 
    "length": 0, 
    "no_copy": 0, 
@@ -346,6 +371,7 @@
    "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, 
@@ -364,6 +390,7 @@
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "in_standard_filter": 0, 
    "label": "Conversion Factor", 
    "length": 0, 
    "no_copy": 0, 
@@ -371,6 +398,7 @@
    "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, 
@@ -389,12 +417,14 @@
    "ignore_xss_filter": 0, 
    "in_filter": 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, 
@@ -413,6 +443,7 @@
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "in_standard_filter": 0, 
    "label": "Price List Rate", 
    "length": 0, 
    "no_copy": 0, 
@@ -421,6 +452,7 @@
    "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, 
@@ -440,6 +472,7 @@
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "in_standard_filter": 0, 
    "label": "Discount on Price List Rate (%)", 
    "length": 0, 
    "no_copy": 0, 
@@ -447,6 +480,7 @@
    "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, 
@@ -465,12 +499,14 @@
    "ignore_xss_filter": 0, 
    "in_filter": 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, 
@@ -489,6 +525,7 @@
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "in_standard_filter": 0, 
    "label": "Price List Rate (Company Currency)", 
    "length": 0, 
    "no_copy": 0, 
@@ -497,6 +534,7 @@
    "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, 
@@ -515,12 +553,14 @@
    "ignore_xss_filter": 0, 
    "in_filter": 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, 
@@ -539,6 +579,7 @@
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 1, 
+   "in_standard_filter": 0, 
    "label": "Rate ", 
    "length": 0, 
    "no_copy": 0, 
@@ -549,6 +590,7 @@
    "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, 
@@ -567,6 +609,7 @@
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 1, 
+   "in_standard_filter": 0, 
    "label": "Amount", 
    "length": 0, 
    "no_copy": 0, 
@@ -577,6 +620,7 @@
    "print_hide": 0, 
    "print_hide_if_no_value": 0, 
    "read_only": 1, 
+   "remember_last_selected_value": 0, 
    "report_hide": 0, 
    "reqd": 1, 
    "search_index": 0, 
@@ -595,12 +639,14 @@
    "ignore_xss_filter": 0, 
    "in_filter": 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, 
@@ -619,6 +665,7 @@
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "in_standard_filter": 0, 
    "label": "Rate (Company Currency)", 
    "length": 0, 
    "no_copy": 0, 
@@ -629,6 +676,7 @@
    "print_hide": 1, 
    "print_hide_if_no_value": 0, 
    "read_only": 1, 
+   "remember_last_selected_value": 0, 
    "report_hide": 0, 
    "reqd": 1, 
    "search_index": 0, 
@@ -647,6 +695,7 @@
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "in_standard_filter": 0, 
    "label": "Amount (Company Currency)", 
    "length": 0, 
    "no_copy": 0, 
@@ -657,6 +706,7 @@
    "print_hide": 1, 
    "print_hide_if_no_value": 0, 
    "read_only": 1, 
+   "remember_last_selected_value": 0, 
    "report_hide": 0, 
    "reqd": 1, 
    "search_index": 0, 
@@ -675,6 +725,7 @@
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "in_standard_filter": 0, 
    "label": "Pricing Rule", 
    "length": 0, 
    "no_copy": 0, 
@@ -683,6 +734,7 @@
    "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, 
@@ -701,6 +753,7 @@
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "in_standard_filter": 0, 
    "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
@@ -708,6 +761,7 @@
    "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, 
@@ -726,6 +780,7 @@
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "in_standard_filter": 0, 
    "label": "Net Rate", 
    "length": 0, 
    "no_copy": 0, 
@@ -735,6 +790,7 @@
    "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, 
@@ -753,6 +809,7 @@
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "in_standard_filter": 0, 
    "label": "Net Amount", 
    "length": 0, 
    "no_copy": 0, 
@@ -762,6 +819,7 @@
    "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, 
@@ -780,6 +838,7 @@
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "in_standard_filter": 0, 
    "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
@@ -787,6 +846,7 @@
    "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, 
@@ -805,6 +865,7 @@
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "in_standard_filter": 0, 
    "label": "Net Rate (Company Currency)", 
    "length": 0, 
    "no_copy": 0, 
@@ -814,6 +875,7 @@
    "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, 
@@ -832,6 +894,7 @@
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "in_standard_filter": 0, 
    "label": "Net Amount (Company Currency)", 
    "length": 0, 
    "no_copy": 0, 
@@ -841,6 +904,7 @@
    "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, 
@@ -859,6 +923,7 @@
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "in_standard_filter": 0, 
    "label": "Warehouse", 
    "length": 0, 
    "no_copy": 0, 
@@ -867,6 +932,7 @@
    "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, 
@@ -886,6 +952,7 @@
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "in_standard_filter": 0, 
    "label": "Accepted Warehouse", 
    "length": 0, 
    "no_copy": 0, 
@@ -895,6 +962,7 @@
    "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, 
@@ -913,6 +981,7 @@
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "in_standard_filter": 0, 
    "label": "Rejected Warehouse", 
    "length": 0, 
    "no_copy": 0, 
@@ -922,6 +991,37 @@
    "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_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "depends_on": "eval:!doc.__islocal", 
+   "fieldname": "quality_inspection", 
+   "fieldtype": "Link", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Quality Inspection", 
+   "length": 0, 
+   "no_copy": 1, 
+   "options": "Quality Inspection", 
+   "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, 
@@ -940,6 +1040,7 @@
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "in_standard_filter": 0, 
    "label": "Batch No", 
    "length": 0, 
    "no_copy": 0, 
@@ -949,6 +1050,7 @@
    "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, 
@@ -967,6 +1069,7 @@
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "in_standard_filter": 0, 
    "label": "", 
    "length": 0, 
    "no_copy": 0, 
@@ -975,6 +1078,7 @@
    "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, 
@@ -993,6 +1097,7 @@
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "in_standard_filter": 0, 
    "label": "Serial No", 
    "length": 0, 
    "no_copy": 0, 
@@ -1001,6 +1106,7 @@
    "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, 
@@ -1019,6 +1125,7 @@
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "in_standard_filter": 0, 
    "label": "Rejected Serial No", 
    "length": 0, 
    "no_copy": 1, 
@@ -1027,6 +1134,7 @@
    "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, 
@@ -1045,6 +1153,7 @@
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "in_standard_filter": 0, 
    "label": "Accounting", 
    "length": 0, 
    "no_copy": 0, 
@@ -1052,6 +1161,7 @@
    "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, 
@@ -1070,6 +1180,7 @@
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "in_standard_filter": 0, 
    "label": "Expense Head", 
    "length": 0, 
    "no_copy": 0, 
@@ -1081,6 +1192,7 @@
    "print_hide_if_no_value": 0, 
    "print_width": "120px", 
    "read_only": 0, 
+   "remember_last_selected_value": 0, 
    "report_hide": 0, 
    "reqd": 0, 
    "search_index": 0, 
@@ -1100,12 +1212,14 @@
    "ignore_xss_filter": 0, 
    "in_filter": 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, 
@@ -1124,6 +1238,7 @@
    "ignore_xss_filter": 0, 
    "in_filter": 1, 
    "in_list_view": 0, 
+   "in_standard_filter": 0, 
    "label": "Project", 
    "length": 0, 
    "no_copy": 0, 
@@ -1132,6 +1247,7 @@
    "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, 
@@ -1152,6 +1268,7 @@
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "in_standard_filter": 0, 
    "label": "Cost Center", 
    "length": 0, 
    "no_copy": 0, 
@@ -1163,6 +1280,7 @@
    "print_hide_if_no_value": 0, 
    "print_width": "120px", 
    "read_only": 0, 
+   "remember_last_selected_value": 0, 
    "report_hide": 0, 
    "reqd": 0, 
    "search_index": 0, 
@@ -1182,6 +1300,7 @@
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "in_standard_filter": 0, 
    "label": "Reference", 
    "length": 0, 
    "no_copy": 0, 
@@ -1189,6 +1308,7 @@
    "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, 
@@ -1207,6 +1327,7 @@
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "in_standard_filter": 0, 
    "label": "Brand", 
    "length": 0, 
    "no_copy": 0, 
@@ -1216,6 +1337,7 @@
    "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, 
@@ -1235,6 +1357,7 @@
    "ignore_xss_filter": 0, 
    "in_filter": 1, 
    "in_list_view": 0, 
+   "in_standard_filter": 0, 
    "label": "Item Group", 
    "length": 0, 
    "no_copy": 0, 
@@ -1245,6 +1368,7 @@
    "print_hide": 1, 
    "print_hide_if_no_value": 0, 
    "read_only": 1, 
+   "remember_last_selected_value": 0, 
    "report_hide": 0, 
    "reqd": 0, 
    "search_index": 1, 
@@ -1264,6 +1388,7 @@
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "in_standard_filter": 0, 
    "label": "Item Tax Rate", 
    "length": 0, 
    "no_copy": 0, 
@@ -1273,6 +1398,7 @@
    "print_hide": 1, 
    "print_hide_if_no_value": 0, 
    "read_only": 1, 
+   "remember_last_selected_value": 0, 
    "report_hide": 1, 
    "reqd": 0, 
    "search_index": 0, 
@@ -1291,6 +1417,7 @@
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "in_standard_filter": 0, 
    "label": "Item Tax Amount", 
    "length": 0, 
    "no_copy": 1, 
@@ -1300,6 +1427,7 @@
    "print_hide_if_no_value": 0, 
    "print_width": "150px", 
    "read_only": 1, 
+   "remember_last_selected_value": 0, 
    "report_hide": 0, 
    "reqd": 0, 
    "search_index": 0, 
@@ -1319,6 +1447,7 @@
    "ignore_xss_filter": 0, 
    "in_filter": 1, 
    "in_list_view": 0, 
+   "in_standard_filter": 0, 
    "label": "Purchase Order", 
    "length": 0, 
    "no_copy": 1, 
@@ -1329,6 +1458,7 @@
    "print_hide": 1, 
    "print_hide_if_no_value": 0, 
    "read_only": 1, 
+   "remember_last_selected_value": 0, 
    "report_hide": 0, 
    "reqd": 0, 
    "search_index": 1, 
@@ -1347,6 +1477,7 @@
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "in_standard_filter": 0, 
    "label": "BOM", 
    "length": 0, 
    "no_copy": 0, 
@@ -1356,6 +1487,7 @@
    "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, 
@@ -1374,12 +1506,14 @@
    "ignore_xss_filter": 0, 
    "in_filter": 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, 
@@ -1398,6 +1532,7 @@
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "in_standard_filter": 0, 
    "label": "Is Fixed Asset", 
    "length": 0, 
    "no_copy": 1, 
@@ -1406,6 +1541,7 @@
    "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, 
@@ -1425,6 +1561,7 @@
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "in_standard_filter": 0, 
    "label": "Asset", 
    "length": 0, 
    "no_copy": 1, 
@@ -1434,6 +1571,7 @@
    "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, 
@@ -1452,6 +1590,7 @@
    "ignore_xss_filter": 0, 
    "in_filter": 1, 
    "in_list_view": 0, 
+   "in_standard_filter": 0, 
    "label": "Purchase Order Item", 
    "length": 0, 
    "no_copy": 1, 
@@ -1461,6 +1600,7 @@
    "print_hide": 1, 
    "print_hide_if_no_value": 0, 
    "read_only": 1, 
+   "remember_last_selected_value": 0, 
    "report_hide": 0, 
    "reqd": 0, 
    "search_index": 1, 
@@ -1479,6 +1619,7 @@
    "ignore_xss_filter": 0, 
    "in_filter": 1, 
    "in_list_view": 0, 
+   "in_standard_filter": 0, 
    "label": "Purchase Receipt", 
    "length": 0, 
    "no_copy": 1, 
@@ -1489,6 +1630,7 @@
    "print_hide": 1, 
    "print_hide_if_no_value": 0, 
    "read_only": 1, 
+   "remember_last_selected_value": 0, 
    "report_hide": 0, 
    "reqd": 0, 
    "search_index": 1, 
@@ -1507,6 +1649,7 @@
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "in_standard_filter": 0, 
    "label": "Page Break", 
    "length": 0, 
    "no_copy": 1, 
@@ -1514,6 +1657,7 @@
    "print_hide": 1, 
    "print_hide_if_no_value": 0, 
    "read_only": 0, 
+   "remember_last_selected_value": 0, 
    "report_hide": 1, 
    "reqd": 0, 
    "search_index": 0, 
@@ -1532,6 +1676,7 @@
    "ignore_xss_filter": 0, 
    "in_filter": 1, 
    "in_list_view": 0, 
+   "in_standard_filter": 0, 
    "label": "PR Detail", 
    "length": 0, 
    "no_copy": 1, 
@@ -1541,6 +1686,7 @@
    "print_hide": 1, 
    "print_hide_if_no_value": 0, 
    "read_only": 1, 
+   "remember_last_selected_value": 0, 
    "report_hide": 0, 
    "reqd": 0, 
    "search_index": 1, 
@@ -1559,6 +1705,7 @@
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "in_standard_filter": 0, 
    "label": "Valuation Rate", 
    "length": 0, 
    "no_copy": 1, 
@@ -1567,6 +1714,7 @@
    "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, 
@@ -1585,6 +1733,7 @@
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "in_standard_filter": 0, 
    "label": "Raw Materials Supplied Cost", 
    "length": 0, 
    "no_copy": 1, 
@@ -1593,6 +1742,7 @@
    "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, 
@@ -1611,6 +1761,7 @@
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "in_standard_filter": 0, 
    "label": "Landed Cost Voucher Amount", 
    "length": 0, 
    "no_copy": 1, 
@@ -1619,6 +1770,7 @@
    "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, 
@@ -1636,7 +1788,7 @@
  "issingle": 0, 
  "istable": 1, 
  "max_attachments": 0, 
- "modified": "2016-08-26 04:37:23.737537", 
+ "modified": "2016-11-16 16:04:52.465169", 
  "modified_by": "Administrator", 
  "module": "Accounts", 
  "name": "Purchase Invoice Item", 
diff --git a/erpnext/accounts/doctype/sales_invoice/pos.py b/erpnext/accounts/doctype/sales_invoice/pos.py
index 1d1a122..d6cf120 100644
--- a/erpnext/accounts/doctype/sales_invoice/pos.py
+++ b/erpnext/accounts/doctype/sales_invoice/pos.py
@@ -30,10 +30,16 @@
 	return {
 		'doc': doc,
 		'default_customer': pos_profile.get('customer'),
-		'items': get_items(doc, pos_profile),
-		'customers': get_customers(pos_profile, doc, company_data.default_currency),
-		'pricing_rules': get_pricing_rules(doc),
+		'items': get_items_list(pos_profile),
+		'customers': get_customers_list(pos_profile),
+		'serial_no_data': get_serial_no_data(pos_profile, doc.company),
+		'batch_no_data': get_batch_no_data(),
+		'tax_data': get_item_tax_data(),
+		'price_list_data': get_price_list_data(doc.selling_price_list),
+		'bin_data': get_bin_data(pos_profile),
+		'pricing_rules': get_pricing_rule_data(doc),
 		'print_template': print_template,
+		'pos_profile': pos_profile,
 		'meta': {
 			'invoice': frappe.get_meta('Sales Invoice'),
 			'items': frappe.get_meta('Sales Invoice Item'),
@@ -104,63 +110,117 @@
 	for tax in taxes:
 		doc.append('taxes', tax)
 
-def get_items(doc, pos_profile):
-	item_list = []
-	for item in frappe.get_all("Item", fields=["*"], filters={'disabled': 0, 'has_variants': 0, 'is_sales_item': 1}):
-		item_doc = frappe.get_doc('Item', item.name)
-		if item_doc.taxes:
-			item.taxes = json.dumps(dict(([d.tax_type, d.tax_rate] for d in
-						item_doc.get("taxes"))))
+def get_items_list(pos_profile):
+	cond = "1=1"
+	item_groups = []
+	if pos_profile.get('item_groups'):
+		# Get items based on the item groups defined in the POS profile
 
-		item.price_list_rate = frappe.db.get_value('Item Price', {'item_code': item.name,
-									'price_list': doc.selling_price_list}, 'price_list_rate') or 0
-		item.default_warehouse = pos_profile.get('warehouse') or \
-			get_item_warehouse_for_company(doc.company, item.default_warehouse) or None
-		item.expense_account = pos_profile.get('expense_account') or item.expense_account
-		item.income_account = pos_profile.get('income_account') or item_doc.income_account
-		item.cost_center = pos_profile.get('cost_center') or item_doc.selling_cost_center
-		item.actual_qty = frappe.db.get_value('Bin', {'item_code': item.name,
-								'warehouse': item.default_warehouse}, 'actual_qty') or 0
-		item.serial_nos = get_serial_nos(item, pos_profile, doc.company)
-		item.batch_nos = frappe.db.sql_list("""select name from `tabBatch` where ifnull(expiry_date, '4000-10-10') > curdate()
-			and item = %(item_code)s""", {'item_code': item.item_code})
+		cond = "item_group in (%s)"%(', '.join(['%s']*len(pos_profile.get('item_groups'))))
+		item_groups = [d.item_group for d in pos_profile.get('item_groups')]
 
-		item_list.append(item)
+	return frappe.db.sql(""" 
+		select
+			name, item_code, item_name, description, item_group, expense_account, has_batch_no,
+			has_serial_no, expense_account, selling_cost_center, stock_uom, image, 
+			default_warehouse, is_stock_item, barcode
+		from
+			tabItem
+		where
+			disabled = 0 and has_variants = 0 and is_sales_item = 1 and {cond}
+		""".format(cond=cond), tuple(item_groups), as_dict=1)
 
-	return item_list
+def get_customers_list(pos_profile):
+	cond = "1=1"
+	customer_groups = []
+	if pos_profile.get('customer_groups'):
+		# Get customers based on the customer groups defined in the POS profile
 
-def get_item_warehouse_for_company(company, warehouse):
-	if frappe.db.get_value('Warehouse', warehouse, 'company') != company:
-		warehouse = None
-	return warehouse
+		cond = "customer_group in (%s)"%(', '.join(['%s']*len(pos_profile.get('customer_groups'))))
+		customer_groups = [d.customer_group for d in pos_profile.get('customer_groups')]
 
-def get_serial_nos(item, pos_profile, company):
+	return frappe.db.sql(""" select name, customer_name, customer_group,
+		territory from tabCustomer where disabled = 0
+		and {cond}""".format(cond=cond), tuple(customer_groups), as_dict=1) or {}
+
+def get_serial_no_data(pos_profile, company):
+	# get itemwise serial no data
+	# example {'Nokia Lumia 1020': {'SN0001': 'Pune'}}
+	# where Nokia Lumia 1020 is item code, SN0001 is serial no and Pune is warehouse
+
 	cond = "1=1"
 	if pos_profile.get('update_stock') and pos_profile.get('warehouse'):
 		cond = "warehouse = '{0}'".format(pos_profile.get('warehouse'))
 
-	serial_nos = frappe.db.sql("""select name, warehouse from `tabSerial No` where {0}
-				and item_code = %(item_code)s and company = %(company)s
-				""".format(cond), {'item_code': item.item_code, 'company': company}, as_dict=1)
+	serial_nos = frappe.db.sql("""select name, warehouse, item_code from `tabSerial No` where {0}
+				and company = %(company)s """.format(cond), {'company': company}, as_dict=1)
 
-	serial_no_list = {}
-	for serial_no in serial_nos:
-		serial_no_list[serial_no.name] = serial_no.warehouse
+	itemwise_serial_no = {}
+	for sn in serial_nos:
+		if sn.item_code not in itemwise_serial_no:
+			itemwise_serial_no.setdefault(sn.item_code, {})
+		itemwise_serial_no[sn.item_code][sn.name] = sn.warehouse
 
-	return serial_no_list
+	return itemwise_serial_no
 
-def get_customers(pos_profile, doc, company_currency):
-	filters = {'disabled': 0}
-	customer_list = []
-	customers = frappe.get_all("Customer", fields=["*"], filters = filters)
+def get_batch_no_data():
+	# get itemwise batch no data
+	# exmaple: {'LED-GRE': [Batch001, Batch002]}
+	# where LED-GRE is item code, SN0001 is serial no and Pune is warehouse
 
-	for customer in customers:
-		customer_currency = get_party_account_currency('Customer', customer.name, doc.company) or doc.currency
-		if customer_currency == doc.currency or customer_currency == company_currency:
-			customer_list.append(customer)
-	return customer_list
+	itemwise_batch = {}
+	batches = frappe.db.sql("""select name, item from `tabBatch`
+		where ifnull(expiry_date, '4000-10-10') >= curdate()""", as_dict=1)
 
-def get_pricing_rules(doc):
+	for batch in batches:
+		if batch.item not in itemwise_batch:
+			itemwise_batch.setdefault(batch.item, [])
+		itemwise_batch[batch.item].append(batch.name)
+
+	return itemwise_batch
+
+def get_item_tax_data():
+	# get default tax of an item
+	# example: {'Consulting Services': {'Excise 12 - TS': '12.000'}}
+
+	itemwise_tax = {}
+	taxes = frappe.db.sql(""" select parent, tax_type, tax_rate from `tabItem Tax`""", as_dict=1)
+
+	for tax in taxes:
+		if tax.parent not in itemwise_tax:
+			itemwise_tax.setdefault(tax.parent, {})
+		itemwise_tax[tax.parent][tax.tax_type] = tax.tax_rate
+
+	return itemwise_tax
+
+def get_price_list_data(selling_price_list):
+	itemwise_price_list = {}
+	price_lists = frappe.db.sql("""Select ifnull(price_list_rate, 0) as price_list_rate,
+		item_code from `tabItem Price` ip where price_list = %(price_list)s""",
+		{'price_list': selling_price_list}, as_dict=1)
+
+	for item in price_lists:
+		itemwise_price_list[item.item_code] = item.price_list_rate
+
+	return itemwise_price_list
+
+def get_bin_data(pos_profile):
+	itemwise_bin_data = {}
+	cond = "1=1"
+	if pos_profile.get('warehouse'):
+		cond = "warehouse = '{0}'".format(pos_profile.get('warehouse'))
+
+	bin_data = frappe.db.sql(""" select item_code, warehouse, actual_qty from `tabBin`
+		where actual_qty > 0 and {cond}""".format(cond=cond), as_dict=1)
+
+	for bins in bin_data:
+		if bins.item_code not in itemwise_bin_data:
+			itemwise_bin_data.setdefault(bins.item_code, {})
+		itemwise_bin_data[bins.item_code][bins.warehouse] = bins.actual_qty
+
+	return itemwise_bin_data
+
+def get_pricing_rule_data(doc):
 	pricing_rules = ""
 	if doc.ignore_pricing_rule == 0:
 		pricing_rules = frappe.db.sql(""" Select * from `tabPricing Rule` where docstatus < 2
diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.js b/erpnext/accounts/doctype/sales_invoice/sales_invoice.js
index 9b4306e..5609fce 100644
--- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.js
+++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.js
@@ -20,6 +20,13 @@
 		erpnext.queries.setup_queries(this.frm, "Warehouse", function() {
 			return erpnext.queries.warehouse(me.frm.doc);
 		});
+
+		if(this.frm.doc.__islocal && this.frm.doc.is_pos) {
+			//Load pos profile data on the invoice if the default value of Is POS is 1
+
+			me.frm.script_manager.trigger("is_pos");
+			me.frm.refresh_fields();
+		}
 	},
 
 	refresh: function(doc, dt, dn) {
@@ -496,9 +503,23 @@
 						frappe.model.set_value(cdt, cdn, "billing_hours", data.billing_hours);
 						frappe.model.set_value(cdt, cdn, "billing_amount", data.billing_amount);
 						frappe.model.set_value(cdt, cdn, "timesheet_detail", data.timesheet_detail);
+						calculate_total_billing_amount(frm)
 					}
 				}
 			})
 		}
 	}
 })
+
+var calculate_total_billing_amount =  function(frm) {
+	var doc = frm.doc;
+
+	doc.total_billing_amount = 0.0
+	if(doc.timesheets) {
+		$.each(doc.timesheets, function(index, data){
+			doc.total_billing_amount += data.billing_amount
+		})
+	}
+
+	refresh_field('total_billing_amount')
+}
diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py
index 4e0a6b4..5dce71f 100644
--- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py
+++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py
@@ -138,7 +138,7 @@
 
 		from erpnext.accounts.utils import unlink_ref_doc_from_payment_entries
 		if frappe.db.get_single_value('Accounts Settings', 'unlink_payment_on_cancellation_of_invoice'):
-			unlink_ref_doc_from_payment_entries(self.doctype, self.name)
+			unlink_ref_doc_from_payment_entries(self)
 
 		if self.is_return:
 			# NOTE status updating bypassed for is_return
diff --git a/erpnext/accounts/doctype/sales_invoice/test_sales_invoice.py b/erpnext/accounts/doctype/sales_invoice/test_sales_invoice.py
index 511eeaa..c4f275a 100644
--- a/erpnext/accounts/doctype/sales_invoice/test_sales_invoice.py
+++ b/erpnext/accounts/doctype/sales_invoice/test_sales_invoice.py
@@ -7,6 +7,7 @@
 from frappe.utils import nowdate, add_days, flt, nowdate
 from erpnext.stock.doctype.stock_entry.test_stock_entry import make_stock_entry, get_qty_after_transaction
 from erpnext.accounts.doctype.purchase_invoice.test_purchase_invoice import unlink_payment_on_cancel_of_invoice
+from erpnext.accounts.doctype.pos_profile.test_pos_profile import make_pos_profile
 from erpnext.stock.doctype.purchase_receipt.test_purchase_receipt import set_perpetual_inventory
 from erpnext.exceptions import InvalidAccountCurrency, InvalidCurrency
 from erpnext.stock.doctype.serial_no.serial_no import SerialNoWarehouseError
@@ -467,7 +468,7 @@
 
 	def test_pos_gl_entry_with_perpetual_inventory(self):
 		set_perpetual_inventory()
-		self.make_pos_profile()
+		make_pos_profile()
 
 		self._insert_purchase_receipt()
 		pos = copy.deepcopy(test_records[1])
@@ -486,7 +487,7 @@
 
 	def test_pos_change_amount(self):
 		set_perpetual_inventory()
-		self.make_pos_profile()
+		make_pos_profile()
 
 		self._insert_purchase_receipt()
 		pos = copy.deepcopy(test_records[1])
@@ -508,7 +509,7 @@
 
 		set_perpetual_inventory()
 
-		self.make_pos_profile()
+		make_pos_profile()
 		self._insert_purchase_receipt()
 
 		pos = copy.deepcopy(test_records[1])
@@ -572,26 +573,6 @@
 
 		frappe.db.sql("delete from `tabPOS Profile`")
 
-	def make_pos_profile(self):
-		pos_profile = frappe.get_doc({
-			"company": "_Test Company",
-			"cost_center": "_Test Cost Center - _TC",
-			"currency": "INR",
-			"doctype": "POS Profile",
-			"expense_account": "_Test Account Cost for Goods Sold - _TC",
-			"income_account": "Sales - _TC",
-			"name": "_Test POS Profile",
-			"naming_series": "_T-POS Profile-",
-			"selling_price_list": "_Test Price List",
-			"territory": "_Test Territory",
-			"warehouse": "_Test Warehouse - _TC",
-			"write_off_account": "_Test Write Off - _TC",
-			"write_off_cost_center": "_Test Write Off Cost Center - _TC"
-		})
-
-		if not frappe.db.exists("POS Profile", "_Test POS Profile"):
-			pos_profile.insert()
-			
 	def test_sales_invoice_gl_entry_with_perpetual_inventory_no_item_code(self):
 		set_perpetual_inventory()
 
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 7be5a24..944230b 100644
--- a/erpnext/accounts/doctype/sales_invoice_item/sales_invoice_item.json
+++ b/erpnext/accounts/doctype/sales_invoice_item/sales_invoice_item.json
@@ -23,6 +23,7 @@
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "in_standard_filter": 0, 
    "label": "Barcode", 
    "length": 0, 
    "no_copy": 0, 
@@ -30,6 +31,7 @@
    "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, 
@@ -48,6 +50,7 @@
    "ignore_xss_filter": 0, 
    "in_filter": 1, 
    "in_list_view": 1, 
+   "in_standard_filter": 0, 
    "label": "Item", 
    "length": 0, 
    "no_copy": 0, 
@@ -58,6 +61,7 @@
    "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, 
@@ -76,12 +80,14 @@
    "ignore_xss_filter": 0, 
    "in_filter": 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, 
@@ -100,6 +106,7 @@
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "in_standard_filter": 0, 
    "label": "Item Name", 
    "length": 0, 
    "no_copy": 0, 
@@ -109,6 +116,7 @@
    "print_hide": 1, 
    "print_hide_if_no_value": 0, 
    "read_only": 0, 
+   "remember_last_selected_value": 0, 
    "report_hide": 0, 
    "reqd": 1, 
    "search_index": 0, 
@@ -127,6 +135,7 @@
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "in_standard_filter": 0, 
    "label": "Customer's Item Code", 
    "length": 0, 
    "no_copy": 0, 
@@ -134,6 +143,7 @@
    "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, 
@@ -152,6 +162,7 @@
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "in_standard_filter": 0, 
    "label": "Edit Description", 
    "length": 0, 
    "no_copy": 0, 
@@ -160,6 +171,7 @@
    "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, 
@@ -178,6 +190,7 @@
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "in_standard_filter": 0, 
    "label": "Description", 
    "length": 0, 
    "no_copy": 0, 
@@ -188,6 +201,7 @@
    "print_hide_if_no_value": 0, 
    "print_width": "200px", 
    "read_only": 0, 
+   "remember_last_selected_value": 0, 
    "report_hide": 0, 
    "reqd": 1, 
    "search_index": 0, 
@@ -207,6 +221,7 @@
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "in_standard_filter": 0, 
    "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
@@ -214,6 +229,7 @@
    "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, 
@@ -232,6 +248,7 @@
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "in_standard_filter": 0, 
    "label": "Image View", 
    "length": 0, 
    "no_copy": 0, 
@@ -241,6 +258,7 @@
    "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, 
@@ -259,6 +277,7 @@
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "in_standard_filter": 0, 
    "label": "Image", 
    "length": 0, 
    "no_copy": 0, 
@@ -267,6 +286,7 @@
    "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, 
@@ -285,6 +305,7 @@
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "in_standard_filter": 0, 
    "label": "", 
    "length": 0, 
    "no_copy": 0, 
@@ -292,6 +313,7 @@
    "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, 
@@ -310,6 +332,7 @@
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 1, 
+   "in_standard_filter": 0, 
    "label": "Quantity", 
    "length": 0, 
    "no_copy": 0, 
@@ -319,6 +342,7 @@
    "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, 
@@ -337,6 +361,7 @@
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "in_standard_filter": 0, 
    "label": "Price List Rate", 
    "length": 0, 
    "no_copy": 0, 
@@ -347,6 +372,7 @@
    "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, 
@@ -365,12 +391,14 @@
    "ignore_xss_filter": 0, 
    "in_filter": 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, 
@@ -389,6 +417,7 @@
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "in_standard_filter": 0, 
    "label": "UOM", 
    "length": 0, 
    "no_copy": 0, 
@@ -397,6 +426,7 @@
    "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, 
@@ -415,6 +445,7 @@
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "in_standard_filter": 0, 
    "label": "Price List Rate (Company Currency)", 
    "length": 0, 
    "no_copy": 0, 
@@ -425,6 +456,7 @@
    "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, 
@@ -443,6 +475,7 @@
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "in_standard_filter": 0, 
    "label": "Discount and Margin", 
    "length": 0, 
    "no_copy": 0, 
@@ -451,6 +484,7 @@
    "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, 
@@ -470,6 +504,7 @@
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "in_standard_filter": 0, 
    "label": "Discount on Price List Rate (%)", 
    "length": 0, 
    "no_copy": 0, 
@@ -479,6 +514,7 @@
    "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, 
@@ -497,6 +533,7 @@
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "in_standard_filter": 0, 
    "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
@@ -504,6 +541,7 @@
    "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, 
@@ -523,6 +561,7 @@
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "in_standard_filter": 0, 
    "label": "Margin Type", 
    "length": 0, 
    "no_copy": 0, 
@@ -532,6 +571,7 @@
    "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, 
@@ -551,6 +591,7 @@
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "in_standard_filter": 0, 
    "label": "Margin Rate or Amount", 
    "length": 0, 
    "no_copy": 0, 
@@ -559,6 +600,7 @@
    "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, 
@@ -578,6 +620,7 @@
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "in_standard_filter": 0, 
    "label": "Total Margin", 
    "length": 0, 
    "no_copy": 0, 
@@ -586,6 +629,7 @@
    "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, 
@@ -604,12 +648,14 @@
    "ignore_xss_filter": 0, 
    "in_filter": 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, 
@@ -628,6 +674,7 @@
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 1, 
+   "in_standard_filter": 0, 
    "label": "Rate", 
    "length": 0, 
    "no_copy": 0, 
@@ -638,6 +685,7 @@
    "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, 
@@ -656,6 +704,7 @@
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 1, 
+   "in_standard_filter": 0, 
    "label": "Amount", 
    "length": 0, 
    "no_copy": 0, 
@@ -666,6 +715,7 @@
    "print_hide": 0, 
    "print_hide_if_no_value": 0, 
    "read_only": 1, 
+   "remember_last_selected_value": 0, 
    "report_hide": 0, 
    "reqd": 1, 
    "search_index": 0, 
@@ -684,12 +734,14 @@
    "ignore_xss_filter": 0, 
    "in_filter": 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, 
@@ -708,6 +760,7 @@
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "in_standard_filter": 0, 
    "label": "Rate (Company Currency)", 
    "length": 0, 
    "no_copy": 0, 
@@ -718,6 +771,7 @@
    "print_hide": 1, 
    "print_hide_if_no_value": 0, 
    "read_only": 1, 
+   "remember_last_selected_value": 0, 
    "report_hide": 0, 
    "reqd": 1, 
    "search_index": 0, 
@@ -736,6 +790,7 @@
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "in_standard_filter": 0, 
    "label": "Amount (Company Currency)", 
    "length": 0, 
    "no_copy": 0, 
@@ -746,6 +801,7 @@
    "print_hide": 1, 
    "print_hide_if_no_value": 0, 
    "read_only": 1, 
+   "remember_last_selected_value": 0, 
    "report_hide": 0, 
    "reqd": 1, 
    "search_index": 0, 
@@ -764,6 +820,7 @@
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "in_standard_filter": 0, 
    "label": "Pricing Rule", 
    "length": 0, 
    "no_copy": 0, 
@@ -772,6 +829,7 @@
    "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, 
@@ -790,6 +848,7 @@
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "in_standard_filter": 0, 
    "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
@@ -797,6 +856,7 @@
    "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, 
@@ -815,6 +875,7 @@
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "in_standard_filter": 0, 
    "label": "Net Rate", 
    "length": 0, 
    "no_copy": 0, 
@@ -824,6 +885,7 @@
    "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, 
@@ -842,6 +904,7 @@
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "in_standard_filter": 0, 
    "label": "Net Amount", 
    "length": 0, 
    "no_copy": 0, 
@@ -851,6 +914,7 @@
    "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, 
@@ -869,6 +933,7 @@
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "in_standard_filter": 0, 
    "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
@@ -876,6 +941,7 @@
    "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, 
@@ -894,6 +960,7 @@
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "in_standard_filter": 0, 
    "label": "Net Rate (Company Currency)", 
    "length": 0, 
    "no_copy": 0, 
@@ -903,6 +970,7 @@
    "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, 
@@ -921,6 +989,7 @@
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "in_standard_filter": 0, 
    "label": "Net Amount (Company Currency)", 
    "length": 0, 
    "no_copy": 0, 
@@ -930,6 +999,7 @@
    "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, 
@@ -949,6 +1019,7 @@
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "in_standard_filter": 0, 
    "label": "Drop Ship", 
    "length": 0, 
    "no_copy": 0, 
@@ -957,6 +1028,7 @@
    "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, 
@@ -975,6 +1047,7 @@
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "in_standard_filter": 0, 
    "label": "Delivered By Supplier", 
    "length": 0, 
    "no_copy": 0, 
@@ -983,6 +1056,7 @@
    "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, 
@@ -1001,6 +1075,7 @@
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "in_standard_filter": 0, 
    "label": "Accounting Details", 
    "length": 0, 
    "no_copy": 0, 
@@ -1008,6 +1083,7 @@
    "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, 
@@ -1026,6 +1102,7 @@
    "ignore_xss_filter": 0, 
    "in_filter": 1, 
    "in_list_view": 0, 
+   "in_standard_filter": 0, 
    "label": "Income Account", 
    "length": 0, 
    "no_copy": 0, 
@@ -1037,6 +1114,7 @@
    "print_hide_if_no_value": 0, 
    "print_width": "120px", 
    "read_only": 0, 
+   "remember_last_selected_value": 0, 
    "report_hide": 0, 
    "reqd": 1, 
    "search_index": 0, 
@@ -1056,6 +1134,7 @@
    "ignore_xss_filter": 0, 
    "in_filter": 1, 
    "in_list_view": 0, 
+   "in_standard_filter": 0, 
    "label": "Expense Account", 
    "length": 0, 
    "no_copy": 0, 
@@ -1064,6 +1143,7 @@
    "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, 
@@ -1083,12 +1163,14 @@
    "ignore_xss_filter": 0, 
    "in_filter": 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, 
@@ -1108,6 +1190,7 @@
    "ignore_xss_filter": 0, 
    "in_filter": 1, 
    "in_list_view": 0, 
+   "in_standard_filter": 0, 
    "label": "Cost Center", 
    "length": 0, 
    "no_copy": 0, 
@@ -1119,6 +1202,7 @@
    "print_hide_if_no_value": 0, 
    "print_width": "120px", 
    "read_only": 0, 
+   "remember_last_selected_value": 0, 
    "report_hide": 0, 
    "reqd": 1, 
    "search_index": 0, 
@@ -1139,6 +1223,7 @@
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "in_standard_filter": 0, 
    "label": "Stock Details", 
    "length": 0, 
    "no_copy": 0, 
@@ -1146,6 +1231,7 @@
    "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, 
@@ -1164,6 +1250,7 @@
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 1, 
+   "in_standard_filter": 0, 
    "label": "Warehouse", 
    "length": 0, 
    "no_copy": 0, 
@@ -1174,6 +1261,7 @@
    "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, 
@@ -1192,6 +1280,7 @@
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "in_standard_filter": 0, 
    "label": "Customer Warehouse (Optional)", 
    "length": 0, 
    "no_copy": 1, 
@@ -1201,6 +1290,7 @@
    "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, 
@@ -1212,22 +1302,25 @@
    "bold": 0, 
    "collapsible": 0, 
    "columns": 0, 
-   "fieldname": "serial_no", 
-   "fieldtype": "Small Text", 
+   "depends_on": "eval:!doc.__islocal", 
+   "fieldname": "quality_inspection", 
+   "fieldtype": "Link", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
    "ignore_xss_filter": 0, 
-   "in_filter": 1, 
-   "in_list_view": 1, 
-   "label": "Serial No", 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Quality Inspection", 
    "length": 0, 
    "no_copy": 0, 
-   "oldfieldname": "serial_no", 
-   "oldfieldtype": "Small Text", 
+   "options": "Quality Inspection", 
    "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, 
@@ -1246,6 +1339,7 @@
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 1, 
+   "in_standard_filter": 0, 
    "label": "Batch No", 
    "length": 0, 
    "no_copy": 0, 
@@ -1254,6 +1348,62 @@
    "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_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "col_break5", 
+   "fieldtype": "Column Break", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 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_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "serial_no", 
+   "fieldtype": "Small Text", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 1, 
+   "in_list_view": 1, 
+   "in_standard_filter": 0, 
+   "label": "Serial No", 
+   "length": 0, 
+   "no_copy": 0, 
+   "oldfieldname": "serial_no", 
+   "oldfieldtype": "Small 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, 
@@ -1273,6 +1423,7 @@
    "ignore_xss_filter": 0, 
    "in_filter": 1, 
    "in_list_view": 0, 
+   "in_standard_filter": 0, 
    "label": "Item Group", 
    "length": 0, 
    "no_copy": 0, 
@@ -1283,6 +1434,7 @@
    "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, 
@@ -1301,6 +1453,7 @@
    "ignore_xss_filter": 0, 
    "in_filter": 1, 
    "in_list_view": 0, 
+   "in_standard_filter": 0, 
    "label": "Brand Name", 
    "length": 0, 
    "no_copy": 0, 
@@ -1310,6 +1463,7 @@
    "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, 
@@ -1328,6 +1482,7 @@
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "in_standard_filter": 0, 
    "label": "Item Tax Rate", 
    "length": 0, 
    "no_copy": 0, 
@@ -1337,30 +1492,7 @@
    "print_hide": 1, 
    "print_hide_if_no_value": 0, 
    "read_only": 1, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
-   "unique": 0
-  }, 
-  {
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "columns": 0, 
-   "fieldname": "col_break5", 
-   "fieldtype": "Column Break", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "ignore_xss_filter": 0, 
-   "in_filter": 0, 
-   "in_list_view": 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, 
@@ -1379,6 +1511,7 @@
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "in_standard_filter": 0, 
    "label": "Available Batch Qty at Warehouse", 
    "length": 0, 
    "no_copy": 1, 
@@ -1388,6 +1521,7 @@
    "print_hide_if_no_value": 0, 
    "print_width": "150px", 
    "read_only": 1, 
+   "remember_last_selected_value": 0, 
    "report_hide": 0, 
    "reqd": 0, 
    "search_index": 0, 
@@ -1407,6 +1541,7 @@
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "in_standard_filter": 0, 
    "label": "Available Qty at Warehouse", 
    "length": 0, 
    "no_copy": 0, 
@@ -1416,6 +1551,7 @@
    "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, 
@@ -1434,6 +1570,7 @@
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "in_standard_filter": 0, 
    "label": "References", 
    "length": 0, 
    "no_copy": 0, 
@@ -1442,6 +1579,7 @@
    "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, 
@@ -1460,6 +1598,7 @@
    "ignore_xss_filter": 0, 
    "in_filter": 1, 
    "in_list_view": 0, 
+   "in_standard_filter": 0, 
    "label": "Sales Order", 
    "length": 0, 
    "no_copy": 1, 
@@ -1470,6 +1609,7 @@
    "print_hide": 1, 
    "print_hide_if_no_value": 0, 
    "read_only": 1, 
+   "remember_last_selected_value": 0, 
    "report_hide": 0, 
    "reqd": 0, 
    "search_index": 1, 
@@ -1488,6 +1628,7 @@
    "ignore_xss_filter": 0, 
    "in_filter": 1, 
    "in_list_view": 0, 
+   "in_standard_filter": 0, 
    "label": "Sales Order Item", 
    "length": 0, 
    "no_copy": 1, 
@@ -1497,6 +1638,7 @@
    "print_hide": 1, 
    "print_hide_if_no_value": 0, 
    "read_only": 1, 
+   "remember_last_selected_value": 0, 
    "report_hide": 0, 
    "reqd": 0, 
    "search_index": 1, 
@@ -1515,6 +1657,7 @@
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "in_standard_filter": 0, 
    "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
@@ -1522,6 +1665,7 @@
    "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, 
@@ -1540,6 +1684,7 @@
    "ignore_xss_filter": 0, 
    "in_filter": 1, 
    "in_list_view": 0, 
+   "in_standard_filter": 0, 
    "label": "Delivery Note", 
    "length": 0, 
    "no_copy": 1, 
@@ -1550,6 +1695,7 @@
    "print_hide": 1, 
    "print_hide_if_no_value": 0, 
    "read_only": 1, 
+   "remember_last_selected_value": 0, 
    "report_hide": 0, 
    "reqd": 0, 
    "search_index": 1, 
@@ -1568,6 +1714,7 @@
    "ignore_xss_filter": 0, 
    "in_filter": 1, 
    "in_list_view": 0, 
+   "in_standard_filter": 0, 
    "label": "Delivery Note Item", 
    "length": 0, 
    "no_copy": 1, 
@@ -1577,6 +1724,7 @@
    "print_hide": 1, 
    "print_hide_if_no_value": 0, 
    "read_only": 1, 
+   "remember_last_selected_value": 0, 
    "report_hide": 0, 
    "reqd": 0, 
    "search_index": 1, 
@@ -1595,6 +1743,7 @@
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "in_standard_filter": 0, 
    "label": "Delivered Qty", 
    "length": 0, 
    "no_copy": 0, 
@@ -1604,6 +1753,7 @@
    "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, 
@@ -1622,6 +1772,7 @@
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "in_standard_filter": 0, 
    "label": "Is Fixed Asset", 
    "length": 0, 
    "no_copy": 1, 
@@ -1630,6 +1781,7 @@
    "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, 
@@ -1648,6 +1800,7 @@
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "in_standard_filter": 0, 
    "label": "Asset", 
    "length": 0, 
    "no_copy": 1, 
@@ -1657,6 +1810,7 @@
    "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, 
@@ -1675,6 +1829,7 @@
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "in_standard_filter": 0, 
    "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
@@ -1682,6 +1837,7 @@
    "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, 
@@ -1700,6 +1856,7 @@
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "in_standard_filter": 0, 
    "label": "Page Break", 
    "length": 0, 
    "no_copy": 1, 
@@ -1707,6 +1864,7 @@
    "print_hide": 1, 
    "print_hide_if_no_value": 0, 
    "read_only": 0, 
+   "remember_last_selected_value": 0, 
    "report_hide": 1, 
    "reqd": 0, 
    "search_index": 0, 
@@ -1724,7 +1882,7 @@
  "issingle": 0, 
  "istable": 1, 
  "max_attachments": 0, 
- "modified": "2016-11-01 13:01:58.844818", 
+ "modified": "2016-11-16 16:04:02.438952", 
  "modified_by": "Administrator", 
  "module": "Accounts", 
  "name": "Sales Invoice Item", 
diff --git a/erpnext/accounts/page/pos/pos.js b/erpnext/accounts/page/pos/pos.js
index 32e9b3a..9aafdae 100644
--- a/erpnext/accounts/page/pos/pos.js
+++ b/erpnext/accounts/page/pos/pos.js
@@ -25,7 +25,6 @@
 		this.set_indicator();
 		this.onload();
 		this.make_menu_list();
-		this.set_interval_for_si_sync();
 		this.si_docs = this.get_doc_from_localstorage();
 	},
 
@@ -73,8 +72,6 @@
 		this.get_data_from_server(function(){
 			me.create_new();
 		});
-
-		this.check_internet_connection();
 	},
 
 	make_menu_list: function(){
@@ -204,13 +201,10 @@
 			freeze: true,
 			freeze_message: __("Master data syncing, it might take some time"),
 			callback: function(r){
-				window.items = r.message.items;
-				window.customers = r.message.customers;
-				window.pricing_rules = r.message.pricing_rules;
-				window.meta = r.message.meta;
-				window.print_template = r.message.print_template;
-				me.default_customer = r.message.default_customer || null;
+				me.init_master_data(r)
 				localStorage.setItem('doc', JSON.stringify(r.message.doc));
+				me.set_interval_for_si_sync();
+				me.check_internet_connection();
 				if(callback){
 					callback();
 				}
@@ -218,6 +212,22 @@
 		})
 	},
 
+	init_master_data: function(r){
+		var me = this;
+		this.meta = r.message.meta;
+		this.item_data = r.message.items;
+		this.customers = r.message.customers;
+		this.serial_no_data = r.message.serial_no_data;
+		this.batch_no_data = r.message.batch_no_data;
+		this.tax_data = r.message.tax_data;
+		this.price_list_data = r.message.price_list_data;
+		this.bin_data = r.message.bin_data;
+		this.pricing_rules = r.message.pricing_rules;
+		this.print_template = r.message.print_template;
+		this.pos_profile_data = r.message.pos_profile;
+		this.default_customer = r.message.default_customer || null;
+	},
+
 	save_previous_entry : function(){
 		if(this.frm.doc.items.length > 0){
 			this.create_invoice()
@@ -233,20 +243,21 @@
 	},
 
 	load_data: function(load_doc){
-		this.items = window.items;
-		this.customers = window.customers;
-		this.pricing_rules = window.pricing_rules;
+		var me = this;
+
+		this.items = this.item_data;
+		this.actual_qty_dict = {};
 
 		if(load_doc) {
 			this.frm.doc =  JSON.parse(localStorage.getItem('doc'));
 		}
 
-		$.each(window.meta, function(i, data){
+		$.each(this.meta, function(i, data){
 			frappe.meta.sync(data)
 		})
 
 		this.print_template = frappe.render_template("print_template",
-			{content: window.print_template, title:"POS",
+			{content: this.print_template, title:"POS",
 			base_url: frappe.urllib.get_base_url(), print_css: frappe.boot.print_css})
 	},
 
@@ -387,12 +398,12 @@
 		var $wrap = me.wrapper.find(".item-list");
 		me.wrapper.find(".item-list").empty();
 
-		if (this.items) {
+		if (this.items.length > 0) {
 			$.each(this.items, function(index, obj) {
 				if(index < 30){
 					$(frappe.render_template("pos_item", {
 						item_code: obj.name,
-						item_price: format_currency(obj.price_list_rate, me.frm.doc.currency),
+						item_price: format_currency(me.price_list_data[obj.name], me.frm.doc.currency),
 						item_name: obj.name===obj.item_name ? "" : obj.item_name,
 						item_image: obj.image ? "url('" + obj.image + "')" : null,
 						color: frappe.get_palette(obj.item_name),
@@ -400,6 +411,8 @@
 					})).tooltip().appendTo($wrap);
 				}
 			});
+		} else {
+			$("<h4>Searching record not found.</h4>").appendTo($wrap)
 		}
 
 		if(this.items.length == 1
@@ -426,27 +439,28 @@
 		this.item_batch_no = {};
 
 		if(item_code){
-			return $.grep(window.items, function(item){
+			return $.grep(this.item_data, function(item){
 				if(item.item_code == item_code ){
 					return true
 				}
 			})
 		}
 
-		key =  this.search.$input.val().toLowerCase();
+		key =  this.search.$input.val().toLowerCase().replace(/[&\/\\#,+()\[\]$~.'":*?<>{}]/g,'\\$&');
 		var re = new RegExp('%', 'g');
 		var reg = new RegExp(key.replace(re, '[\\w*\\s*[a-zA-Z0-9]*]*'))
 		search_status = true
 
 		if(key){
-			return $.grep(window.items, function(item){
+			return $.grep(this.item_data, function(item){
 				if(search_status){
-					if(in_list(item.batch_nos, me.search.$input.val())){
+					if(in_list(me.batch_no_data[item.item_code], me.search.$input.val())){
 						search_status = false;
 						return me.item_batch_no[item.item_code] = me.search.$input.val()
-					} else if(in_list(Object.keys(item.serial_nos), me.search.$input.val())) {
+					} else if( me.serial_no_data[item.item_code]
+						&& in_list(Object.keys(me.serial_no_data[item.item_code]), me.search.$input.val())) {
 						search_status = false;
-						me.item_serial_no[item.item_code] = [me.search.$input.val(), item.serial_nos[me.search.$input.val()]]
+						me.item_serial_no[item.item_code] = [me.search.$input.val(), me.serial_no_data[item.item_code][me.search.$input.val()]]
 						return true
 					} else if(item.barcode == me.search.$input.val()) {
 						search_status = false;
@@ -458,7 +472,7 @@
 				}
 			})
 		}else{
-			return window.items;
+			return this.item_data;
 		}
 	},
 
@@ -611,18 +625,18 @@
 		this.child.description = this.items[0].description;
 		this.child.qty = 1;
 		this.child.item_group = this.items[0].item_group;
-		this.child.cost_center = this.items[0].cost_center;
-		this.child.income_account = this.items[0].income_account;
+		this.child.cost_center = this.pos_profile_data['cost_center'] || this.items[0].cost_center;
+		this.child.income_account = this.pos_profile_data['income_account'] || this.items[0].income_account;
 		this.child.warehouse = (this.item_serial_no[this.child.item_code]
-			? this.item_serial_no[this.child.item_code][1] : this.items[0].default_warehouse);
-		this.child.price_list_rate = flt(this.items[0].price_list_rate, 9) / flt(this.frm.doc.conversion_rate, 9);
-		this.child.rate = flt(this.items[0].price_list_rate, 9) / flt(this.frm.doc.conversion_rate, 9);
-		this.child.actual_qty = this.items[0].actual_qty;
+			? this.item_serial_no[this.child.item_code][1] : (this.pos_profile_data['warehouse'] || this.items[0].default_warehouse) );
+		this.child.price_list_rate = flt(this.price_list_data[this.child.item_code], 9) / flt(this.frm.doc.conversion_rate, 9);
+		this.child.rate = flt(this.price_list_data[this.child.item_code], 9) / flt(this.frm.doc.conversion_rate, 9);
+		this.child.actual_qty = me.get_actual_qty(this.items[0]);
 		this.child.amount = flt(this.child.qty) * flt(this.child.rate);
 		this.child.batch_no = this.item_batch_no[this.child.item_code];
 		this.child.serial_no = (this.item_serial_no[this.child.item_code]
 			? this.item_serial_no[this.child.item_code][0] : '');
-		this.child.item_tax_rate = this.items[0].taxes;
+		this.child.item_tax_rate = JSON.stringify(this.tax_data[this.child.item_code]);
 	},
 
 	update_paid_amount_status: function(update_paid_amount){
@@ -668,7 +682,7 @@
 				item_code: d.item_code,
 				item_name: (d.item_name===d.item_code || !d.item_name) ? "" : ("<br>" + d.item_name),
 				qty: d.qty,
-				actual_qty: d.actual_qty,
+				actual_qty: me.actual_qty_dict[d.item_code] || 0,
 				projected_qty: d.projected_qty,
 				rate: format_number(d.rate, me.frm.doc.currency),
 				amount: format_currency(d.amount, me.frm.doc.currency)
@@ -1064,8 +1078,20 @@
 	},
 
 	validate_warehouse: function(){
-		if(!this.items[0].default_warehouse){
+		if(this.items[0].is_stock_item && !this.items[0].default_warehouse && !this.pos_profile_data['warehouse']){
 			frappe.throw(__("Default warehouse is required for selected item"))
 		}
+	},
+
+	get_actual_qty: function(item) {
+		this.actual_qty = 0.0;
+
+		var warehouse = this.pos_profile_data['warehouse'] || item.default_warehouse;
+		if(warehouse && this.bin_data[item.item_code]) {
+			this.actual_qty = this.bin_data[item.item_code][warehouse] || 0;
+			this.actual_qty_dict[item.item_code] = this.actual_qty
+		}
+
+		return this.actual_qty
 	}
 })
\ No newline at end of file
diff --git a/erpnext/accounts/report/balance_sheet/balance_sheet.py b/erpnext/accounts/report/balance_sheet/balance_sheet.py
index 8963bb4..5ff8e3e 100644
--- a/erpnext/accounts/report/balance_sheet/balance_sheet.py
+++ b/erpnext/accounts/report/balance_sheet/balance_sheet.py
@@ -14,10 +14,10 @@
 	liability = get_data(filters.company, "Liability", "Credit", period_list, only_current_fiscal_year=False)
 	equity = get_data(filters.company, "Equity", "Credit", period_list, only_current_fiscal_year=False)
 
-	provisional_profit_loss,total_credit  = get_provisional_profit_loss(asset, liability, equity,
+	provisional_profit_loss, total_credit = get_provisional_profit_loss(asset, liability, equity,
 		period_list, filters.company)
 
-	message,opening_balance = check_opening_balance(asset, liability, equity)
+	message, opening_balance = check_opening_balance(asset, liability, equity)
 
 	data = []
 	data.extend(asset or [])
@@ -32,7 +32,9 @@
 		}
 		for period in period_list:
 			unclosed[period.key] = opening_balance
-			provisional_profit_loss[period.key] = provisional_profit_loss[period.key] - opening_balance
+			if provisional_profit_loss:
+				provisional_profit_loss[period.key] = provisional_profit_loss[period.key] - opening_balance
+				
 		unclosed["total"]=opening_balance
 		data.append(unclosed)
 		
@@ -48,15 +50,11 @@
 	return columns, data, message, chart
 
 def get_provisional_profit_loss(asset, liability, equity, period_list, company):
+	provisional_profit_loss = {}
+	total_row = {}
 	if asset and (liability or equity):
 		total = total_row_total=0
 		currency = frappe.db.get_value("Company", company, "default_currency")
-		provisional_profit_loss = {
-			"account_name": "'" + _("Provisional Profit / Loss (Credit)") + "'",
-			"account": None,
-			"warn_if_negative": True,
-			"currency": currency
-		}
 		total_row = {
 			"account_name": "'" + _("Total (Credit)") + "'",
 			"account": None,
@@ -85,9 +83,14 @@
 			total_row["total"] = total_row_total
 
 		if has_value:
-			return provisional_profit_loss, total_row
-		return None,total_row
-	return None, None	
+			provisional_profit_loss.update({
+				"account_name": "'" + _("Provisional Profit / Loss (Credit)") + "'",
+				"account": None,
+				"warn_if_negative": True,
+				"currency": currency
+			})
+			
+	return provisional_profit_loss, total_row
 
 def check_opening_balance(asset, liability, equity):
 	# Check if previous year balance sheet closed
diff --git a/erpnext/accounts/report/bank_reconciliation_statement/bank_reconciliation_statement.html b/erpnext/accounts/report/bank_reconciliation_statement/bank_reconciliation_statement.html
index dd1609a..23d2a31 100644
--- a/erpnext/accounts/report/bank_reconciliation_statement/bank_reconciliation_statement.html
+++ b/erpnext/accounts/report/bank_reconciliation_statement/bank_reconciliation_statement.html
@@ -8,7 +8,7 @@
 	<thead>
 		<tr>
 			<th style="width: 15%">{%= __("Posting Date") %}</th>
-			<th style="width: 15%">{%= __("Journal Entry") %}</th>
+			<th style="width: 15%">{%= __("Payment Entry") %}</th>
 			<th style="width: 40%">{%= __("Reference") %}</th>
 			<th style="width: 15%; text-align: right;">{%= __("Debit") %}</th>
 			<th style="width: 15%; text-align: right;">{%= __("Credit") %}</th>
@@ -19,10 +19,10 @@
 			{% if (data[i]["posting_date"]) { %}
 			<tr>
 				<td>{%= dateutil.str_to_user(data[i]["posting_date"]) %}</td>
-				<td>{%= data[i]["journal_entry"] %}</td>
+				<td>{%= data[i]["payment_entry"] %}</td>
 				<td>{%= __("Against") %}: {%= data[i]["against_account"] %}
-					{% if (data[i]["reference"]) { %}
-						<br>{%= __("Reference") %}: {%= data[i]["reference"] %}
+					{% if (data[i]["reference_no"]) { %}
+						<br>{%= __("Reference") %}: {%= data[i]["reference_no"] %}
 						{% if (data[i]["ref_date"]) { %}
 							<br>{%= __("Reference Date") %}: {%= dateutil.str_to_user(data[i]["ref_date"]) %}
 						{% } %}
@@ -38,7 +38,7 @@
 			<tr>
 				<td></td>
 				<td></td>
-				<td>{%= data[i]["journal_entry"] %}</td>
+				<td>{%= data[i]["payment_entry"] %}</td>
 				<td style="text-align: right">{%= format_currency(data[i]["debit"]) %}</td>
 				<td style="text-align: right">{%= format_currency(data[i]["credit"]) %}</td>
 			</tr>
diff --git a/erpnext/accounts/report/bank_reconciliation_statement/bank_reconciliation_statement.py b/erpnext/accounts/report/bank_reconciliation_statement/bank_reconciliation_statement.py
index 8ed338e..95b7ff7 100644
--- a/erpnext/accounts/report/bank_reconciliation_statement/bank_reconciliation_statement.py
+++ b/erpnext/accounts/report/bank_reconciliation_statement/bank_reconciliation_statement.py
@@ -129,7 +129,7 @@
 			reference_no, reference_date as ref_date, 
 			if(paid_to=%(account)s, received_amount, 0) as debit, 
 			if(paid_from=%(account)s, paid_amount, 0) as credit, 
-			posting_date, party as against_account, clearance_date,
+			posting_date, ifnull(party,if(paid_from=%(account)s,paid_to,paid_from)) as against_account, clearance_date,
 			if(paid_to=%(account)s, paid_to_account_currency, paid_from_account_currency) as account_currency
 		from `tabPayment Entry`
 		where
diff --git a/erpnext/accounts/report/cash_flow/cash_flow.html b/erpnext/accounts/report/cash_flow/cash_flow.html
new file mode 100644
index 0000000..40ba20c
--- /dev/null
+++ b/erpnext/accounts/report/cash_flow/cash_flow.html
@@ -0,0 +1 @@
+{% include "accounts/report/financial_statements.html" %}
\ No newline at end of file
diff --git a/erpnext/accounts/report/financial_statements.py b/erpnext/accounts/report/financial_statements.py
index 97d2cdb..e66d20e 100644
--- a/erpnext/accounts/report/financial_statements.py
+++ b/erpnext/accounts/report/financial_statements.py
@@ -324,12 +324,17 @@
 		additional_conditions.append("posting_date >= %(from_date)s")
 
 	if filters:
-		for key in ['cost_center', 'project']:
-			if filters.get(key):
-				additional_conditions.append("%s = '%s'"%(key, filters.get(key)))
+		if filters.get("project"):
+			additional_conditions.append("project = '%s'"%(frappe.db.escape(filters.get("project"))))
+		if filters.get("cost_center"):
+			additional_conditions.append(get_cost_center_cond(filters.get("cost_center")))
 
 	return " and {}".format(" and ".join(additional_conditions)) if additional_conditions else ""
 
+def get_cost_center_cond(cost_center):
+	lft, rgt = frappe.db.get_value("Cost Center", cost_center, ["lft", "rgt"])
+	return (""" cost_center in (select name from `tabCost Center` where lft >=%s and rgt <=%s)"""%(lft, rgt))
+
 def get_columns(periodicity, period_list, accumulated_values=1, company=None):
 	columns = [{
 		"fieldname": "account",
diff --git a/erpnext/accounts/report/item_wise_purchase_register/item_wise_purchase_register.py b/erpnext/accounts/report/item_wise_purchase_register/item_wise_purchase_register.py
index d6bbee5..1d417da 100644
--- a/erpnext/accounts/report/item_wise_purchase_register/item_wise_purchase_register.py
+++ b/erpnext/accounts/report/item_wise_purchase_register/item_wise_purchase_register.py
@@ -31,7 +31,7 @@
 			purchase_receipt = d.purchase_receipt
 		elif d.po_detail:
 			purchase_receipt = ", ".join(frappe.db.sql_list("""select distinct parent
-			from `tabPurchase Receipt Item` where docstatus=1 and prevdoc_detail_docname=%s""", d.po_detail))
+			from `tabPurchase Receipt Item` where docstatus=1 and purchase_order_item=%s""", d.po_detail))
 
 		expense_account = d.expense_account or aii_account_map.get(d.company)
 		row = [d.item_code, d.item_name, d.item_group, d.parent, d.posting_date, d.supplier,
diff --git a/erpnext/accounts/report/profitability_analysis/profitability_analysis.html b/erpnext/accounts/report/profitability_analysis/profitability_analysis.html
new file mode 100644
index 0000000..40ba20c
--- /dev/null
+++ b/erpnext/accounts/report/profitability_analysis/profitability_analysis.html
@@ -0,0 +1 @@
+{% include "accounts/report/financial_statements.html" %}
\ No newline at end of file
diff --git a/erpnext/accounts/report/trial_balance_for_party/trial_balance_for_party.js b/erpnext/accounts/report/trial_balance_for_party/trial_balance_for_party.js
index 4d2efad..7ccec30 100644
--- a/erpnext/accounts/report/trial_balance_for_party/trial_balance_for_party.js
+++ b/erpnext/accounts/report/trial_balance_for_party/trial_balance_for_party.js
@@ -51,6 +51,19 @@
 			"default": "Customer"
 		},
 		{
+			"fieldname":"party",
+			"label": __("Party"),
+			"fieldtype": "Dynamic Link",
+			"get_options": function() {
+				var party_type = frappe.query_report_filters_by_name.party_type.get_value();
+				var party = frappe.query_report_filters_by_name.party.get_value();
+				if(party && !party_type) {
+					frappe.throw(__("Please select Party Type first"));
+				}
+				return party_type;
+			}
+		},
+		{
 			"fieldname": "show_zero_values",
 			"label": __("Show zero values"),
 			"fieldtype": "Check"
diff --git a/erpnext/accounts/report/trial_balance_for_party/trial_balance_for_party.py b/erpnext/accounts/report/trial_balance_for_party/trial_balance_for_party.py
index 58222ac..6480623 100644
--- a/erpnext/accounts/report/trial_balance_for_party/trial_balance_for_party.py
+++ b/erpnext/accounts/report/trial_balance_for_party/trial_balance_for_party.py
@@ -20,13 +20,23 @@
 	
 def get_data(filters, show_party_name):
 	party_name_field = "customer_name" if filters.get("party_type")=="Customer" else "supplier_name"
-	parties = frappe.get_all(filters.get("party_type"), fields = ["name", party_name_field], order_by="name")
+	party_filters = {"name": filters.get("party")} if filters.get("party") else {}
+	parties = frappe.get_all(filters.get("party_type"), fields = ["name", party_name_field], 
+		filters = party_filters, order_by="name")
 	company_currency = frappe.db.get_value("Company", filters.company, "default_currency")
 	opening_balances = get_opening_balances(filters)
 	balances_within_period = get_balances_within_period(filters)
 	
 	data = []
-	total_debit, total_credit = 0, 0
+	# total_debit, total_credit = 0, 0
+	total_row = frappe._dict({
+		"opening_debit": 0,
+		"opening_credit": 0,
+		"debit": 0,
+		"credit": 0,
+		"closing_debit": 0,
+		"closing_credit": 0
+	})
 	for party in parties:
 		row = { "party": party.name }
 		if show_party_name:
@@ -45,11 +55,7 @@
 			"debit": debit,
 			"credit": credit
 		})
-		
-		# totals
-		total_debit += debit
-		total_credit += credit
-		
+				
 		# closing
 		closing_debit, closing_credit = toggle_debit_credit(opening_debit + debit, opening_credit + credit)
 		row.update({
@@ -57,6 +63,10 @@
 			"closing_credit": closing_credit
 		})
 		
+		# totals
+		for col in total_row:
+			total_row[col] += row.get(col)
+		
 		row.update({
 			"currency": company_currency
 		})
@@ -69,13 +79,12 @@
 			data.append(row)
 		
 	# Add total row
-	if total_debit or total_credit:
-		data.append({
-			"party": "'" + _("Totals") + "'",
-			"debit": total_debit,
-			"credit": total_credit,
-			"currency": company_currency
-		})
+	
+	total_row.update({
+		"party": "'" + _("Totals") + "'",
+		"currency": company_currency
+	})
+	data.append(total_row)
 	
 	return data
 	
diff --git a/erpnext/accounts/utils.py b/erpnext/accounts/utils.py
index f3dc7ba..cec01a0 100644
--- a/erpnext/accounts/utils.py
+++ b/erpnext/accounts/utils.py
@@ -401,16 +401,22 @@
 	payment_entry.set_amounts()
 	payment_entry.save(ignore_permissions=True)
 	
-def unlink_ref_doc_from_payment_entries(ref_type, ref_no):
-	remove_ref_doc_link_from_jv(ref_type, ref_no)
-	remove_ref_doc_link_from_pe(ref_type, ref_no)
+def unlink_ref_doc_from_payment_entries(ref_doc):
+	remove_ref_doc_link_from_jv(ref_doc.doctype, ref_doc.name)
+	remove_ref_doc_link_from_pe(ref_doc.doctype, ref_doc.name)
 	
 	frappe.db.sql("""update `tabGL Entry`
 		set against_voucher_type=null, against_voucher=null,
 		modified=%s, modified_by=%s
 		where against_voucher_type=%s and against_voucher=%s
 		and voucher_no != ifnull(against_voucher, '')""",
-		(now(), frappe.session.user, ref_type, ref_no))
+		(now(), frappe.session.user, ref_doc.doctype, ref_doc.name))
+	
+	if ref_doc.doctype in ("Sales Invoice", "Purchase Invoice"):
+		ref_doc.set("advances", [])
+	
+		frappe.db.sql("""delete from `tab{0} Advance` where parent = %s"""
+			.format(ref_doc.doctype), ref_doc.name)
 
 def remove_ref_doc_link_from_jv(ref_type, ref_no):
 	linked_jv = frappe.db.sql_list("""select parent from `tabJournal Entry Account`
diff --git a/erpnext/buying/doctype/quality_inspection/quality_inspection.js b/erpnext/buying/doctype/quality_inspection/quality_inspection.js
deleted file mode 100644
index 628337b..0000000
--- a/erpnext/buying/doctype/quality_inspection/quality_inspection.js
+++ /dev/null
@@ -1,68 +0,0 @@
-// Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
-// License: GNU General Public License v3. See license.txt
-
-cur_frm.cscript.inspection_type = function(doc, cdt, cdn) {
-	if(doc.inspection_type == 'Incoming'){
-		doc.delivery_note_no = '';
-		hide_field('delivery_note_no');
-		unhide_field('purchase_receipt_no');
-	}
-	else if(doc.inspection_type == 'Outgoing'){
-		doc.purchase_receipt_no = '';
-		unhide_field('delivery_note_no');
-		hide_field('purchase_receipt_no');
-
-	}
-	else {
-		doc.purchase_receipt_no = '';
-		doc.delivery_note_no = '';
-		hide_field('purchase_receipt_no');
-		hide_field('delivery_note_no');
-	}
-}
-
-cur_frm.cscript.refresh = cur_frm.cscript.inspection_type;
-
-// item code based on GRN/DN
-cur_frm.fields_dict['item_code'].get_query = function(doc, cdt, cdn) {
-	if (doc.purchase_receipt_no) {
-		return {
-			query: "erpnext.buying.doctype.quality_inspection.quality_inspection.item_query",
-			filters: {
-				"from": "Purchase Receipt Item",
-				"parent": doc.purchase_receipt_no
-			}
-		}
-	} else if (doc.delivery_note_no) {
-		return {
-			query: "erpnext.buying.doctype.quality_inspection.quality_inspection.item_query",
-			filters: {
-				"from": "Delivery Note Item",
-				"parent": doc.delivery_note_no
-			}
-		}
-	}
-}
-
-// Serial No based on item_code
-cur_frm.fields_dict['item_serial_no'].get_query = function(doc, cdt, cdn) {
-	var filters = {};
-	if (doc.item_code) {
-		filters = {
-			'item_code': doc.item_code
-		}
-	}
-	return { filters: filters }
-}
-
-cur_frm.set_query("batch_no", function(doc) {
-	return {
-		filters: {
-			"item": doc.item_code
-		}
-	}
-})
-
-cur_frm.add_fetch('item_code', 'item_name', 'item_name');
-cur_frm.add_fetch('item_code', 'description', 'description');
-
diff --git a/erpnext/config/accounts.py b/erpnext/config/accounts.py
index 419d83f..b9c503a 100644
--- a/erpnext/config/accounts.py
+++ b/erpnext/config/accounts.py
@@ -373,6 +373,12 @@
 				},
 				{
 					"type": "report",
+					"name": "Profitability Analysis",
+					"doctype": "GL Entry",
+					"is_query_report": True,
+				},
+				{
+					"type": "report",
 					"name": "Payment Period Based On Invoice Date",
 					"is_query_report": True,
 					"doctype": "Journal Entry"
diff --git a/erpnext/config/docs.py b/erpnext/config/docs.py
index d1a54e8..7b6915a 100644
--- a/erpnext/config/docs.py
+++ b/erpnext/config/docs.py
@@ -15,14 +15,16 @@
 listed as one of the Best Open Source Softwares in the world by many online
 blogs."""
 
-docs_version = "6.x.x"
+docs_version = "7.x.x"
 splash_light_background = True
 
 def get_context(context):
-	context.brand_html = "ERPNext"
+	context.brand_html = ('<img class="brand-logo" src="'+context.docs_base_url
+		+'/assets/img/erpnext-docs.png"> ERPNext</img>')
 	context.app.splash_light_background = True
 	context.top_bar_items = [
 		{"label": "User Manual", "url": context.docs_base_url + "/user/manual", "right": 1},
 		{"label": "Videos", "url": context.docs_base_url + "/user/videos", "right": 1},
-		{"label": "API Documentation", "url": context.docs_base_url + "/current", "right": 1}
+		{"label": "API", "url": context.docs_base_url + "/current", "right": 1},
+		{"label": "Forum", "url": 'https://discuss.erpnext.com', "right": 1}
 	]
diff --git a/erpnext/config/hr.py b/erpnext/config/hr.py
index 51c258b..39d8878 100644
--- a/erpnext/config/hr.py
+++ b/erpnext/config/hr.py
@@ -185,6 +185,10 @@
 					"name": "Designation",
 					"description": _("Employee designation (e.g. CEO, Director etc.).")
 				},
+				{
+					"type": "doctype",
+					"name": "Daily Work Summary Settings"
+				},
 			]
 		},
 		{
diff --git a/erpnext/config/schools.py b/erpnext/config/schools.py
index 41a8e71..c35c1f2 100644
--- a/erpnext/config/schools.py
+++ b/erpnext/config/schools.py
@@ -48,6 +48,45 @@
 				{
 					"type": "doctype",
 					"name": "Program Enrollment Tool"
+				},
+				{
+					"type": "doctype",
+					"name": "Student Batch Creation Tool"
+				}
+			]
+		},
+		{
+			"label": _("Attendance"),
+			"items": [
+				{
+					"type": "doctype",
+					"name": "Student Attendance"
+				},
+				{
+					"type": "doctype",
+					"name": "Student Leave Application"
+				},
+				{
+					"type": "doctype",
+					"name": "Student Batch Attendance Tool"
+				},
+				{
+					"type": "report",
+					"is_query_report": True,
+					"name": "Absent Student Report",
+					"doctype": "Attendance"
+				},
+				{
+					"type": "report",
+					"is_query_report": True,
+					"name": "Student Batch-Wise Attendance",
+					"doctype": "Attendance"
+				},
+				{
+					"type": "report",
+					"is_query_report": True,
+					"name": "Student Monthly Attendance Sheet",
+					"doctype": "Attendance"
 				}
 			]
 		},
@@ -61,8 +100,13 @@
 				},
 				{
 					"type": "doctype",
-					"name": "Student Attendance"
-				},
+					"name": "Course Scheduling Tool"
+				}
+			]
+		},
+		{
+			"label": _("Assessment"),
+			"items": [
 				{
 					"type": "doctype",
 					"name": "Assessment"
@@ -73,11 +117,7 @@
 				},
 				{
 					"type": "doctype",
-					"name": "Student Batch Attendance Tool"
-				},
-				{
-					"type": "doctype",
-					"name": "Scheduling Tool"
+					"name": "Grading Structure"
 				}
 			]
 		},
@@ -134,14 +174,6 @@
 				},
 				{
 					"type": "doctype",
-					"name": "Student Category"
-				},
-				{
-					"type": "doctype",
-					"name": "Grading Structure"
-				},
-				{
-					"type": "doctype",
 					"name": "Instructor"
 				},
 				{
@@ -150,6 +182,14 @@
 				},
 				{
 					"type": "doctype",
+					"name": "Student Category"
+				},
+				{
+					"type": "doctype",
+					"name": "Student Batch Name"
+				},
+				{
+					"type": "doctype",
 					"name": "Academic Term"
 				},
 				{
diff --git a/erpnext/controllers/accounts_controller.py b/erpnext/controllers/accounts_controller.py
index eec07db..5796a4d 100644
--- a/erpnext/controllers/accounts_controller.py
+++ b/erpnext/controllers/accounts_controller.py
@@ -565,6 +565,21 @@
 							elif asset.status in ("Scrapped", "Cancelled", "Sold"):
 								frappe.throw(_("Row #{0}: Asset {1} cannot be submitted, it is already {2}")
 									.format(d.idx, d.asset, asset.status))
+									
+	def delink_advance_entries(self, linked_doc_name):
+		total_allocated_amount = 0
+		for adv in self.advances:
+			consider_for_total_advance = True
+			if adv.reference_name == linked_doc_name:
+				frappe.db.sql("""delete from `tab{0} Advance`
+					where name = %s""".format(self.doctype), adv.name)
+				consider_for_total_advance = False
+
+			if consider_for_total_advance:
+				total_allocated_amount += flt(adv.allocated_amount, adv.precision("allocated_amount"))
+
+		frappe.db.set_value(self.doctype, self.name, "total_advance", 
+			total_allocated_amount, update_modified=False)
 
 	def group_similar_items(self):
 		group_item_qty = {}
diff --git a/erpnext/controllers/stock_controller.py b/erpnext/controllers/stock_controller.py
index e48ca1a..0c85aa1 100644
--- a/erpnext/controllers/stock_controller.py
+++ b/erpnext/controllers/stock_controller.py
@@ -11,6 +11,10 @@
 from erpnext.controllers.accounts_controller import AccountsController
 
 class StockController(AccountsController):
+	def validate(self):
+		super(StockController, self).validate()
+		self.validate_inspection()
+	
 	def make_gl_entries(self, repost_future_gle=True):
 		if self.docstatus == 2:
 			delete_gl_entries(voucher_type=self.doctype, voucher_no=self.name)
@@ -254,6 +258,28 @@
 			"name": self.name,
 		}, update_modified)
 
+	def validate_inspection(self):
+		'''Checks if quality inspection is set for Items that require inspection.
+		On submit, throw an exception'''
+		
+		inspection_required_fieldname = None
+		if self.doctype in ["Purchase Receipt", "Purchase Invoice"]:
+			inspection_required_fieldname = "inspection_required_before_purchase"
+		elif self.doctype in ["Delivery Note", "Sales Invoice"]:
+			inspection_required_fieldname = "inspection_required_before_delivery"
+		
+		if not inspection_required_fieldname or \
+			(self.doctype in ["Sales Invoice", "Purchase Invoice"] and not self.update_stock):
+				return
+		
+		for d in self.get('items'):
+			if (frappe.db.get_value("Item", d.item_code, inspection_required_fieldname) 
+				and not d.quality_inspection):
+				
+				frappe.msgprint(_("Quality Inspection required for Item {0}").format(d.item_code))
+				if self.docstatus==1:
+					raise frappe.ValidationError
+
 def update_gl_entries_after(posting_date, posting_time, for_warehouses=None, for_items=None,
 		warehouse_account=None):
 	def _delete_gl_entries(voucher_type, voucher_no):
diff --git a/erpnext/docs/assets/img/articles/barcode-feature-setup.png b/erpnext/docs/assets/img/articles/barcode-feature-setup.png
deleted file mode 100644
index 0a097ef..0000000
--- a/erpnext/docs/assets/img/articles/barcode-feature-setup.png
+++ /dev/null
Binary files differ
diff --git a/erpnext/docs/assets/img/articles/sales-person-transaction-4.png b/erpnext/docs/assets/img/articles/sales-person-transaction-4.png
deleted file mode 100644
index 5883c76..0000000
--- a/erpnext/docs/assets/img/articles/sales-person-transaction-4.png
+++ /dev/null
Binary files differ
diff --git a/erpnext/docs/assets/img/buying/add_taxes_to_doc.png b/erpnext/docs/assets/img/buying/add_taxes_to_doc.png
new file mode 100644
index 0000000..3e1480d
--- /dev/null
+++ b/erpnext/docs/assets/img/buying/add_taxes_to_doc.png
Binary files differ
diff --git a/erpnext/docs/assets/img/buying/buying_flow.png b/erpnext/docs/assets/img/buying/buying_flow.png
new file mode 100644
index 0000000..7b3f256
--- /dev/null
+++ b/erpnext/docs/assets/img/buying/buying_flow.png
Binary files differ
diff --git a/erpnext/docs/assets/img/buying/show_tax_breakup.png b/erpnext/docs/assets/img/buying/show_tax_breakup.png
new file mode 100644
index 0000000..7348d51
--- /dev/null
+++ b/erpnext/docs/assets/img/buying/show_tax_breakup.png
Binary files differ
diff --git a/erpnext/docs/assets/img/crm/create-customer.gif b/erpnext/docs/assets/img/crm/create-customer.gif
new file mode 100644
index 0000000..a615f2a
--- /dev/null
+++ b/erpnext/docs/assets/img/crm/create-customer.gif
Binary files differ
diff --git a/erpnext/docs/assets/img/crm/customer-to selling-flowchart.jpeg b/erpnext/docs/assets/img/crm/customer-to selling-flowchart.jpeg
new file mode 100644
index 0000000..70e536e
--- /dev/null
+++ b/erpnext/docs/assets/img/crm/customer-to selling-flowchart.jpeg
Binary files differ
diff --git a/erpnext/docs/assets/img/crm/make-sq-from-opportunity.png b/erpnext/docs/assets/img/crm/make-sq-from-opportunity.png
new file mode 100644
index 0000000..9d41027
--- /dev/null
+++ b/erpnext/docs/assets/img/crm/make-sq-from-opportunity.png
Binary files differ
diff --git a/erpnext/docs/assets/img/crm/requirement-gathering.png b/erpnext/docs/assets/img/crm/requirement-gathering.png
new file mode 100644
index 0000000..cd631d6
--- /dev/null
+++ b/erpnext/docs/assets/img/crm/requirement-gathering.png
Binary files differ
diff --git a/erpnext/docs/assets/img/customize/feature-setup.png b/erpnext/docs/assets/img/customize/feature-setup.png
deleted file mode 100644
index 200d138..0000000
--- a/erpnext/docs/assets/img/customize/feature-setup.png
+++ /dev/null
Binary files differ
diff --git a/erpnext/docs/assets/img/erpnext-docs.png b/erpnext/docs/assets/img/erpnext-docs.png
new file mode 100644
index 0000000..a814703
--- /dev/null
+++ b/erpnext/docs/assets/img/erpnext-docs.png
Binary files differ
diff --git a/erpnext/docs/assets/img/human-resources/daily-work-summary-settings.png b/erpnext/docs/assets/img/human-resources/daily-work-summary-settings.png
new file mode 100644
index 0000000..c4801c2
--- /dev/null
+++ b/erpnext/docs/assets/img/human-resources/daily-work-summary-settings.png
Binary files differ
diff --git a/erpnext/docs/assets/img/manufacturing/PO-FG-update.png b/erpnext/docs/assets/img/manufacturing/PO-FG-update.png
index b07a7cf..97ce265 100644
--- a/erpnext/docs/assets/img/manufacturing/PO-FG-update.png
+++ b/erpnext/docs/assets/img/manufacturing/PO-FG-update.png
Binary files differ
diff --git a/erpnext/docs/assets/img/manufacturing/PO-material-transfer-qty.png b/erpnext/docs/assets/img/manufacturing/PO-material-transfer-qty.png
index e8dea02..6191e13 100644
--- a/erpnext/docs/assets/img/manufacturing/PO-material-transfer-qty.png
+++ b/erpnext/docs/assets/img/manufacturing/PO-material-transfer-qty.png
Binary files differ
diff --git a/erpnext/docs/assets/img/manufacturing/PO-material-transfer-updated.png b/erpnext/docs/assets/img/manufacturing/PO-material-transfer-updated.png
index 5c20ff8..0cd0bd1 100644
--- a/erpnext/docs/assets/img/manufacturing/PO-material-transfer-updated.png
+++ b/erpnext/docs/assets/img/manufacturing/PO-material-transfer-updated.png
Binary files differ
diff --git a/erpnext/docs/assets/img/manufacturing/PO-material-transfer.png b/erpnext/docs/assets/img/manufacturing/PO-material-transfer.png
index dbdc303..c323628 100644
--- a/erpnext/docs/assets/img/manufacturing/PO-material-transfer.png
+++ b/erpnext/docs/assets/img/manufacturing/PO-material-transfer.png
Binary files differ
diff --git a/erpnext/docs/assets/img/manufacturing/PO-operations-make-ts.png b/erpnext/docs/assets/img/manufacturing/PO-operations-make-ts.png
new file mode 100644
index 0000000..07b5170
--- /dev/null
+++ b/erpnext/docs/assets/img/manufacturing/PO-operations-make-ts.png
Binary files differ
diff --git a/erpnext/docs/assets/img/manufacturing/PO-operations.png b/erpnext/docs/assets/img/manufacturing/PO-operations.png
index 6916891..4b091ce 100644
--- a/erpnext/docs/assets/img/manufacturing/PO-operations.png
+++ b/erpnext/docs/assets/img/manufacturing/PO-operations.png
Binary files differ
diff --git a/erpnext/docs/assets/img/manufacturing/PO-stop.png b/erpnext/docs/assets/img/manufacturing/PO-stop.png
index c486a68..0c82573 100644
--- a/erpnext/docs/assets/img/manufacturing/PO-stop.png
+++ b/erpnext/docs/assets/img/manufacturing/PO-stop.png
Binary files differ
diff --git a/erpnext/docs/assets/img/manufacturing/manufacturing-flow.png b/erpnext/docs/assets/img/manufacturing/manufacturing-flow.png
new file mode 100644
index 0000000..4701ad0
--- /dev/null
+++ b/erpnext/docs/assets/img/manufacturing/manufacturing-flow.png
Binary files differ
diff --git a/erpnext/docs/assets/img/manufacturing/price-list-based-currency-bom.png b/erpnext/docs/assets/img/manufacturing/price-list-based-currency-bom.png
new file mode 100644
index 0000000..c8eca6a
--- /dev/null
+++ b/erpnext/docs/assets/img/manufacturing/price-list-based-currency-bom.png
Binary files differ
diff --git a/erpnext/docs/assets/img/manufacturing/production-order.png b/erpnext/docs/assets/img/manufacturing/production-order.png
index d1e7966..fb552f3 100644
--- a/erpnext/docs/assets/img/manufacturing/production-order.png
+++ b/erpnext/docs/assets/img/manufacturing/production-order.png
Binary files differ
diff --git a/erpnext/docs/assets/img/selling/selling-flow.png b/erpnext/docs/assets/img/selling/selling-flow.png
new file mode 100644
index 0000000..7f35f80
--- /dev/null
+++ b/erpnext/docs/assets/img/selling/selling-flow.png
Binary files differ
diff --git a/erpnext/docs/assets/img/setup/data-import/data-import-tool-template.gif b/erpnext/docs/assets/img/setup/data-import/data-import-tool-template.gif
new file mode 100644
index 0000000..c4d28f4
--- /dev/null
+++ b/erpnext/docs/assets/img/setup/data-import/data-import-tool-template.gif
Binary files differ
diff --git a/erpnext/docs/assets/img/setup/data-import/import-csv.png b/erpnext/docs/assets/img/setup/data-import/import-csv.png
new file mode 100644
index 0000000..3b9bc9f
--- /dev/null
+++ b/erpnext/docs/assets/img/setup/data-import/import-csv.png
Binary files differ
diff --git a/erpnext/docs/assets/img/setup/data-import/import-file.png b/erpnext/docs/assets/img/setup/data-import/import-file.png
new file mode 100644
index 0000000..c99e015
--- /dev/null
+++ b/erpnext/docs/assets/img/setup/data-import/import-file.png
Binary files differ
diff --git a/erpnext/schools/doctype/scheduling_tool/__init__.py b/erpnext/docs/assets/img/setup/integration-service/__init__.py
similarity index 100%
copy from erpnext/schools/doctype/scheduling_tool/__init__.py
copy to erpnext/docs/assets/img/setup/integration-service/__init__.py
diff --git a/erpnext/docs/assets/img/setup/integration-service/api-step-1.png b/erpnext/docs/assets/img/setup/integration-service/api-step-1.png
new file mode 100644
index 0000000..d51434d
--- /dev/null
+++ b/erpnext/docs/assets/img/setup/integration-service/api-step-1.png
Binary files differ
diff --git a/erpnext/docs/assets/img/setup/integration-service/api-step-2.png b/erpnext/docs/assets/img/setup/integration-service/api-step-2.png
new file mode 100644
index 0000000..f4dfa43
--- /dev/null
+++ b/erpnext/docs/assets/img/setup/integration-service/api-step-2.png
Binary files differ
diff --git a/erpnext/docs/assets/img/setup/integration-service/api-step-3.png b/erpnext/docs/assets/img/setup/integration-service/api-step-3.png
new file mode 100644
index 0000000..070fded
--- /dev/null
+++ b/erpnext/docs/assets/img/setup/integration-service/api-step-3.png
Binary files differ
diff --git a/erpnext/docs/assets/img/setup/integration-service/create_dropbox_service.png b/erpnext/docs/assets/img/setup/integration-service/create_dropbox_service.png
new file mode 100644
index 0000000..daa792c
--- /dev/null
+++ b/erpnext/docs/assets/img/setup/integration-service/create_dropbox_service.png
Binary files differ
diff --git a/erpnext/docs/assets/img/setup/dropbox-2.png b/erpnext/docs/assets/img/setup/integration-service/dropbox-2.png
similarity index 100%
rename from erpnext/docs/assets/img/setup/dropbox-2.png
rename to erpnext/docs/assets/img/setup/integration-service/dropbox-2.png
Binary files differ
diff --git a/erpnext/docs/assets/img/setup/dropbox-3.png b/erpnext/docs/assets/img/setup/integration-service/dropbox-3.png
similarity index 100%
rename from erpnext/docs/assets/img/setup/dropbox-3.png
rename to erpnext/docs/assets/img/setup/integration-service/dropbox-3.png
Binary files differ
diff --git a/erpnext/docs/assets/img/setup/dropbox-open-1.png b/erpnext/docs/assets/img/setup/integration-service/dropbox-open-1.png
similarity index 100%
rename from erpnext/docs/assets/img/setup/dropbox-open-1.png
rename to erpnext/docs/assets/img/setup/integration-service/dropbox-open-1.png
Binary files differ
diff --git a/erpnext/docs/assets/img/setup/dropbox-open-2.png b/erpnext/docs/assets/img/setup/integration-service/dropbox-open-2.png
similarity index 100%
rename from erpnext/docs/assets/img/setup/dropbox-open-2.png
rename to erpnext/docs/assets/img/setup/integration-service/dropbox-open-2.png
Binary files differ
diff --git a/erpnext/docs/assets/img/setup/dropbox-open-3.png b/erpnext/docs/assets/img/setup/integration-service/dropbox-open-3.png
similarity index 100%
rename from erpnext/docs/assets/img/setup/dropbox-open-3.png
rename to erpnext/docs/assets/img/setup/integration-service/dropbox-open-3.png
Binary files differ
diff --git a/erpnext/docs/assets/img/setup/integration-service/ldap_settings.png b/erpnext/docs/assets/img/setup/integration-service/ldap_settings.png
new file mode 100644
index 0000000..c0ecbc7
--- /dev/null
+++ b/erpnext/docs/assets/img/setup/integration-service/ldap_settings.png
Binary files differ
diff --git a/erpnext/docs/assets/img/setup/integration-service/login_via_ldap.png b/erpnext/docs/assets/img/setup/integration-service/login_via_ldap.png
new file mode 100644
index 0000000..15fd387
--- /dev/null
+++ b/erpnext/docs/assets/img/setup/integration-service/login_via_ldap.png
Binary files differ
diff --git a/erpnext/docs/assets/img/setup/integration-service/payment_gateway_account_paypal.png b/erpnext/docs/assets/img/setup/integration-service/payment_gateway_account_paypal.png
new file mode 100644
index 0000000..e6f1665
--- /dev/null
+++ b/erpnext/docs/assets/img/setup/integration-service/payment_gateway_account_paypal.png
Binary files differ
diff --git a/erpnext/docs/assets/img/setup/integration-service/payment_gateway_account_razorpay.png b/erpnext/docs/assets/img/setup/integration-service/payment_gateway_account_razorpay.png
new file mode 100644
index 0000000..e09e797
--- /dev/null
+++ b/erpnext/docs/assets/img/setup/integration-service/payment_gateway_account_razorpay.png
Binary files differ
diff --git a/erpnext/docs/assets/img/setup/integration-service/paypal_coa.png b/erpnext/docs/assets/img/setup/integration-service/paypal_coa.png
new file mode 100644
index 0000000..bf0ed19
--- /dev/null
+++ b/erpnext/docs/assets/img/setup/integration-service/paypal_coa.png
Binary files differ
diff --git a/erpnext/docs/assets/img/setup/integration-service/paypal_settings.png b/erpnext/docs/assets/img/setup/integration-service/paypal_settings.png
new file mode 100644
index 0000000..f5f5e54
--- /dev/null
+++ b/erpnext/docs/assets/img/setup/integration-service/paypal_settings.png
Binary files differ
diff --git a/erpnext/docs/assets/img/setup/integration-service/razorpay_coa.png b/erpnext/docs/assets/img/setup/integration-service/razorpay_coa.png
new file mode 100644
index 0000000..68cad28
--- /dev/null
+++ b/erpnext/docs/assets/img/setup/integration-service/razorpay_coa.png
Binary files differ
diff --git a/erpnext/docs/assets/img/setup/integration-service/razorpay_settings.png b/erpnext/docs/assets/img/setup/integration-service/razorpay_settings.png
new file mode 100644
index 0000000..042b422
--- /dev/null
+++ b/erpnext/docs/assets/img/setup/integration-service/razorpay_settings.png
Binary files differ
diff --git a/erpnext/docs/assets/img/setup/integration-service/sanbox-credentials.png b/erpnext/docs/assets/img/setup/integration-service/sanbox-credentials.png
new file mode 100644
index 0000000..21e8460
--- /dev/null
+++ b/erpnext/docs/assets/img/setup/integration-service/sanbox-credentials.png
Binary files differ
diff --git a/erpnext/docs/assets/img/setup/integration-service/setup-backup-frequency.png b/erpnext/docs/assets/img/setup/integration-service/setup-backup-frequency.png
new file mode 100644
index 0000000..916679e
--- /dev/null
+++ b/erpnext/docs/assets/img/setup/integration-service/setup-backup-frequency.png
Binary files differ
diff --git a/erpnext/docs/assets/img/setup/integration-service/setup-sanbox-1.png b/erpnext/docs/assets/img/setup/integration-service/setup-sanbox-1.png
new file mode 100644
index 0000000..932a62a
--- /dev/null
+++ b/erpnext/docs/assets/img/setup/integration-service/setup-sanbox-1.png
Binary files differ
diff --git a/erpnext/docs/assets/img/taxes-and-charges.gif b/erpnext/docs/assets/img/taxes-and-charges.gif
new file mode 100644
index 0000000..8d0a2bc
--- /dev/null
+++ b/erpnext/docs/assets/img/taxes-and-charges.gif
Binary files differ
diff --git a/erpnext/docs/assets/old_images/erpnext/import-3.png b/erpnext/docs/assets/old_images/erpnext/import-3.png
deleted file mode 100644
index 9387dd5..0000000
--- a/erpnext/docs/assets/old_images/erpnext/import-3.png
+++ /dev/null
Binary files differ
diff --git a/erpnext/docs/assets/old_images/erpnext/import-4.png b/erpnext/docs/assets/old_images/erpnext/import-4.png
deleted file mode 100644
index fce1f51..0000000
--- a/erpnext/docs/assets/old_images/erpnext/import-4.png
+++ /dev/null
Binary files differ
diff --git a/erpnext/docs/contents.py b/erpnext/docs/contents.py
index 131d410..c23737a 100644
--- a/erpnext/docs/contents.py
+++ b/erpnext/docs/contents.py
@@ -6,4 +6,4 @@
 from frappe.website.utils import get_full_index
 
 def get_context(context):
-	context.full_index = get_full_index(extn = True)
+	context.full_index = get_full_index()
diff --git a/erpnext/docs/current/models/stock/material_request_item.html b/erpnext/docs/current/models/stock/material_request_item.html
deleted file mode 100644
index 2d1e2a0..0000000
--- a/erpnext/docs/current/models/stock/material_request_item.html
+++ /dev/null
@@ -1,414 +0,0 @@
-<!-- title: Material Request Item -->
-
-
-
-
-
-<div class="dev-header">
-
-<a class="btn btn-default btn-sm" disabled style="margin-bottom: 10px;">
-	Version 6.x.x</a>
-
-
-	<a class="btn btn-default btn-sm" href="https://github.com/frappe/erpnext/tree/develop/erpnext/stock/doctype/material_request_item"
-		target="_blank" style="margin-left: 10px; margin-bottom: 10px;"><i class="octicon octicon-mark-github"></i> Source</a>
-
-</div>
-
-
-<span class="label label-info">Child Table</span>
-
-
-    <p><b>Table Name:</b> <code>tabMaterial Request Item</code></p>
-
-
-
-
-<h3>Fields</h3>
-
-<table class="table table-bordered">
-    <thead>
-        <tr>
-            <th style="width: 5%">Sr</th>
-            <th style="width: 25%">Fieldname</th>
-            <th style="width: 20%">Type</th>
-            <th style="width: 25%">Label</th>
-            <th style="width: 25%">Options</th>
-        </tr>
-    </thead>
-    <tbody>
-        
-        <tr >
-            <td>1</td>
-            <td class="danger" title="Mandatory"><code>item_code</code></td>
-            <td >
-                Link</td>
-            <td >
-                Item Code
-                
-            </td>
-            <td>
-                
-                
-
-
-<a href="https://frappe.github.io/erpnext/current/models/stock/item">Item</a>
-
-
-                
-            </td>
-        </tr>
-        
-        <tr >
-            <td>2</td>
-            <td ><code>col_break1</code></td>
-            <td class="info">
-                Column Break</td>
-            <td >
-                
-                
-            </td>
-            <td></td>
-        </tr>
-        
-        <tr >
-            <td>3</td>
-            <td ><code>item_name</code></td>
-            <td >
-                Data</td>
-            <td >
-                Item Name
-                
-            </td>
-            <td></td>
-        </tr>
-        
-        <tr class="info">
-            <td>4</td>
-            <td ><code>section_break_4</code></td>
-            <td >
-                Section Break</td>
-            <td >
-                Description
-                
-            </td>
-            <td></td>
-        </tr>
-        
-        <tr >
-            <td>5</td>
-            <td class="danger" title="Mandatory"><code>description</code></td>
-            <td >
-                Text Editor</td>
-            <td >
-                Description
-                
-            </td>
-            <td></td>
-        </tr>
-        
-        <tr >
-            <td>6</td>
-            <td ><code>column_break_6</code></td>
-            <td class="info">
-                Column Break</td>
-            <td >
-                
-                
-            </td>
-            <td></td>
-        </tr>
-        
-        <tr >
-            <td>7</td>
-            <td ><code>image</code></td>
-            <td >
-                Attach Image</td>
-            <td >
-                Image
-                
-            </td>
-            <td></td>
-        </tr>
-        
-        <tr class="info">
-            <td>8</td>
-            <td ><code>quantity_and_warehouse</code></td>
-            <td >
-                Section Break</td>
-            <td >
-                Quantity and Warehouse
-                
-            </td>
-            <td></td>
-        </tr>
-        
-        <tr >
-            <td>9</td>
-            <td class="danger" title="Mandatory"><code>qty</code></td>
-            <td >
-                Float</td>
-            <td >
-                Quantity
-                
-            </td>
-            <td></td>
-        </tr>
-        
-        <tr >
-            <td>10</td>
-            <td class="danger" title="Mandatory"><code>uom</code></td>
-            <td >
-                Link</td>
-            <td >
-                Stock UOM
-                
-            </td>
-            <td>
-                
-                
-
-
-<a href="https://frappe.github.io/erpnext/current/models/setup/uom">UOM</a>
-
-
-                
-            </td>
-        </tr>
-        
-        <tr >
-            <td>11</td>
-            <td ><code>warehouse</code></td>
-            <td >
-                Link</td>
-            <td >
-                For Warehouse
-                
-            </td>
-            <td>
-                
-                
-
-
-<a href="https://frappe.github.io/erpnext/current/models/stock/warehouse">Warehouse</a>
-
-
-                
-            </td>
-        </tr>
-        
-        <tr >
-            <td>12</td>
-            <td ><code>col_break2</code></td>
-            <td class="info">
-                Column Break</td>
-            <td >
-                
-                
-            </td>
-            <td></td>
-        </tr>
-        
-        <tr >
-            <td>13</td>
-            <td class="danger" title="Mandatory"><code>schedule_date</code></td>
-            <td >
-                Date</td>
-            <td >
-                Required Date
-                
-            </td>
-            <td></td>
-        </tr>
-        
-        <tr class="info">
-            <td>14</td>
-            <td ><code>more_info</code></td>
-            <td >
-                Section Break</td>
-            <td >
-                More Information
-                
-            </td>
-            <td></td>
-        </tr>
-        
-        <tr >
-            <td>15</td>
-            <td ><code>item_group</code></td>
-            <td >
-                Link</td>
-            <td >
-                Item Group
-                
-            </td>
-            <td>
-                
-                
-
-
-<a href="https://frappe.github.io/erpnext/current/models/setup/item_group">Item Group</a>
-
-
-                
-            </td>
-        </tr>
-        
-        <tr >
-            <td>16</td>
-            <td ><code>brand</code></td>
-            <td >
-                Link</td>
-            <td >
-                Brand
-                
-            </td>
-            <td>
-                
-                
-
-
-<a href="https://frappe.github.io/erpnext/current/models/setup/brand">Brand</a>
-
-
-                
-            </td>
-        </tr>
-        
-        <tr >
-            <td>17</td>
-            <td ><code>lead_time_date</code></td>
-            <td >
-                Date</td>
-            <td >
-                Lead Time Date
-                
-            </td>
-            <td></td>
-        </tr>
-        
-        <tr >
-            <td>18</td>
-            <td ><code>sales_order</code></td>
-            <td >
-                Link</td>
-            <td >
-                Sales Order
-                
-            </td>
-            <td>
-                
-                
-
-
-<a href="https://frappe.github.io/erpnext/current/models/selling/sales_order">Sales Order</a>
-
-
-                
-            </td>
-        </tr>
-        
-        <tr >
-            <td>19</td>
-            <td ><code>project</code></td>
-            <td >
-                Link</td>
-            <td >
-                Project
-                
-            </td>
-            <td>
-                
-                
-
-
-<a href="https://frappe.github.io/erpnext/current/models/projects/project">Project</a>
-
-
-                
-            </td>
-        </tr>
-        
-        <tr >
-            <td>20</td>
-            <td ><code>col_break3</code></td>
-            <td class="info">
-                Column Break</td>
-            <td >
-                
-                
-            </td>
-            <td></td>
-        </tr>
-        
-        <tr >
-            <td>21</td>
-            <td ><code>min_order_qty</code></td>
-            <td >
-                Float</td>
-            <td >
-                Min Order Qty
-                
-            </td>
-            <td></td>
-        </tr>
-        
-        <tr >
-            <td>22</td>
-            <td ><code>projected_qty</code></td>
-            <td >
-                Float</td>
-            <td >
-                Projected Qty
-                
-            </td>
-            <td></td>
-        </tr>
-        
-        <tr >
-            <td>23</td>
-            <td ><code>ordered_qty</code></td>
-            <td >
-                Float</td>
-            <td >
-                Completed Qty
-                
-            </td>
-            <td></td>
-        </tr>
-        
-        <tr >
-            <td>24</td>
-            <td ><code>page_break</code></td>
-            <td >
-                Check</td>
-            <td >
-                Page Break
-                
-            </td>
-            <td></td>
-        </tr>
-        
-    </tbody>
-</table>
-
-
-    
-    
-    <h4>Child Table Of</h4>
-    <ul>
-    
-        <li>
-
-
-<a href="https://frappe.github.io/erpnext/current/models/stock/material_request">Material Request</a>
-
-</li>
-    
-    </ul>
-    
-
-
-<!-- autodoc -->
-<!-- jinja -->
-<!-- static -->
\ No newline at end of file
diff --git a/erpnext/docs/license.html b/erpnext/docs/license.html
index 6aa4e64..43d90cf 100644
--- a/erpnext/docs/license.html
+++ b/erpnext/docs/license.html
@@ -2,183 +2,689 @@
 
 <h1>GNU General Public License (v3)</h1>
 
-<h2>ERPNext License Info</h2>
-
-<p>(c) 2013 Frappe Technologies Pvt Ltd. Mumbai
-ERPNext is a trademark of Frappe Technologies</p>
-
-<p>The ERPNext code is licensed under the GNU General Public License (v3) as mentioned below and the Documentation is licensed under Creative Commons (CC-BY-SA-3.0)</p>
-
-<h2>GNU GENERAL PUBLIC LICENSE</h2>
+<h3>GNU GENERAL PUBLIC LICENSE</h3>
 
 <p>Version 3, 29 June 2007</p>
 
-<p><a href="http://www.gnu.org/copyleft/gpl.html" rel="nofollow">http://www.gnu.org/copyleft/gpl.html</a></p>
+<p>Copyright (C) 2007 Free Software Foundation, Inc.
+<a href="http://fsf.org/" rel="nofollow">http://fsf.org/</a></p>
 
-<p>TERMS AND CONDITIONS
-0. Definitions.</p>
+<p>Everyone is permitted to copy and distribute verbatim copies of this
+license document, but changing it is not allowed.</p>
 
-<p>“This License” refers to version 3 of the GNU General Public License.</p>
+<h3>Preamble</h3>
 
-<p>“Copyright” also means copyright-like laws that apply to other kinds of works, such as semiconductor masks.</p>
+<p>The GNU General Public License is a free, copyleft license for
+software and other kinds of works.</p>
 
-<p>“The Program” refers to any copyrightable work licensed under this License. Each licensee is addressed as “you”. “Licensees” and “recipients” may be individuals or organizations.</p>
+<p>The licenses for most software and other practical works are designed
+to take away your freedom to share and change the works. By contrast,
+the GNU General Public License is intended to guarantee your freedom
+to share and change all versions of a program--to make sure it remains
+free software for all its users. We, the Free Software Foundation, use
+the GNU General Public License for most of our software; it applies
+also to any other work released this way by its authors. You can apply
+it to your programs, too.</p>
 
-<p>To “modify” a work means to copy from or adapt all or part of the work in a fashion requiring copyright permission, other than the making of an exact copy. The resulting work is called a “modified version” of the earlier work or a work “based on” the earlier work.</p>
+<p>When we speak of free software, we are referring to freedom, not
+price. Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+them if you wish), that you receive source code or can get it if you
+want it, that you can change the software or use pieces of it in new
+free programs, and that you know you can do these things.</p>
 
-<p>A “covered work” means either the unmodified Program or a work based on the Program.</p>
+<p>To protect your rights, we need to prevent others from denying you
+these rights or asking you to surrender the rights. Therefore, you
+have certain responsibilities if you distribute copies of the
+software, or if you modify it: responsibilities to respect the freedom
+of others.</p>
 
-<p>To “propagate” a work means to do anything with it that, without permission, would make you directly or secondarily liable for infringement under applicable copyright law, except executing it on a computer or modifying a private copy. Propagation includes copying, distribution (with or without modification), making available to the public, and in some countries other activities as well.</p>
+<p>For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must pass on to the recipients the same
+freedoms that you received. You must make sure that they, too, receive
+or can get the source code. And you must show them these terms so they
+know their rights.</p>
 
-<p>To “convey” a work means any kind of propagation that enables other parties to make or receive copies. Mere interaction with a user through a computer network, with no transfer of a copy, is not conveying.</p>
+<p>Developers that use the GNU GPL protect your rights with two steps:
+(1) assert copyright on the software, and (2) offer you this License
+giving you legal permission to copy, distribute and/or modify it.</p>
 
-<p>An interactive user interface displays “Appropriate Legal Notices” to the extent that it includes a convenient and prominently visible feature that (1) displays an appropriate copyright notice, and (2) tells the user that there is no warranty for the work (except to the extent that warranties are provided), that licensees may convey the work under this License, and how to view a copy of this License. If the interface presents a list of user commands or options, such as a menu, a prominent item in the list meets this criterion.
-1. Source Code.</p>
+<p>For the developers' and authors' protection, the GPL clearly explains
+that there is no warranty for this free software. For both users' and
+authors' sake, the GPL requires that modified versions be marked as
+changed, so that their problems will not be attributed erroneously to
+authors of previous versions.</p>
 
-<p>The “source code” for a work means the preferred form of the work for making modifications to it. “Object code” means any non-source form of a work.</p>
+<p>Some devices are designed to deny users access to install or run
+modified versions of the software inside them, although the
+manufacturer can do so. This is fundamentally incompatible with the
+aim of protecting users' freedom to change the software. The
+systematic pattern of such abuse occurs in the area of products for
+individuals to use, which is precisely where it is most unacceptable.
+Therefore, we have designed this version of the GPL to prohibit the
+practice for those products. If such problems arise substantially in
+other domains, we stand ready to extend this provision to those
+domains in future versions of the GPL, as needed to protect the
+freedom of users.</p>
 
-<p>A “Standard Interface” means an interface that either is an official standard defined by a recognized standards body, or, in the case of interfaces specified for a particular programming language, one that is widely used among developers working in that language.</p>
+<p>Finally, every program is threatened constantly by software patents.
+States should not allow patents to restrict development and use of
+software on general-purpose computers, but in those that do, we wish
+to avoid the special danger that patents applied to a free program
+could make it effectively proprietary. To prevent this, the GPL
+assures that patents cannot be used to render the program non-free.</p>
 
-<p>The “System Libraries” of an executable work include anything, other than the work as a whole, that (a) is included in the normal form of packaging a Major Component, but which is not part of that Major Component, and (b) serves only to enable use of the work with that Major Component, or to implement a Standard Interface for which an implementation is available to the public in source code form. A “Major Component”, in this context, means a major essential component (kernel, window system, and so on) of the specific operating system (if any) on which the executable work runs, or a compiler used to produce the work, or an object code interpreter used to run it.</p>
+<p>The precise terms and conditions for copying, distribution and
+modification follow.</p>
 
-<p>The “Corresponding Source” for a work in object code form means all the source code needed to generate, install, and (for an executable work) run the object code and to modify the work, including scripts to control those activities. However, it does not include the work's System Libraries, or general-purpose tools or generally available free programs which are used unmodified in performing those activities but which are not part of the work. For example, Corresponding Source includes interface definition files associated with source files for the work, and the source code for shared libraries and dynamically linked subprograms that the work is specifically designed to require, such as by intimate data communication or control flow between those subprograms and other parts of the work.</p>
+<h3>TERMS AND CONDITIONS</h3>
 
-<p>The Corresponding Source need not include anything that users can regenerate automatically from other parts of the Corresponding Source.</p>
+<h4>0. Definitions.</h4>
 
-<p>The Corresponding Source for a work in source code form is that same work.
-2. Basic Permissions.</p>
+<p>"This License" refers to version 3 of the GNU General Public License.</p>
 
-<p>All rights granted under this License are granted for the term of copyright on the Program, and are irrevocable provided the stated conditions are met. This License explicitly affirms your unlimited permission to run the unmodified Program. The output from running a covered work is covered by this License only if the output, given its content, constitutes a covered work. This License acknowledges your rights of fair use or other equivalent, as provided by copyright law.</p>
+<p>"Copyright" also means copyright-like laws that apply to other kinds
+of works, such as semiconductor masks.</p>
 
-<p>You may make, run and propagate covered works that you do not convey, without conditions so long as your license otherwise remains in force. You may convey covered works to others for the sole purpose of having them make modifications exclusively for you, or provide you with facilities for running those works, provided that you comply with the terms of this License in conveying all material for which you do not control copyright. Those thus making or running the covered works for you must do so exclusively on your behalf, under your direction and control, on terms that prohibit them from making any copies of your copyrighted material outside their relationship with you.</p>
+<p>"The Program" refers to any copyrightable work licensed under this
+License. Each licensee is addressed as "you". "Licensees" and
+"recipients" may be individuals or organizations.</p>
 
-<p>Conveying under any other circumstances is permitted solely under the conditions stated below. Sublicensing is not allowed; section 10 makes it unnecessary.
-3. Protecting Users' Legal Rights From Anti-Circumvention Law.</p>
+<p>To "modify" a work means to copy from or adapt all or part of the work
+in a fashion requiring copyright permission, other than the making of
+an exact copy. The resulting work is called a "modified version" of
+the earlier work or a work "based on" the earlier work.</p>
 
-<p>No covered work shall be deemed part of an effective technological measure under any applicable law fulfilling obligations under article 11 of the WIPO copyright treaty adopted on 20 December 1996, or similar laws prohibiting or restricting circumvention of such measures.</p>
+<p>A "covered work" means either the unmodified Program or a work based
+on the Program.</p>
 
-<p>When you convey a covered work, you waive any legal power to forbid circumvention of technological measures to the extent such circumvention is effected by exercising rights under this License with respect to the covered work, and you disclaim any intention to limit operation or modification of the work as a means of enforcing, against the work's users, your or third parties' legal rights to forbid circumvention of technological measures.
-4. Conveying Verbatim Copies.</p>
+<p>To "propagate" a work means to do anything with it that, without
+permission, would make you directly or secondarily liable for
+infringement under applicable copyright law, except executing it on a
+computer or modifying a private copy. Propagation includes copying,
+distribution (with or without modification), making available to the
+public, and in some countries other activities as well.</p>
+
+<p>To "convey" a work means any kind of propagation that enables other
+parties to make or receive copies. Mere interaction with a user
+through a computer network, with no transfer of a copy, is not
+conveying.</p>
+
+<p>An interactive user interface displays "Appropriate Legal Notices" to
+the extent that it includes a convenient and prominently visible
+feature that (1) displays an appropriate copyright notice, and (2)
+tells the user that there is no warranty for the work (except to the
+extent that warranties are provided), that licensees may convey the
+work under this License, and how to view a copy of this License. If
+the interface presents a list of user commands or options, such as a
+menu, a prominent item in the list meets this criterion.</p>
+
+<h4>1. Source Code.</h4>
+
+<p>The "source code" for a work means the preferred form of the work for
+making modifications to it. "Object code" means any non-source form of
+a work.</p>
+
+<p>A "Standard Interface" means an interface that either is an official
+standard defined by a recognized standards body, or, in the case of
+interfaces specified for a particular programming language, one that
+is widely used among developers working in that language.</p>
+
+<p>The "System Libraries" of an executable work include anything, other
+than the work as a whole, that (a) is included in the normal form of
+packaging a Major Component, but which is not part of that Major
+Component, and (b) serves only to enable use of the work with that
+Major Component, or to implement a Standard Interface for which an
+implementation is available to the public in source code form. A
+"Major Component", in this context, means a major essential component
+(kernel, window system, and so on) of the specific operating system
+(if any) on which the executable work runs, or a compiler used to
+produce the work, or an object code interpreter used to run it.</p>
+
+<p>The "Corresponding Source" for a work in object code form means all
+the source code needed to generate, install, and (for an executable
+work) run the object code and to modify the work, including scripts to
+control those activities. However, it does not include the work's
+System Libraries, or general-purpose tools or generally available free
+programs which are used unmodified in performing those activities but
+which are not part of the work. For example, Corresponding Source
+includes interface definition files associated with source files for
+the work, and the source code for shared libraries and dynamically
+linked subprograms that the work is specifically designed to require,
+such as by intimate data communication or control flow between those
+subprograms and other parts of the work.</p>
+
+<p>The Corresponding Source need not include anything that users can
+regenerate automatically from other parts of the Corresponding Source.</p>
+
+<p>The Corresponding Source for a work in source code form is that same
+work.</p>
+
+<h4>2. Basic Permissions.</h4>
+
+<p>All rights granted under this License are granted for the term of
+copyright on the Program, and are irrevocable provided the stated
+conditions are met. This License explicitly affirms your unlimited
+permission to run the unmodified Program. The output from running a
+covered work is covered by this License only if the output, given its
+content, constitutes a covered work. This License acknowledges your
+rights of fair use or other equivalent, as provided by copyright law.</p>
+
+<p>You may make, run and propagate covered works that you do not convey,
+without conditions so long as your license otherwise remains in force.
+You may convey covered works to others for the sole purpose of having
+them make modifications exclusively for you, or provide you with
+facilities for running those works, provided that you comply with the
+terms of this License in conveying all material for which you do not
+control copyright. Those thus making or running the covered works for
+you must do so exclusively on your behalf, under your direction and
+control, on terms that prohibit them from making any copies of your
+copyrighted material outside their relationship with you.</p>
+
+<p>Conveying under any other circumstances is permitted solely under the
+conditions stated below. Sublicensing is not allowed; section 10 makes
+it unnecessary.</p>
+
+<h4>3. Protecting Users' Legal Rights From Anti-Circumvention Law.</h4>
+
+<p>No covered work shall be deemed part of an effective technological
+measure under any applicable law fulfilling obligations under article
+11 of the WIPO copyright treaty adopted on 20 December 1996, or
+similar laws prohibiting or restricting circumvention of such
+measures.</p>
+
+<p>When you convey a covered work, you waive any legal power to forbid
+circumvention of technological measures to the extent such
+circumvention is effected by exercising rights under this License with
+respect to the covered work, and you disclaim any intention to limit
+operation or modification of the work as a means of enforcing, against
+the work's users, your or third parties' legal rights to forbid
+circumvention of technological measures.</p>
+
+<h4>4. Conveying Verbatim Copies.</h4>
+
+<p>You may convey verbatim copies of the Program's source code as you
+receive it, in any medium, provided that you conspicuously and
+appropriately publish on each copy an appropriate copyright notice;
+keep intact all notices stating that this License and any
+non-permissive terms added in accord with section 7 apply to the code;
+keep intact all notices of the absence of any warranty; and give all
+recipients a copy of this License along with the Program.</p>
+
+<p>You may charge any price or no price for each copy that you convey,
+and you may offer support or warranty protection for a fee.</p>
+
+<h4>5. Conveying Modified Source Versions.</h4>
+
+<p>You may convey a work based on the Program, or the modifications to
+produce it from the Program, in the form of source code under the
+terms of section 4, provided that you also meet all of these
+conditions:</p>
+
+<ul>
+<li>a) The work must carry prominent notices stating that you modified
+it, and giving a relevant date.</li>
+<li>b) The work must carry prominent notices stating that it is
+released under this License and any conditions added under
+section 7. This requirement modifies the requirement in section 4
+to "keep intact all notices".</li>
+<li>c) You must license the entire work, as a whole, under this
+License to anyone who comes into possession of a copy. This
+License will therefore apply, along with any applicable section 7
+additional terms, to the whole of the work, and all its parts,
+regardless of how they are packaged. This License gives no
+permission to license the work in any other way, but it does not
+invalidate such permission if you have separately received it.</li>
+<li>d) If the work has interactive user interfaces, each must display
+Appropriate Legal Notices; however, if the Program has interactive
+interfaces that do not display Appropriate Legal Notices, your
+work need not make them do so.</li>
+</ul>
+
+<p>A compilation of a covered work with other separate and independent
+works, which are not by their nature extensions of the covered work,
+and which are not combined with it such as to form a larger program,
+in or on a volume of a storage or distribution medium, is called an
+"aggregate" if the compilation and its resulting copyright are not
+used to limit the access or legal rights of the compilation's users
+beyond what the individual works permit. Inclusion of a covered work
+in an aggregate does not cause this License to apply to the other
+parts of the aggregate.</p>
+
+<h4>6. Conveying Non-Source Forms.</h4>
+
+<p>You may convey a covered work in object code form under the terms of
+sections 4 and 5, provided that you also convey the machine-readable
+Corresponding Source under the terms of this License, in one of these
+ways:</p>
+
+<ul>
+<li>a) Convey the object code in, or embodied in, a physical product
+(including a physical distribution medium), accompanied by the
+Corresponding Source fixed on a durable physical medium
+customarily used for software interchange.</li>
+<li>b) Convey the object code in, or embodied in, a physical product
+(including a physical distribution medium), accompanied by a
+written offer, valid for at least three years and valid for as
+long as you offer spare parts or customer support for that product
+model, to give anyone who possesses the object code either (1) a
+copy of the Corresponding Source for all the software in the
+product that is covered by this License, on a durable physical
+medium customarily used for software interchange, for a price no
+more than your reasonable cost of physically performing this
+conveying of source, or (2) access to copy the Corresponding
+Source from a network server at no charge.</li>
+<li>c) Convey individual copies of the object code with a copy of the
+written offer to provide the Corresponding Source. This
+alternative is allowed only occasionally and noncommercially, and
+only if you received the object code with such an offer, in accord
+with subsection 6b.</li>
+<li>d) Convey the object code by offering access from a designated
+place (gratis or for a charge), and offer equivalent access to the
+Corresponding Source in the same way through the same place at no
+further charge. You need not require recipients to copy the
+Corresponding Source along with the object code. If the place to
+copy the object code is a network server, the Corresponding Source
+may be on a different server (operated by you or a third party)
+that supports equivalent copying facilities, provided you maintain
+clear directions next to the object code saying where to find the
+Corresponding Source. Regardless of what server hosts the
+Corresponding Source, you remain obligated to ensure that it is
+available for as long as needed to satisfy these requirements.</li>
+<li>e) Convey the object code using peer-to-peer transmission,
+provided you inform other peers where the object code and
+Corresponding Source of the work are being offered to the general
+public at no charge under subsection 6d.</li>
+</ul>
+
+<p>A separable portion of the object code, whose source code is excluded
+from the Corresponding Source as a System Library, need not be
+included in conveying the object code work.</p>
+
+<p>A "User Product" is either (1) a "consumer product", which means any
+tangible personal property which is normally used for personal,
+family, or household purposes, or (2) anything designed or sold for
+incorporation into a dwelling. In determining whether a product is a
+consumer product, doubtful cases shall be resolved in favor of
+coverage. For a particular product received by a particular user,
+"normally used" refers to a typical or common use of that class of
+product, regardless of the status of the particular user or of the way
+in which the particular user actually uses, or expects or is expected
+to use, the product. A product is a consumer product regardless of
+whether the product has substantial commercial, industrial or
+non-consumer uses, unless such uses represent the only significant
+mode of use of the product.</p>
+
+<p>"Installation Information" for a User Product means any methods,
+procedures, authorization keys, or other information required to
+install and execute modified versions of a covered work in that User
+Product from a modified version of its Corresponding Source. The
+information must suffice to ensure that the continued functioning of
+the modified object code is in no case prevented or interfered with
+solely because modification has been made.</p>
+
+<p>If you convey an object code work under this section in, or with, or
+specifically for use in, a User Product, and the conveying occurs as
+part of a transaction in which the right of possession and use of the
+User Product is transferred to the recipient in perpetuity or for a
+fixed term (regardless of how the transaction is characterized), the
+Corresponding Source conveyed under this section must be accompanied
+by the Installation Information. But this requirement does not apply
+if neither you nor any third party retains the ability to install
+modified object code on the User Product (for example, the work has
+been installed in ROM).</p>
 
-<p>You may convey verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice; keep intact all notices stating that this License and any non-permissive terms added in accord with section 7 apply to the code; keep intact all notices of the absence of any warranty; and give all recipients a copy of this License along with the Program.</p>
+<p>The requirement to provide Installation Information does not include a
+requirement to continue to provide support service, warranty, or
+updates for a work that has been modified or installed by the
+recipient, or for the User Product in which it has been modified or
+installed. Access to a network may be denied when the modification
+itself materially and adversely affects the operation of the network
+or violates the rules and protocols for communication across the
+network.</p>
 
-<p>You may charge any price or no price for each copy that you convey, and you may offer support or warranty protection for a fee.
-5. Conveying Modified Source Versions.</p>
+<p>Corresponding Source conveyed, and Installation Information provided,
+in accord with this section must be in a format that is publicly
+documented (and with an implementation available to the public in
+source code form), and must require no special password or key for
+unpacking, reading or copying.</p>
 
-<p>You may convey a work based on the Program, or the modifications to produce it from the Program, in the form of source code under the terms of section 4, provided that you also meet all of these conditions:</p>
+<h4>7. Additional Terms.</h4>
 
-<pre><code>a) The work must carry prominent notices stating that you modified it, and giving a relevant date.
-b) The work must carry prominent notices stating that it is released under this License and any conditions added under section 7. This requirement modifies the requirement in section 4 to “keep intact all notices”.
-c) You must license the entire work, as a whole, under this License to anyone who comes into possession of a copy. This License will therefore apply, along with any applicable section 7 additional terms, to the whole of the work, and all its parts, regardless of how they are packaged. This License gives no permission to license the work in any other way, but it does not invalidate such permission if you have separately received it.
-d) If the work has interactive user interfaces, each must display Appropriate Legal Notices; however, if the Program has interactive interfaces that do not display Appropriate Legal Notices, your work need not make them do so.
-</code></pre>
+<p>"Additional permissions" are terms that supplement the terms of this
+License by making exceptions from one or more of its conditions.
+Additional permissions that are applicable to the entire Program shall
+be treated as though they were included in this License, to the extent
+that they are valid under applicable law. If additional permissions
+apply only to part of the Program, that part may be used separately
+under those permissions, but the entire Program remains governed by
+this License without regard to the additional permissions.</p>
 
-<p>A compilation of a covered work with other separate and independent works, which are not by their nature extensions of the covered work, and which are not combined with it such as to form a larger program, in or on a volume of a storage or distribution medium, is called an “aggregate” if the compilation and its resulting copyright are not used to limit the access or legal rights of the compilation's users beyond what the individual works permit. Inclusion of a covered work in an aggregate does not cause this License to apply to the other parts of the aggregate.
-6. Conveying Non-Source Forms.</p>
+<p>When you convey a copy of a covered work, you may at your option
+remove any additional permissions from that copy, or from any part of
+it. (Additional permissions may be written to require their own
+removal in certain cases when you modify the work.) You may place
+additional permissions on material, added by you to a covered work,
+for which you have or can give appropriate copyright permission.</p>
 
-<p>You may convey a covered work in object code form under the terms of sections 4 and 5, provided that you also convey the machine-readable Corresponding Source under the terms of this License, in one of these ways:</p>
+<p>Notwithstanding any other provision of this License, for material you
+add to a covered work, you may (if authorized by the copyright holders
+of that material) supplement the terms of this License with terms:</p>
 
-<pre><code>a) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by the Corresponding Source fixed on a durable physical medium customarily used for software interchange.
-b) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by a written offer, valid for at least three years and valid for as long as you offer spare parts or customer support for that product model, to give anyone who possesses the object code either (1) a copy of the Corresponding Source for all the software in the product that is covered by this License, on a durable physical medium customarily used for software interchange, for a price no more than your reasonable cost of physically performing this conveying of source, or (2) access to copy the Corresponding Source from a network server at no charge.
-c) Convey individual copies of the object code with a copy of the written offer to provide the Corresponding Source. This alternative is allowed only occasionally and noncommercially, and only if you received the object code with such an offer, in accord with subsection 6b.
-d) Convey the object code by offering access from a designated place (gratis or for a charge), and offer equivalent access to the Corresponding Source in the same way through the same place at no further charge. You need not require recipients to copy the Corresponding Source along with the object code. If the place to copy the object code is a network server, the Corresponding Source may be on a different server (operated by you or a third party) that supports equivalent copying facilities, provided you maintain clear directions next to the object code saying where to find the Corresponding Source. Regardless of what server hosts the Corresponding Source, you remain obligated to ensure that it is available for as long as needed to satisfy these requirements.
-e) Convey the object code using peer-to-peer transmission, provided you inform other peers where the object code and Corresponding Source of the work are being offered to the general public at no charge under subsection 6d.
-</code></pre>
+<ul>
+<li>a) Disclaiming warranty or limiting liability differently from the
+terms of sections 15 and 16 of this License; or</li>
+<li>b) Requiring preservation of specified reasonable legal notices or
+author attributions in that material or in the Appropriate Legal
+Notices displayed by works containing it; or</li>
+<li>c) Prohibiting misrepresentation of the origin of that material,
+or requiring that modified versions of such material be marked in
+reasonable ways as different from the original version; or</li>
+<li>d) Limiting the use for publicity purposes of names of licensors
+or authors of the material; or</li>
+<li>e) Declining to grant rights under trademark law for use of some
+trade names, trademarks, or service marks; or</li>
+<li>f) Requiring indemnification of licensors and authors of that
+material by anyone who conveys the material (or modified versions
+of it) with contractual assumptions of liability to the recipient,
+for any liability that these contractual assumptions directly
+impose on those licensors and authors.</li>
+</ul>
 
-<p>A separable portion of the object code, whose source code is excluded from the Corresponding Source as a System Library, need not be included in conveying the object code work.</p>
+<p>All other non-permissive additional terms are considered "further
+restrictions" within the meaning of section 10. If the Program as you
+received it, or any part of it, contains a notice stating that it is
+governed by this License along with a term that is a further
+restriction, you may remove that term. If a license document contains
+a further restriction but permits relicensing or conveying under this
+License, you may add to a covered work material governed by the terms
+of that license document, provided that the further restriction does
+not survive such relicensing or conveying.</p>
 
-<p>A “User Product” is either (1) a “consumer product”, which means any tangible personal property which is normally used for personal, family, or household purposes, or (2) anything designed or sold for incorporation into a dwelling. In determining whether a product is a consumer product, doubtful cases shall be resolved in favor of coverage. For a particular product received by a particular user, “normally used” refers to a typical or common use of that class of product, regardless of the status of the particular user or of the way in which the particular user actually uses, or expects or is expected to use, the product. A product is a consumer product regardless of whether the product has substantial commercial, industrial or non-consumer uses, unless such uses represent the only significant mode of use of the product.</p>
+<p>If you add terms to a covered work in accord with this section, you
+must place, in the relevant source files, a statement of the
+additional terms that apply to those files, or a notice indicating
+where to find the applicable terms.</p>
 
-<p>“Installation Information” for a User Product means any methods, procedures, authorization keys, or other information required to install and execute modified versions of a covered work in that User Product from a modified version of its Corresponding Source. The information must suffice to ensure that the continued functioning of the modified object code is in no case prevented or interfered with solely because modification has been made.</p>
+<p>Additional terms, permissive or non-permissive, may be stated in the
+form of a separately written license, or stated as exceptions; the
+above requirements apply either way.</p>
 
-<p>If you convey an object code work under this section in, or with, or specifically for use in, a User Product, and the conveying occurs as part of a transaction in which the right of possession and use of the User Product is transferred to the recipient in perpetuity or for a fixed term (regardless of how the transaction is characterized), the Corresponding Source conveyed under this section must be accompanied by the Installation Information. But this requirement does not apply if neither you nor any third party retains the ability to install modified object code on the User Product (for example, the work has been installed in ROM).</p>
+<h4>8. Termination.</h4>
 
-<p>The requirement to provide Installation Information does not include a requirement to continue to provide support service, warranty, or updates for a work that has been modified or installed by the recipient, or for the User Product in which it has been modified or installed. Access to a network may be denied when the modification itself materially and adversely affects the operation of the network or violates the rules and protocols for communication across the network.</p>
+<p>You may not propagate or modify a covered work except as expressly
+provided under this License. Any attempt otherwise to propagate or
+modify it is void, and will automatically terminate your rights under
+this License (including any patent licenses granted under the third
+paragraph of section 11).</p>
 
-<p>Corresponding Source conveyed, and Installation Information provided, in accord with this section must be in a format that is publicly documented (and with an implementation available to the public in source code form), and must require no special password or key for unpacking, reading or copying.
-7. Additional Terms.</p>
+<p>However, if you cease all violation of this License, then your license
+from a particular copyright holder is reinstated (a) provisionally,
+unless and until the copyright holder explicitly and finally
+terminates your license, and (b) permanently, if the copyright holder
+fails to notify you of the violation by some reasonable means prior to
+60 days after the cessation.</p>
 
-<p>“Additional permissions” are terms that supplement the terms of this License by making exceptions from one or more of its conditions. Additional permissions that are applicable to the entire Program shall be treated as though they were included in this License, to the extent that they are valid under applicable law. If additional permissions apply only to part of the Program, that part may be used separately under those permissions, but the entire Program remains governed by this License without regard to the additional permissions.</p>
+<p>Moreover, your license from a particular copyright holder is
+reinstated permanently if the copyright holder notifies you of the
+violation by some reasonable means, this is the first time you have
+received notice of violation of this License (for any work) from that
+copyright holder, and you cure the violation prior to 30 days after
+your receipt of the notice.</p>
 
-<p>When you convey a copy of a covered work, you may at your option remove any additional permissions from that copy, or from any part of it. (Additional permissions may be written to require their own removal in certain cases when you modify the work.) You may place additional permissions on material, added by you to a covered work, for which you have or can give appropriate copyright permission.</p>
+<p>Termination of your rights under this section does not terminate the
+licenses of parties who have received copies or rights from you under
+this License. If your rights have been terminated and not permanently
+reinstated, you do not qualify to receive new licenses for the same
+material under section 10.</p>
 
-<p>Notwithstanding any other provision of this License, for material you add to a covered work, you may (if authorized by the copyright holders of that material) supplement the terms of this License with terms:</p>
+<h4>9. Acceptance Not Required for Having Copies.</h4>
 
-<pre><code>a) Disclaiming warranty or limiting liability differently from the terms of sections 15 and 16 of this License; or
-b) Requiring preservation of specified reasonable legal notices or author attributions in that material or in the Appropriate Legal Notices displayed by works containing it; or
-c) Prohibiting misrepresentation of the origin of that material, or requiring that modified versions of such material be marked in reasonable ways as different from the original version; or
-d) Limiting the use for publicity purposes of names of licensors or authors of the material; or
-e) Declining to grant rights under trademark law for use of some trade names, trademarks, or service marks; or
-f) Requiring indemnification of licensors and authors of that material by anyone who conveys the material (or modified versions of it) with contractual assumptions of liability to the recipient, for any liability that these contractual assumptions directly impose on those licensors and authors.
-</code></pre>
+<p>You are not required to accept this License in order to receive or run
+a copy of the Program. Ancillary propagation of a covered work
+occurring solely as a consequence of using peer-to-peer transmission
+to receive a copy likewise does not require acceptance. However,
+nothing other than this License grants you permission to propagate or
+modify any covered work. These actions infringe copyright if you do
+not accept this License. Therefore, by modifying or propagating a
+covered work, you indicate your acceptance of this License to do so.</p>
 
-<p>All other non-permissive additional terms are considered “further restrictions” within the meaning of section 10. If the Program as you received it, or any part of it, contains a notice stating that it is governed by this License along with a term that is a further restriction, you may remove that term. If a license document contains a further restriction but permits relicensing or conveying under this License, you may add to a covered work material governed by the terms of that license document, provided that the further restriction does not survive such relicensing or conveying.</p>
+<h4>10. Automatic Licensing of Downstream Recipients.</h4>
 
-<p>If you add terms to a covered work in accord with this section, you must place, in the relevant source files, a statement of the additional terms that apply to those files, or a notice indicating where to find the applicable terms.</p>
+<p>Each time you convey a covered work, the recipient automatically
+receives a license from the original licensors, to run, modify and
+propagate that work, subject to this License. You are not responsible
+for enforcing compliance by third parties with this License.</p>
 
-<p>Additional terms, permissive or non-permissive, may be stated in the form of a separately written license, or stated as exceptions; the above requirements apply either way.
-8. Termination.</p>
+<p>An "entity transaction" is a transaction transferring control of an
+organization, or substantially all assets of one, or subdividing an
+organization, or merging organizations. If propagation of a covered
+work results from an entity transaction, each party to that
+transaction who receives a copy of the work also receives whatever
+licenses to the work the party's predecessor in interest had or could
+give under the previous paragraph, plus a right to possession of the
+Corresponding Source of the work from the predecessor in interest, if
+the predecessor has it or can get it with reasonable efforts.</p>
 
-<p>You may not propagate or modify a covered work except as expressly provided under this License. Any attempt otherwise to propagate or modify it is void, and will automatically terminate your rights under this License (including any patent licenses granted under the third paragraph of section 11).</p>
+<p>You may not impose any further restrictions on the exercise of the
+rights granted or affirmed under this License. For example, you may
+not impose a license fee, royalty, or other charge for exercise of
+rights granted under this License, and you may not initiate litigation
+(including a cross-claim or counterclaim in a lawsuit) alleging that
+any patent claim is infringed by making, using, selling, offering for
+sale, or importing the Program or any portion of it.</p>
 
-<p>However, if you cease all violation of this License, then your license from a particular copyright holder is reinstated (a) provisionally, unless and until the copyright holder explicitly and finally terminates your license, and (b) permanently, if the copyright holder fails to notify you of the violation by some reasonable means prior to 60 days after the cessation.</p>
+<h4>11. Patents.</h4>
 
-<p>Moreover, your license from a particular copyright holder is reinstated permanently if the copyright holder notifies you of the violation by some reasonable means, this is the first time you have received notice of violation of this License (for any work) from that copyright holder, and you cure the violation prior to 30 days after your receipt of the notice.</p>
+<p>A "contributor" is a copyright holder who authorizes use under this
+License of the Program or a work on which the Program is based. The
+work thus licensed is called the contributor's "contributor version".</p>
 
-<p>Termination of your rights under this section does not terminate the licenses of parties who have received copies or rights from you under this License. If your rights have been terminated and not permanently reinstated, you do not qualify to receive new licenses for the same material under section 10.
-9. Acceptance Not Required for Having Copies.</p>
+<p>A contributor's "essential patent claims" are all patent claims owned
+or controlled by the contributor, whether already acquired or
+hereafter acquired, that would be infringed by some manner, permitted
+by this License, of making, using, or selling its contributor version,
+but do not include claims that would be infringed only as a
+consequence of further modification of the contributor version. For
+purposes of this definition, "control" includes the right to grant
+patent sublicenses in a manner consistent with the requirements of
+this License.</p>
 
-<p>You are not required to accept this License in order to receive or run a copy of the Program. Ancillary propagation of a covered work occurring solely as a consequence of using peer-to-peer transmission to receive a copy likewise does not require acceptance. However, nothing other than this License grants you permission to propagate or modify any covered work. These actions infringe copyright if you do not accept this License. Therefore, by modifying or propagating a covered work, you indicate your acceptance of this License to do so.
-10. Automatic Licensing of Downstream Recipients.</p>
+<p>Each contributor grants you a non-exclusive, worldwide, royalty-free
+patent license under the contributor's essential patent claims, to
+make, use, sell, offer for sale, import and otherwise run, modify and
+propagate the contents of its contributor version.</p>
 
-<p>Each time you convey a covered work, the recipient automatically receives a license from the original licensors, to run, modify and propagate that work, subject to this License. You are not responsible for enforcing compliance by third parties with this License.</p>
+<p>In the following three paragraphs, a "patent license" is any express
+agreement or commitment, however denominated, not to enforce a patent
+(such as an express permission to practice a patent or covenant not to
+sue for patent infringement). To "grant" such a patent license to a
+party means to make such an agreement or commitment not to enforce a
+patent against the party.</p>
 
-<p>An “entity transaction” is a transaction transferring control of an organization, or substantially all assets of one, or subdividing an organization, or merging organizations. If propagation of a covered work results from an entity transaction, each party to that transaction who receives a copy of the work also receives whatever licenses to the work the party's predecessor in interest had or could give under the previous paragraph, plus a right to possession of the Corresponding Source of the work from the predecessor in interest, if the predecessor has it or can get it with reasonable efforts.</p>
+<p>If you convey a covered work, knowingly relying on a patent license,
+and the Corresponding Source of the work is not available for anyone
+to copy, free of charge and under the terms of this License, through a
+publicly available network server or other readily accessible means,
+then you must either (1) cause the Corresponding Source to be so
+available, or (2) arrange to deprive yourself of the benefit of the
+patent license for this particular work, or (3) arrange, in a manner
+consistent with the requirements of this License, to extend the patent
+license to downstream recipients. "Knowingly relying" means you have
+actual knowledge that, but for the patent license, your conveying the
+covered work in a country, or your recipient's use of the covered work
+in a country, would infringe one or more identifiable patents in that
+country that you have reason to believe are valid.</p>
 
-<p>You may not impose any further restrictions on the exercise of the rights granted or affirmed under this License. For example, you may not impose a license fee, royalty, or other charge for exercise of rights granted under this License, and you may not initiate litigation (including a cross-claim or counterclaim in a lawsuit) alleging that any patent claim is infringed by making, using, selling, offering for sale, or importing the Program or any portion of it.
-11. Patents.</p>
+<p>If, pursuant to or in connection with a single transaction or
+arrangement, you convey, or propagate by procuring conveyance of, a
+covered work, and grant a patent license to some of the parties
+receiving the covered work authorizing them to use, propagate, modify
+or convey a specific copy of the covered work, then the patent license
+you grant is automatically extended to all recipients of the covered
+work and works based on it.</p>
 
-<p>A “contributor” is a copyright holder who authorizes use under this License of the Program or a work on which the Program is based. The work thus licensed is called the contributor's “contributor version”.</p>
+<p>A patent license is "discriminatory" if it does not include within the
+scope of its coverage, prohibits the exercise of, or is conditioned on
+the non-exercise of one or more of the rights that are specifically
+granted under this License. You may not convey a covered work if you
+are a party to an arrangement with a third party that is in the
+business of distributing software, under which you make payment to the
+third party based on the extent of your activity of conveying the
+work, and under which the third party grants, to any of the parties
+who would receive the covered work from you, a discriminatory patent
+license (a) in connection with copies of the covered work conveyed by
+you (or copies made from those copies), or (b) primarily for and in
+connection with specific products or compilations that contain the
+covered work, unless you entered into that arrangement, or that patent
+license was granted, prior to 28 March 2007.</p>
 
-<p>A contributor's “essential patent claims” are all patent claims owned or controlled by the contributor, whether already acquired or hereafter acquired, that would be infringed by some manner, permitted by this License, of making, using, or selling its contributor version, but do not include claims that would be infringed only as a consequence of further modification of the contributor version. For purposes of this definition, “control” includes the right to grant patent sublicenses in a manner consistent with the requirements of this License.</p>
+<p>Nothing in this License shall be construed as excluding or limiting
+any implied license or other defenses to infringement that may
+otherwise be available to you under applicable patent law.</p>
 
-<p>Each contributor grants you a non-exclusive, worldwide, royalty-free patent license under the contributor's essential patent claims, to make, use, sell, offer for sale, import and otherwise run, modify and propagate the contents of its contributor version.</p>
+<h4>12. No Surrender of Others' Freedom.</h4>
 
-<p>In the following three paragraphs, a “patent license” is any express agreement or commitment, however denominated, not to enforce a patent (such as an express permission to practice a patent or covenant not to sue for patent infringement). To “grant” such a patent license to a party means to make such an agreement or commitment not to enforce a patent against the party.</p>
+<p>If conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot convey a
+covered work so as to satisfy simultaneously your obligations under
+this License and any other pertinent obligations, then as a
+consequence you may not convey it at all. For example, if you agree to
+terms that obligate you to collect a royalty for further conveying
+from those to whom you convey the Program, the only way you could
+satisfy both those terms and this License would be to refrain entirely
+from conveying the Program.</p>
 
-<p>If you convey a covered work, knowingly relying on a patent license, and the Corresponding Source of the work is not available for anyone to copy, free of charge and under the terms of this License, through a publicly available network server or other readily accessible means, then you must either (1) cause the Corresponding Source to be so available, or (2) arrange to deprive yourself of the benefit of the patent license for this particular work, or (3) arrange, in a manner consistent with the requirements of this License, to extend the patent license to downstream recipients. “Knowingly relying” means you have actual knowledge that, but for the patent license, your conveying the covered work in a country, or your recipient's use of the covered work in a country, would infringe one or more identifiable patents in that country that you have reason to believe are valid.</p>
+<h4>13. Use with the GNU Affero General Public License.</h4>
 
-<p>If, pursuant to or in connection with a single transaction or arrangement, you convey, or propagate by procuring conveyance of, a covered work, and grant a patent license to some of the parties receiving the covered work authorizing them to use, propagate, modify or convey a specific copy of the covered work, then the patent license you grant is automatically extended to all recipients of the covered work and works based on it.</p>
+<p>Notwithstanding any other provision of this License, you have
+permission to link or combine any covered work with a work licensed
+under version 3 of the GNU Affero General Public License into a single
+combined work, and to convey the resulting work. The terms of this
+License will continue to apply to the part which is the covered work,
+but the special requirements of the GNU Affero General Public License,
+section 13, concerning interaction through a network will apply to the
+combination as such.</p>
 
-<p>A patent license is “discriminatory” if it does not include within the scope of its coverage, prohibits the exercise of, or is conditioned on the non-exercise of one or more of the rights that are specifically granted under this License. You may not convey a covered work if you are a party to an arrangement with a third party that is in the business of distributing software, under which you make payment to the third party based on the extent of your activity of conveying the work, and under which the third party grants, to any of the parties who would receive the covered work from you, a discriminatory patent license (a) in connection with copies of the covered work conveyed by you (or copies made from those copies), or (b) primarily for and in connection with specific products or compilations that contain the covered work, unless you entered into that arrangement, or that patent license was granted, prior to 28 March 2007.</p>
+<h4>14. Revised Versions of this License.</h4>
 
-<p>Nothing in this License shall be construed as excluding or limiting any implied license or other defenses to infringement that may otherwise be available to you under applicable patent law.
-12. No Surrender of Others' Freedom.</p>
+<p>The Free Software Foundation may publish revised and/or new versions
+of the GNU General Public License from time to time. Such new versions
+will be similar in spirit to the present version, but may differ in
+detail to address new problems or concerns.</p>
 
-<p>If conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot convey a covered work so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not convey it at all. For example, if you agree to terms that obligate you to collect a royalty for further conveying from those to whom you convey the Program, the only way you could satisfy both those terms and this License would be to refrain entirely from conveying the Program.
-13. Use with the GNU Affero General Public License.</p>
+<p>Each version is given a distinguishing version number. If the Program
+specifies that a certain numbered version of the GNU General Public
+License "or any later version" applies to it, you have the option of
+following the terms and conditions either of that numbered version or
+of any later version published by the Free Software Foundation. If the
+Program does not specify a version number of the GNU General Public
+License, you may choose any version ever published by the Free
+Software Foundation.</p>
 
-<p>Notwithstanding any other provision of this License, you have permission to link or combine any covered work with a work licensed under version 3 of the GNU Affero General Public License into a single combined work, and to convey the resulting work. The terms of this License will continue to apply to the part which is the covered work, but the special requirements of the GNU Affero General Public License, section 13, concerning interaction through a network will apply to the combination as such.
-14. Revised Versions of this License.</p>
+<p>If the Program specifies that a proxy can decide which future versions
+of the GNU General Public License can be used, that proxy's public
+statement of acceptance of a version permanently authorizes you to
+choose that version for the Program.</p>
 
-<p>The Free Software Foundation may publish revised and/or new versions of the GNU General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns.</p>
+<p>Later license versions may give you additional or different
+permissions. However, no additional obligations are imposed on any
+author or copyright holder as a result of your choosing to follow a
+later version.</p>
 
-<p>Each version is given a distinguishing version number. If the Program specifies that a certain numbered version of the GNU General Public License “or any later version” applies to it, you have the option of following the terms and conditions either of that numbered version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the GNU General Public License, you may choose any version ever published by the Free Software Foundation.</p>
+<h4>15. Disclaimer of Warranty.</h4>
 
-<p>If the Program specifies that a proxy can decide which future versions of the GNU General Public License can be used, that proxy's public statement of acceptance of a version permanently authorizes you to choose that version for the Program.</p>
+<p>THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
+APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
+HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT
+WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT
+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND
+PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE
+DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR
+CORRECTION.</p>
 
-<p>Later license versions may give you additional or different permissions. However, no additional obligations are imposed on any author or copyright holder as a result of your choosing to follow a later version.
-15. Disclaimer of Warranty.</p>
+<h4>16. Limitation of Liability.</h4>
 
-<p>THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM “AS IS” WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
-16. Limitation of Liability.</p>
+<p>IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR
+CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
+INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES
+ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT
+NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR
+LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM
+TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER
+PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.</p>
 
-<p>IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
-17. Interpretation of Sections 15 and 16.</p>
+<h4>17. Interpretation of Sections 15 and 16.</h4>
 
-<p>If the disclaimer of warranty and limitation of liability provided above cannot be given local legal effect according to their terms, reviewing courts shall apply local law that most closely approximates an absolute waiver of all civil liability in connection with the Program, unless a warranty or assumption of liability accompanies a copy of the Program in return for a fee.</p>
+<p>If the disclaimer of warranty and limitation of liability provided
+above cannot be given local legal effect according to their terms,
+reviewing courts shall apply local law that most closely approximates
+an absolute waiver of all civil liability in connection with the
+Program, unless a warranty or assumption of liability accompanies a
+copy of the Program in return for a fee.</p>
 
 <p>END OF TERMS AND CONDITIONS</p>
 
+<h3>How to Apply These Terms to Your New Programs</h3>
+
+<p>If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these
+terms.</p>
+
+<p>To do so, attach the following notices to the program. It is safest to
+attach them to the start of each source file to most effectively state
+the exclusion of warranty; and each file should have at least the
+"copyright" line and a pointer to where the full notice is found.</p>
+
+<pre><code>    &lt;one line="" to="" give="" the="" program's="" name="" and="" a="" brief="" idea="" of="" what="" it="" does.=""&gt;
+    Copyright (C) &lt;year&gt;  &lt;name of="" author=""&gt;
+
+    This program is free software: you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation, either version 3 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program.  If not, see &lt;<a href="http://www.gnu.org/licenses/" rel="nofollow">http://www.gnu.org/licenses/</a>&gt;.
+</code></pre>
+
+<p>Also add information on how to contact you by electronic and paper
+mail.</p>
+
+<p>If the program does terminal interaction, make it output a short
+notice like this when it starts in an interactive mode:</p>
+
+<pre><code>    &lt;program&gt;  Copyright (C) &lt;year&gt;  &lt;name of author&gt;
+    This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+    This is free software, and you are welcome to redistribute it
+    under certain conditions; type `show c' for details.
+</code></pre>
+
+<p>The hypothetical commands `show w' and `show c' should show the
+appropriate parts of the General Public License. Of course, your
+program's commands might be different; for a GUI interface, you would
+use an "about box".</p>
+
+<p>You should also get your employer (if you work as a programmer) or
+school, if any, to sign a "copyright disclaimer" for the program, if
+necessary. For more information on this, and how to apply and follow
+the GNU GPL, see <a href="http://www.gnu.org/licenses/" rel="nofollow">http://www.gnu.org/licenses/</a>.</p>
+
+<p>The GNU General Public License does not permit incorporating your
+program into proprietary programs. If your program is a subroutine
+library, you may consider it more useful to permit linking proprietary
+applications with the library. If this is what you want to do, use the
+GNU Lesser General Public License instead of this License. But first,
+please read <a href="http://www.gnu.org/philosophy/why-not-lgpl.html" rel="nofollow">http://www.gnu.org/philosophy/why-not-lgpl.html</a>.</p>
+
 
 <!-- autodoc -->
\ No newline at end of file
diff --git a/erpnext/docs/user/manual/de/CRM/customer.md b/erpnext/docs/user/manual/de/CRM/customer.md
index 3ec4281..c730c68 100644
--- a/erpnext/docs/user/manual/de/CRM/customer.md
+++ b/erpnext/docs/user/manual/de/CRM/customer.md
@@ -7,9 +7,9 @@
 
 > CRM > Dokumente > Kunde > Neu
 
-oder einen Upload über ein Datenimportwerkzeug durchführen.
+<img class="screenshot" alt="Kunde" src="{{docs_base_url}}/assets/img/crm/create-customer.gif">
 
-<img class="screenshot" alt="Kunde" src="{{docs_base_url}}/assets/img/crm/customer.png">
+oder einen Upload über ein Datenimportwerkzeug durchführen.
 
 > Anmerkung: Kunden werden von Kontakten und Adressen getrennt verwaltet. Ein Kunde kann mehrere verschiedene Kontakte und Adressen haben.
 
diff --git a/erpnext/docs/user/manual/de/customize-erpnext/custom-field.md b/erpnext/docs/user/manual/de/customize-erpnext/custom-field.md
index c3bec3f..25c40e1 100644
--- a/erpnext/docs/user/manual/de/customize-erpnext/custom-field.md
+++ b/erpnext/docs/user/manual/de/customize-erpnext/custom-field.md
@@ -12,7 +12,7 @@
 
 > Einstellungen > Anpassen > Benutzerdefiniertes Feld > Neu
 
-Sie können ein neues benutzerdefiniertes Feld auch über das [Werkzeug zum Anpassen von Feldern](https://erpnext.com/customize-erpnext/customize-form) einfügen.
+Sie können ein neues benutzerdefiniertes Feld auch über das [Werkzeug zum Anpassen von Feldern]({{docs_base_url}}/user/manual/de/customize-erpnext/customize-form) einfügen.
 
 In einem benutzerdefinierten Formular finden Sie für jedes Feld die Plus(+)-Option. Wenn Sie auf dieses Symbol klicken, wird eine neue Zeile oberhalb dieses Feldes eingefügt. Sie können die Einstellungen für Ihr Feld in der neu eingefügten leeren Zeile eingeben.
 
@@ -50,7 +50,7 @@
 
 ### Optionen einstellen
 
-Wenn Sie ein Verknüpfungsfeld erstellen,dann wird der Name des DocType, mit dem dieses Feld verknüpft werden soll, in das Feld "Optionen" eingefügt. Klicken Sie [hier](https://erpnext.com/kb/customize/creating-custom-link-field) um weitere Informationen darüber zu erhalten, wie man benutzerdefinierte Verknüpfungsfelder erstellt.
+Wenn Sie ein Verknüpfungsfeld erstellen,dann wird der Name des DocType, mit dem dieses Feld verknüpft werden soll, in das Feld "Optionen" eingefügt. Klicken Sie [hier]({{docs_base_url}}/user/manual/en/customize-erpnext/articles/creating-custom-link-field) um weitere Informationen darüber zu erhalten, wie man benutzerdefinierte Verknüpfungsfelder erstellt.
 
 ![Verknüpfung mit einem benutzerdefinierten Feld]({{docs_base_url}}/assets/old_images/erpnext/custom-field-link.png)
 
diff --git a/erpnext/docs/user/manual/de/customize-erpnext/customize-form.md b/erpnext/docs/user/manual/de/customize-erpnext/customize-form.md
index cd83533..dbb9bc5 100644
--- a/erpnext/docs/user/manual/de/customize-erpnext/customize-form.md
+++ b/erpnext/docs/user/manual/de/customize-erpnext/customize-form.md
@@ -71,7 +71,7 @@
     </tr>
     <tr>
       <td>Feldtyp</td>
-      <td>Klicken Sie <a href="https://erpnext.com/kb/customize/field-types">hier</a> um mehr über Feldtypen zu erfahren.</td>
+      <td>Klicken Sie <a href="{{docs_base_url}}/user/manual/en/customize-erpnext/articles/field-types">hier</a> um mehr über Feldtypen zu erfahren.</td>
     </tr>
     <tr>
       <td>Optionen</td>
diff --git a/erpnext/docs/user/manual/en/CRM/customer.md b/erpnext/docs/user/manual/en/CRM/customer.md
index 88f9e66..55755e6 100644
--- a/erpnext/docs/user/manual/en/CRM/customer.md
+++ b/erpnext/docs/user/manual/en/CRM/customer.md
@@ -9,9 +9,13 @@
 
 > Selling > Customer
 
+<img class="screenshot" alt="Create Customer" src="{{docs_base_url}}/assets/img/crm/create-customer.gif">
+
 or upload it via the Data Import Tool.
 
-<img class="screenshot" alt="Customer" src="{{docs_base_url}}/assets/img/crm/customer.png">
+A Customer can avail the features (operations) in the selling process. The general flow can be summarazed as:
+
+<img class="screenshot" alt="Customer" src="{{docs_base_url}}/assets/img/crm/customer-to selling-flowchart.jpeg">
 
 > Note: Customers are separate from Contacts and Addresses. A Customer can
 have multiple Contacts and Addresses.
@@ -53,7 +57,7 @@
 master. Classifying Customers
 
 ERPNext allows you to group your Customers using [Customer Group]({{docs_base_url}}/user/manual/en/CRM/setup/customer-group.html) 
-and also divide them into [Territories]({{docs_base_url}}/user/manual/en/CRM/setup/territory.html)
+and also divide them into [Territories]({{docs_base_url}}/user/manual/en/setting-up/territory.html)
 Grouping will help you get better analysis of your data and
 identify which Customers are profitable and which are not. Territories will
 help you set sales targets for the respective territories.
diff --git a/erpnext/docs/user/manual/en/CRM/opportunity.md b/erpnext/docs/user/manual/en/CRM/opportunity.md
index 9f44fdf..9248fb2 100644
--- a/erpnext/docs/user/manual/en/CRM/opportunity.md
+++ b/erpnext/docs/user/manual/en/CRM/opportunity.md
@@ -1,5 +1,5 @@
 When you know a Lead is looking for some products or services to buy, you can
-track that as an Opportunity.
+track that as an Opportunity. Also opportunity document helps user to collect the requirement of a customer/lead.
 
 You can create an Opportunity from:
 
@@ -17,11 +17,21 @@
 
 <img class="screenshot" alt="Opportunity" src="{{docs_base_url}}/assets/img/crm/lead-to-opportunity.png">
 
+#### Figure 3: Create Opportunity for Customer to Collect their Requirement
+
+<img class="screenshot" alt="Opportunity" src="{{docs_base_url}}/assets/img/crm/requirement-gathering.png">
+
+
 An Opportunity can also come from an existing Customer. You can create
 multiple Opportunities against the same Lead. In Opportunity, apart from the
 Communication, you can also add the Items for which the Lead or Contact is
 looking for.
 
+#### Make Supplier Quotation
+In some business, user collect the rates from their supplier against the customer requirement and based on the supplier rates they prepare the quotation for the customer. In ERPNext user get an option to make supplier quotation from the opportunity.
+
+<img class="screenshot" alt="Opportunity" src="{{docs_base_url}}/assets/img/crm/make-sq-from-opportunity.png">
+
 > Best Practice: Leads and Opportunities are often referred as your “Sales
 Pipeline” this is what you need to track if you want to be able to predict how
 much business you are going to get in the future. Its always a good idea to be
diff --git a/erpnext/docs/user/manual/en/CRM/setup/sales-person.md b/erpnext/docs/user/manual/en/CRM/setup/sales-person.md
index 114003b..ce5ed93 100644
--- a/erpnext/docs/user/manual/en/CRM/setup/sales-person.md
+++ b/erpnext/docs/user/manual/en/CRM/setup/sales-person.md
@@ -8,7 +8,7 @@
 ####Sales Person in Transactions
 
 You can use this Sales Person in Customer and sales transactions like Sales Order, Delivery Note and Sales Invoice.
-Click [here](https://erpnext.com/kb/selling/managing-sales-persons-in-sales-transactions) to learn more 
+Click [here]({{docs_base_url}}/user/manual/en/selling/articles/sales-persons-in-the-sales-transactions) to learn more 
 about how Sales Persons are used in the transactions of Sales Cycle.
 
-{next}
\ No newline at end of file
+{next}
diff --git a/erpnext/docs/user/manual/en/accounts/payments.md b/erpnext/docs/user/manual/en/accounts/payments.md
index 7e5aab3..881d366 100644
--- a/erpnext/docs/user/manual/en/accounts/payments.md
+++ b/erpnext/docs/user/manual/en/accounts/payments.md
@@ -22,7 +22,7 @@
 
 <img class="screenshot" alt="Making Payment" src="{{docs_base_url}}/assets/img/accounts/payment-entry-9.png">
 
-For more details about payment entry [check here.](https://frappe.github.io/erpnext/user/manual/en/accounts/payment-entry)
+For more details about payment entry [check here.]({{docs_base_url}}/user/manual/en/accounts/payment-entry)
 
 ## Journal Entry
 
@@ -45,4 +45,4 @@
 Save and submit the journal entry to record the payament against the invoice
 <img class="screenshot" alt="Making Payment" src="{{docs_base_url}}/assets/img/accounts/journal-entry.png">
 
-For more details about journal entry [check here.](https://frappe.github.io/erpnext/user/manual/en/accounts/journal-entry)
\ No newline at end of file
+For more details about journal entry [check here.]({{docs_base_url}}/user/manual/en/accounts/journal-entry)
diff --git a/erpnext/docs/user/manual/en/buying/purchase-order.md b/erpnext/docs/user/manual/en/buying/purchase-order.md
index e7f2429..89bb6d9 100644
--- a/erpnext/docs/user/manual/en/buying/purchase-order.md
+++ b/erpnext/docs/user/manual/en/buying/purchase-order.md
@@ -7,7 +7,7 @@
 
 #### Purchase Order Flow Chart
 
-![Purchase Order]({{docs_base_url}}/assets/old_images/erpnext/purchase-order-f.jpg)
+![Purchase Order]({{docs_base_url}}/assets/img/buying/buying_flow.png)
 
 In ERPNext, you can also make a Purchase Order directly by going to:
 
@@ -39,6 +39,12 @@
 government is only the difference between what you collect from your Customer
 and what you pay to your Supplier. This is called Value Added Tax (VAT).
 
+#### Add Taxes in Purchase Order
+<img class="screenshot" alt="Purchase Order" src="{{docs_base_url}}/assets/img/buying/add_taxes_to_doc.png">
+
+#### Show Tax break-up
+<img class="screenshot" alt="Purchase Order" src="{{docs_base_url}}/assets/img/buying/show_tax_breakup.png">
+
 For example you buy Items worth X and sell them for 1.3X. So your Customer
 pays 1.3 times the tax you pay your Supplier. Since you have already paid tax
 to your Supplier for X, what you owe your government is only the tax on 0.3X.
@@ -49,7 +55,7 @@
 effect. Please contact your accountant if you need more help or post a query
 on our forums!
 
-  
+
 
 #### Purchase UOM and Stock UOM Conversion
 
@@ -82,5 +88,5 @@
 
 __Step 6:__ Save and Submit the Form.
 
-  
+
 {next}
diff --git a/erpnext/docs/user/manual/en/buying/supplier-quotation.md b/erpnext/docs/user/manual/en/buying/supplier-quotation.md
index 0f1d51a..868a297 100644
--- a/erpnext/docs/user/manual/en/buying/supplier-quotation.md
+++ b/erpnext/docs/user/manual/en/buying/supplier-quotation.md
@@ -8,7 +8,7 @@
 
 #### Supplier Quotation Flow-Chart
 
-![Supplier Quotation]({{docs_base_url}}/assets/old_images/erpnext/supplier-quotation-f.jpg)
+![Supplier Quotation]({{docs_base_url}}/assets/img/buying/buying_flow.png)
 
 You can also make a Supplier Quotation directly from:
 
@@ -23,11 +23,22 @@
 many cases, especially if you have centralized buying, you may want to record
 all the quotes so that
 
-  * You can easily compare prices in the future 
+  * You can easily compare prices in the future
   * Audit whether all Suppliers were given the opportunity to quote.
 
 Supplier Quotations are not necessary for most small businesses. Always
 evaluate the cost of collecting information to the value it really provides!
 You could only do this for high value items.
 
+#### Taxes
+If your Supplier is going to charge you additional taxes or charge like a shipping or insurance charge, you can add it here. It will help you to accurately track your costs. Also, if some of these charges add to the value of the product you will have to mention them in the Taxes table. You can also use templates for your taxes. For more information on setting up your taxes see the Purchase Taxes and Charges Template.
+
+You can select relevant tax by going to "Taxes and Charges" section and adding an entry to the table as shown below,
+
+<img class="screenshot" alt="Supplier Quotation" src="{{docs_base_url}}/assets/img/buying/add_taxes_to_doc.png">
+
+Besides, in case of multiple items you can keep track of taxes on each by clicking "Show tax break-up"
+
+<img class="screenshot" alt="Supplier Quotation" src="{{docs_base_url}}/assets/img/buying/show_tax_breakup.png">
+
 {next}
diff --git a/erpnext/docs/user/manual/en/customize-erpnext/hiding-modules-and-features.md b/erpnext/docs/user/manual/en/customize-erpnext/hiding-modules-and-features.md
index 85123f9..ce8a1c3 100644
--- a/erpnext/docs/user/manual/en/customize-erpnext/hiding-modules-and-features.md
+++ b/erpnext/docs/user/manual/en/customize-erpnext/hiding-modules-and-features.md
@@ -1,15 +1,4 @@
-As you have seen from this manual that ERPNext contains tons of features which you may not use. We have observed that most users start with using 20% of the features, though a different 20%. To hide fields belonging to features you
-dont require, go to:
-
-`Setup > Customize > Features Setup`
-
-<img alt="Hide Features" class="screenshot" src="{{docs_base_url}}/assets/img/customize/feature-setup.png">
-
-Check the features you want to use. The features which are not checked, relevant fields will get hidden from the forms.
-
-* * *
-
-### Hiding Module Icons
+# Hiding Module Icons
 
 To hide modules (icons) from the home page, go to:
 
diff --git a/erpnext/docs/user/manual/en/human-resources/articles/employees-loan-management.md b/erpnext/docs/user/manual/en/human-resources/articles/employees-loan-management.md
index fddab31..d5c4d00 100644
--- a/erpnext/docs/user/manual/en/human-resources/articles/employees-loan-management.md
+++ b/erpnext/docs/user/manual/en/human-resources/articles/employees-loan-management.md
@@ -10,7 +10,7 @@
       
 #### 1.1  Employee Loan Account
 
-Create Group as 'Employees Loans' under Current Assets and create employee loan A/C (Ledger) under it. [Check this link for new account creation](https://erpnext.com/kb/setup/managing-tree-structure-masters)
+Create Group as 'Employees Loans' under Current Assets and create employee loan A/C (Ledger) under it. [Check this link for new account creation]({{docs_base_url}}/user/manual/en/setting-up/articles/managing-tree-structure-masters)
 
 ![CoA]({{docs_base_url}}/assets/img/articles/Selection_433.png)
 
@@ -52,4 +52,4 @@
 
 ![Loan Reco]({{docs_base_url}}/assets/img/articles/Selection_439.png)
 
-<!-- markdown -->
\ No newline at end of file
+<!-- markdown -->
diff --git a/erpnext/docs/user/manual/en/human-resources/daily-work-summary.md b/erpnext/docs/user/manual/en/human-resources/daily-work-summary.md
new file mode 100644
index 0000000..d3ba22a
--- /dev/null
+++ b/erpnext/docs/user/manual/en/human-resources/daily-work-summary.md
@@ -0,0 +1,15 @@
+# Daily Work Summary
+
+Daily Work Summary is way to get a automated way to get a summary of work done by all employees in a company. Once you set it up, each active Employee of the Company gets an email asking them what did they work on during the day.
+
+Replies of all employees who choose to respond is collected and sent as a summary at midnight. Emails are only sent based on the Holiday List setup in the Company or Employee master.
+
+*Note:* You must have one active incoming email account setup for this to work.
+
+### How to Use
+
+Go to "Daily Work Summary Settings" via HR module or search bar and set the company for which you want to activate this feature.
+
+You can also choose to Customize the Message you send to your employees:
+
+<img class="screenshot" alt="Department" src="{{docs_base_url}}/assets/img/human-resources/department.png">
diff --git a/erpnext/docs/user/manual/en/human-resources/index.txt b/erpnext/docs/user/manual/en/human-resources/index.txt
index 33ee4bb..2543b4b 100644
--- a/erpnext/docs/user/manual/en/human-resources/index.txt
+++ b/erpnext/docs/user/manual/en/human-resources/index.txt
@@ -12,4 +12,5 @@
 setup
 holiday-list
 human-resource-setup
+daily-work-summary
 articles
diff --git a/erpnext/docs/user/manual/en/manufacturing/bill-of-materials.md b/erpnext/docs/user/manual/en/manufacturing/bill-of-materials.md
index 34d8530..91bf7ed 100644
--- a/erpnext/docs/user/manual/en/manufacturing/bill-of-materials.md
+++ b/erpnext/docs/user/manual/en/manufacturing/bill-of-materials.md
@@ -31,6 +31,11 @@
 
 <img class="screenshot" alt="Update Cost" src="{{docs_base_url}}/assets/img/manufacturing/bom-update-cost.png">
 
+* User can select the currency in the BOM 
+* System calculates the costing based on the price list currency
+
+<img class="screenshot" alt="Update Cost" src="{{docs_base_url}}/assets/img/manufacturing/price-list-based-currency-bom.png">
+
 ### Materials Required(exploded) 
 
 This table lists down all the Material required for the Item to be Manufactured.
diff --git a/erpnext/docs/user/manual/en/manufacturing/production-order.md b/erpnext/docs/user/manual/en/manufacturing/production-order.md
index 1720db9..2f0fef3 100644
--- a/erpnext/docs/user/manual/en/manufacturing/production-order.md
+++ b/erpnext/docs/user/manual/en/manufacturing/production-order.md
@@ -1,3 +1,4 @@
+<img class="screenshot" alt="Production Order" src="{{docs_base_url}}/assets/img/manufacturing/manufacturing-flow.png">
 Production Order (also called as Work Order) is a document that is given to
 the manufacturing shop floor by the Production Planner as a signal to produce
 a certain quantity of a certain Item. Production Order also helps to generate
@@ -45,7 +46,7 @@
 * Once you have submitted your Production Order, you need to Transfer the Raw Materials to initiate the Manufacturing Process.
 * This will create a Stock Entry with all the Items required to complete this Production Order to be added to the WIP Warehouse. (this will add sub-Items with BOM as one Item or explode their children based on your setting above).
 
-* Click on 'Transfer Materials for Manufacturing'.
+* Click on 'Start'.
 
 <img class="screenshot" alt="Transfer Materials" src="{{docs_base_url}}/assets/img/manufacturing/PO-material-transfer.png">
 
@@ -63,18 +64,18 @@
 
 ### Making Time Logs
 
-* Progress in the Production Order can be tracked using [Time Log]({{docs_base_url}}/user/manual/en/projects/time-log.html)
-* Time Logs are created against Production Order Operations.
-* Drafts of Time Logs are also created based on the scheduled operations when an Production Order is Submitted.
-* To create more Time Logs against an operation select 'Make TIme Log' in the respective operation.
+* Progress in the Production Order can be tracked using [Timesheet]({{docs_base_url}}/user/manual/en/projects/timesheet/timesheet-against-production-order.html)
+* Timesheet's time slots are created against Production Order Operations.
+* Drafts of Timesheet is created based on the scheduled operations when an Production Order is Submitted.
+* To create more Timesheet against an operation click 'Make Timesheet' button.
 
-<img class="screenshot" alt="Make TL against PO" src="{{docs_base_url}}/assets/img/manufacturing/PO-operations-make-tl.png">
+<img class="screenshot" alt="Make timesheet against PO" src="{{docs_base_url}}/assets/img/manufacturing/PO-operations-make-ts.png">
 
 ###Updating Finished Goods
 
 * Once you are done with the Production Order you need to update the Finished Goods.
 * This will create a Stock Entry that will deduct all the sub-Items from the WIP Warehouse and add them to the Finished Goods Warehouse.
-* Click on 'Update Finished Goods'.
+* Click on 'Finish'.
 
 <img class="screenshot" alt="Update Finished Goods" src="{{docs_base_url}}/assets/img/manufacturing/PO-FG-update.png">
 
diff --git a/erpnext/docs/user/manual/en/selling/articles/sales-persons-in-the-sales-transactions.md b/erpnext/docs/user/manual/en/selling/articles/sales-persons-in-the-sales-transactions.md
index c270e13..781d2ce 100644
--- a/erpnext/docs/user/manual/en/selling/articles/sales-persons-in-the-sales-transactions.md
+++ b/erpnext/docs/user/manual/en/selling/articles/sales-persons-in-the-sales-transactions.md
@@ -32,14 +32,4 @@
 
 `Accounts > Standard Reports > Sales Partners Commission`
 
-####Disable Sales Person Feature
-
-If you don't track Sales Person wise performance, and doesn't wish to use this feature, you can disable it from:
-
-`Setup > Customize > Features Setup`
-
-<img class="screenshot" alt="Disable Sales Person" src="{{docs_base_url}}/assets/img/articles/sales-person-transaction-4.png">
-
-On disabling this feature, fields and tables related to Sales Person will become hidden from masters and transcations.
-
 <!-- markdown -->
\ No newline at end of file
diff --git a/erpnext/docs/user/manual/en/selling/quotation.md b/erpnext/docs/user/manual/en/selling/quotation.md
index 6f5cc5e..1f7b06c 100644
--- a/erpnext/docs/user/manual/en/selling/quotation.md
+++ b/erpnext/docs/user/manual/en/selling/quotation.md
@@ -1,9 +1,13 @@
 During a sale, the customer may request for a written note about the products
 or services you are planning to offer, along with the prices and other terms
 of engagement. This is called a “Proposal” or an “Estimate” or a “Pro Forma
-Invoice”or a Quotation.
+Invoice”or a **Quotation**.
 
-To create a new Quotation go to:
+A typical Selling flow looks like:
+
+<img class="screenshot" alt="Make Quotation from Opportunity" src="{{docs_base_url}}/assets/img/selling/selling-flow.png">
+
+To create a new Quotation navigate to:
 
 > Selling > Quotation > New Quotation
 
@@ -13,23 +17,18 @@
 
 <img class="screenshot" alt="Make Quotation from Opportunity" src="{{docs_base_url}}/assets/img/selling/make-quote-from-opp.png">
 
-Or You can create a new Quotation and pull details from an Opportunity.
-
-<img class="screenshot" alt="Make Quotation from Opportunity" src="{{docs_base_url}}/assets/img/selling/make-quotation.gif">
-
 A Quotation contains details about:
 
   * The recipient of the Quotation
   * The Items and quantities you are offering.
-  * The rates at which they are offered. For details refer 
+  * The rates at which they are offered.
   * The taxes applicable.
   * Other charges (like shipping, insurance) if applicable.
   * The validity of contract.
   * The time of delivery.
   * Other conditions.
 
-> Tip: Images look great on Quotations. To add images to your Quotations,
-attach the corresponding image in the Item master.
+> Tip: Images look great on Quotations. Make sure your items have an image attached.
 
 ### Rates
 
@@ -41,11 +40,13 @@
 
 ### Taxes
 
-To add taxes to your Quotation, you can either select a tax template, Sales
-Taxes and Charges Template or add the taxes on your own. To understand taxes in
-detail visit [Taxes]({{docs_base_url}}/user/manual/en/setting-up/setting-up-taxes.html)
+To add taxes to your Quotation, you can select a **Sales Taxes and Charges Template** or add the taxes on your own.
 
-You can add taxes in the same manner as the Sales Taxes and Charges Template.
+For e.g
+
+<img class="screenshot" alt="Taxes and Charges" src="{{docs_base_url}}/assets/img/selling/taxes-and-charges.gif">
+
+To understand taxes in detail visit [Taxes]({{docs_base_url}}/user/manual/en/setting-up/setting-up-taxes.html).
 
 ### Terms and Conditions
 
@@ -71,19 +72,17 @@
 
 Quotation is a “Submittable” transaction. Since you send this Quotation to
 your Customer or Lead, you must freeze it so that changes are not made after
-you send the Quotation. See Document Stages.
+you send the Quotation.
 
 > Tip: Quotations can also be titled as “Proforma Invoice” or “Proposal”.
-Select the right heading in the “Print Heading” field in the “More Info”
-section. To create new Print Headings go to Setup > Branding and Printing >
-Print Headings.
+You can do this by selecting a **Print Heading** in the **Print Settings**
+section. To create new Print Headings go to Setup > Printing >
+Print Heading.
 
 ### Discount
 
 While making your sales transactions like a Quotation (or Sales Order) you
-would already have noticed that there is a “Discount” column. On the left is
-the “Price List Rate” on the right is the “Basic Rate”. You can add a
-“Discount” value to update the basic rate. To understand more about discount
-read [Discount.](http://erpnext.org/discount)
+can also give discounts to your customers. In the Discount section, add
+the discount in percentage or fixed amount. Read [Discount](https://frappe.github.io/erpnext/user/manual/en/selling/articles/applying-discount) for more explanation.
 
 {next}
diff --git a/erpnext/docs/user/manual/en/selling/sales-order.md b/erpnext/docs/user/manual/en/selling/sales-order.md
index 269473a..32e58a5 100644
--- a/erpnext/docs/user/manual/en/selling/sales-order.md
+++ b/erpnext/docs/user/manual/en/selling/sales-order.md
@@ -50,6 +50,16 @@
 This “reserved” quantity will help you project what is the quantity you need
 to purchase based on all your commitments.
 
+### Taxes
+
+To add taxes to your Quotation, you can select a **Sales Taxes and Charges Template** or add the taxes on your own.
+
+For e.g
+
+<img class="screenshot" alt="Taxes and Charges" src="{{docs_base_url}}/assets/img/selling/taxes-and-charges.gif">
+
+To understand taxes in detail visit [Taxes]({{docs_base_url}}/user/manual/en/setting-up/setting-up-taxes.html).
+
 ### Sales Team
 
 **Sales Partner:** If this Sale was booked via a Sales Partner, you can update the Sales Partner’s details with commission and other info that you can aggregate.
diff --git a/erpnext/docs/user/manual/en/selling/setup/sales-person-target-allocation.md b/erpnext/docs/user/manual/en/selling/setup/sales-person-target-allocation.md
index e32c97d..75b7561 100644
--- a/erpnext/docs/user/manual/en/selling/setup/sales-person-target-allocation.md
+++ b/erpnext/docs/user/manual/en/selling/setup/sales-person-target-allocation.md
@@ -80,7 +80,7 @@
 
 ###See Also
 
-1. [Managing Sales Person](https://erpnext.com/selling/selling-setup/sales-person)
-2. [Using Sales Person in transactions](https://erpnext.com/kb/selling/managing-sales-persons-in-sales-transactions)
+1. [Sales Person Target Allocation]({{docs_base_url}}/user/manual/en/selling/setup/sales-person-target-allocation)
+2. [Using Sales Person in transactions]({{docs_base_url}}/user/manual/en/selling/articles/sales-persons-in-the-sales-transactions)
 
 {next}
diff --git a/erpnext/docs/user/manual/en/setting-up/articles/index.txt b/erpnext/docs/user/manual/en/setting-up/articles/index.txt
index 6f99f89..e6a3b85 100644
--- a/erpnext/docs/user/manual/en/setting-up/articles/index.txt
+++ b/erpnext/docs/user/manual/en/setting-up/articles/index.txt
@@ -9,5 +9,4 @@
 naming-series-current-value
 overwriting-data-from-data-import-tool
 rename-user
-setting-up-dropbox-backups
 using-custom-domain-on-erpnext
\ No newline at end of file
diff --git a/erpnext/docs/user/manual/en/setting-up/articles/setting-up-dropbox-backups.md b/erpnext/docs/user/manual/en/setting-up/articles/setting-up-dropbox-backups.md
deleted file mode 100644
index 68e4031..0000000
--- a/erpnext/docs/user/manual/en/setting-up/articles/setting-up-dropbox-backups.md
+++ /dev/null
@@ -1,74 +0,0 @@
-#Setting Up Dropbox Backups
-
-We always recommend customers to maintain backup of their data in ERPNext. he database backup is downloaded in the form of an SQL file. If needed, this SQL file of backup can be restored in the another ERPNext account as well.
-
-You can automate database backup download of your ERPNext account into your Dropbox account.
-
-####Step 1: Go to Setup
-
-`Explore > Setup > Integrations > Dropbox Backup`
-
-####Step 2: Activate
-
-In the Dropbox Backup, check "Send Backups to Dropbox" to active this feature. On checking this field, you will find field to set Frequency and notification Email.
-
-####Step 3: Set Frequency
-
-Set Frequency to download backup in your Dropbox account.
-
-<img class="screenshot" alt="set frequency" src="{{docs_base_url}}/assets/img/setup/dropbox-1.png">
-
-####Step 4: Allow Dropbox Access
-
-After setting frequency and updating notification email, click on `Allow Dropbox access`. On clicking this button, the Dropbox login page will open in the new tab. This might require you to allow pop-up for your ERPNext account.
-
-####Step 5: Login to Dropbox
-
-Login to your Dropbox account by entering login credentials.
-
-<img class="screenshot" alt="Login" src="{{docs_base_url}}/assets/img/setup/dropbox-2.png">
-
-####Step 6: Allow
-
-On successfull login, you will find a confirmation message as following. Click on "Allow" to let your ERPNext account have access to your Dropbox account.
-
-<img class="screenshot" alt="Allow" src="{{docs_base_url}}/assets/img/setup/dropbox-3.png">
-
-With this, a folder called "ERPNext" will be created in your Dropbox account, and database backup will start to auto-download in it.
-
-##Open Source Users
-
-####Step 1: Go to
-
-<a href="https://www.dropbox.com/developers/apps" target="_blank" style="line-height: 1.42857143;">https://www.dropbox.com/developers/apps</a>
-
-####Step 2:Create a new app
-
-<img class="screenshot" alt="Create new" src="{{docs_base_url}}/assets/img/setup/dropbox-open-3.png">
-
-####Step 3: Fill in details for the app
-
-<img class="screenshot" alt="Create new" src="{{docs_base_url}}/assets/img/setup/dropbox-open-1.png">
-
--
-<img class="screenshot" alt="Create new" src="{{docs_base_url}}/assets/img/setup/dropbox-open-2.png">
-
-####Step 4: Settings in Site Config
-
-After the app is created, note the app key and app secret and enter in `sites/{sitename}/site_config.json` as follows,
-
-<div>
-	<pre>
-		<code>{ 
- "db_name": "demo", 
- "db_password": "DZ1Idd55xJ9qvkHvUH", 
- "dropbox_access_key": "ACCESSKEY", 
- "dropbox_secret_key": "SECRECTKEY" 
-} 		
-		</code>
-	</pre>
-</div>
-
-####Step 5: Complete Backup
-
-Setup dropbox backups from the backup manager as shown in previous section.
\ No newline at end of file
diff --git a/erpnext/docs/user/manual/en/setting-up/data/data-import-tool.md b/erpnext/docs/user/manual/en/setting-up/data/data-import-tool.md
index e59ed21..563568a 100644
--- a/erpnext/docs/user/manual/en/setting-up/data/data-import-tool.md
+++ b/erpnext/docs/user/manual/en/setting-up/data/data-import-tool.md
@@ -1,8 +1,6 @@
-The Data Import Tool is a great way to upload (or edit) bulk data, specially
-master data, into the system.
+The Data Import Tool is a great way to upload (or edit) bulk data, specially master data, into the system.
 
-To Open the data import tool, you either go to Setup or go to the Transaction
-you want to Import. If Data Import is allowed, you will see an Import Button:
+To Open the data import tool, you either go to Setup or go to the Transaction you want to Import. If Data Import is allowed, you will see an Import Button:
 
 <img alt="Start Import" class="screenshot" src="{{docs_base_url}}/assets/img/setup/data-import/data-import-1.png">
 
@@ -20,22 +18,24 @@
 implemented where there are multiple values for any property. For example an
 Item can have multiple prices, An Invoice has multiple Items and so on.
 
-<img alt="Download Template" class="screenshot" src="{{docs_base_url}}/assets/img/setup/data-import/data-import-2.png">
-
-  * Click on the table you want to download or "All Tables"
-  * For bulk editing, you can click on "Download With Data"
+  * Select Doctype for which template should be downloaded.
+  * Check fields to be included in the template.
+  * Click on "Download Blank Template".
+  * For bulk editing, you can click on "Download With Data".
+  
+<img alt="Download Template" class="screenshot" src="{{docs_base_url}}/assets/img/setup/data-import/data-import-tool-template.gif">
 
 ### 2\. Fill in the Template
 
 After downloading the template, open it in a spreadsheet application and fill
 in the data below the column headings.
 
-![Spreadsheet]({{docs_base_url}}/assets/old_images/erpnext/import-3.png)
+<img alt="Download Template" class="screenshot" src="{{docs_base_url}}/assets/img/setup/data-import/import-file.png">
 
 Then export your template or save it as a **Comma Separated Values** (CSV)
 file.
 
-![Spreadsheet]({{docs_base_url}}/assets/old_images/erpnext/import-4.png)
+<img alt="Download Template" class="screenshot" src="{{docs_base_url}}/assets/img/setup/data-import/import-csv.png">
 
 ### 3\. Upload the .csv File
 
@@ -49,7 +49,7 @@
 1. Make sure that if your application allows, use encoding as UTF-8.
 1. Keep the ID column blank for new records.
 
-### 4\. Uploading All Tables (Main + Child)
+### 4. Uploading All Tables (Main + Child)
 
 If you select all tables, you will get columns belonging to all the tables in
 one row separated by `~` columns.
@@ -67,7 +67,7 @@
 > To see how its done, enter a few records manually using forms and export
 "All Tables" with "Download with Data"
 
-### 5\. Overwriting
+### 5. Overwriting
 
 ERPNext also allows you to overwrite all / certain columns. If you want to
 update certain columns, you can download the template with data. Remember to
@@ -76,7 +76,7 @@
 > Note: For child records, if you select Overwrite, it will delete all the
 child records of that parent.
 
-### 6\. Upload Limitations
+### 6. Upload Limitations
 
 ERPNext restricts the amount of data you can upload in one file. Though the
 number may vary based on the type of data. It is usually safe to upload around
@@ -107,4 +107,10 @@
 clear way of saving as UTF-8. So save your file as a CSV, then open it in
 Notepad, and save as “UTF-8”. (Sorry blame Microsoft for this!)
 
+####Help Video on Importing Data in ERPNext from Spreadsheet file
+
+
+
+<iframe width="660" height="371" src="https://www.youtube.com/embed/Ta2Xx3QoK3E" frameborder="0" allowfullscreen></iframe>
+
 {next}
diff --git a/erpnext/schools/doctype/scheduling_tool/__init__.py b/erpnext/docs/user/manual/en/setting-up/integration-services/__init__.py
similarity index 100%
copy from erpnext/schools/doctype/scheduling_tool/__init__.py
copy to erpnext/docs/user/manual/en/setting-up/integration-services/__init__.py
diff --git a/erpnext/docs/user/manual/en/setting-up/integration-services/dropbox-backup.md b/erpnext/docs/user/manual/en/setting-up/integration-services/dropbox-backup.md
new file mode 100644
index 0000000..7fc283b
--- /dev/null
+++ b/erpnext/docs/user/manual/en/setting-up/integration-services/dropbox-backup.md
@@ -0,0 +1,81 @@
+#Setting Up Dropbox Backups
+
+We always recommend customers to maintain backup of their data in ERPNext. he database backup is downloaded in the form of an SQL file. If needed, this SQL file of backup can be restored in the another ERPNext account as well.
+
+You can automate database backup download of your ERPNext account into your Dropbox account.
+
+####Step 1: Create Dropbox service
+
+`Explore > Setup > Integration Service`
+
+Make a new Integration Service and select `Dropbox` as a service from dropdown then save the document.
+
+####Step 2: Activate
+
+After saving a document, click on `Dropbox Settings` button, to setup service.
+
+<img class="screenshot" alt="create dropbox service" src="{{docs_base_url}}/assets/img/setup/integration-service/create_service.png">
+
+####Step 3: Set Frequency
+
+Set Frequency to download backup in your Dropbox account.
+
+<img class="screenshot" alt="set frequency" src="{{docs_base_url}}/assets/img/setup/integration-service/setup-backup-frequency.png">
+
+####Step 4: Allow Dropbox Access
+
+After setting frequency and updating other details, click on `Allow Dropbox access`. On clicking this button, the Dropbox login page will open in the new tab. This might require you to allow pop-up for your ERPNext account.
+
+####Step 5: Login to Dropbox
+
+Login to your Dropbox account by entering login credentials.
+
+<img class="screenshot" alt="Login" src="{{docs_base_url}}/assets/img/setup/integration-service/dropbox-2.png">
+
+####Step 6: Allow
+
+On successfull login, you will find a confirmation message as following. Click on "Allow" to let your ERPNext account have access to your Dropbox account.
+
+<img class="screenshot" alt="Allow" src="{{docs_base_url}}/assets/img/setup/integration-service/dropbox-3.png">
+
+####Step 7: Enable Service
+After generating access token, go back to Dropbox Integration Service record and check `enable`. This will enable backup auto-download.
+
+With this, a folder called "ERPNext" will be created in your Dropbox account, and database backup will start to auto-download in it.
+
+##Open Source Users
+
+####Step 1: Go to
+
+<a href="https://www.dropbox.com/developers/apps" target="_blank" style="line-height: 1.42857143;">https://www.dropbox.com/developers/apps</a>
+
+####Step 2:Create a new app
+
+<img class="screenshot" alt="Create new" src="{{docs_base_url}}/assets/img/setup/integration-service/dropbox-open-3.png">
+
+####Step 3: Fill in details for the app
+
+<img class="screenshot" alt="Create new" src="{{docs_base_url}}/assets/img/setup/integration-service/dropbox-open-1.png">
+
+-
+<img class="screenshot" alt="Create new" src="{{docs_base_url}}/assets/img/setup/integration-service/dropbox-open-2.png">
+
+####Step 4: Settings in Site Config
+
+After the app is created, note the app key and app secret on Dropbox Settings page or enter in `sites/{sitename}/site_config.json` as follows,
+
+<div>
+	<pre>
+		<code>{ 
+ "db_name": "demo", 
+ "db_password": "DZ1Idd55xJ9qvkHvUH", 
+ "dropbox_access_key": "ACCESSKEY", 
+ "dropbox_secret_key": "SECRECTKEY" 
+} 		
+		</code>
+	</pre>
+</div>
+
+####Step 5: Complete Backup
+
+Setup dropbox backups from the backup manager as shown in previous section.
\ No newline at end of file
diff --git a/erpnext/docs/user/manual/en/setting-up/integration-services/index.md b/erpnext/docs/user/manual/en/setting-up/integration-services/index.md
new file mode 100644
index 0000000..e7b5a61
--- /dev/null
+++ b/erpnext/docs/user/manual/en/setting-up/integration-services/index.md
@@ -0,0 +1,5 @@
+
+Integration Services is platform to configure 3rd Party Services.
+
+###Services
+{index}
\ No newline at end of file
diff --git a/erpnext/docs/user/manual/en/setting-up/integration-services/index.txt b/erpnext/docs/user/manual/en/setting-up/integration-services/index.txt
new file mode 100644
index 0000000..fc5e8a4
--- /dev/null
+++ b/erpnext/docs/user/manual/en/setting-up/integration-services/index.txt
@@ -0,0 +1,4 @@
+dropbox-backup
+paypal-integration
+razorpay-integration
+ldap-integration
\ No newline at end of file
diff --git a/erpnext/docs/user/manual/en/setting-up/integration-services/ldap-integration.md b/erpnext/docs/user/manual/en/setting-up/integration-services/ldap-integration.md
new file mode 100644
index 0000000..34678a9
--- /dev/null
+++ b/erpnext/docs/user/manual/en/setting-up/integration-services/ldap-integration.md
@@ -0,0 +1,24 @@
+#Setting up LDAP
+
+Lightweight Directory Access Protocol is a centralised access controll system used by many small medium scale organisations.
+
+By settings up LDAP service, you able to login to ERPNext account by using LDAP credentials.
+
+####Step 1: Create Razorpay service
+
+`Explore > Setup > Integration Service`
+
+Make a new Integration Service and select `LDAP` as a service from dropdown then save the document.
+After saving a document, click on `LDAP Settings` button, to setup service.
+
+####Step 2: Setup  ldap service
+
+To enable ldap service, you need to configure parameters like LDAP Server Url, Organizational Unit, Base Distinguished Name (DN) and Password for Base DN
+
+<img class="screenshot" alt="LDAP Settings" src="{{docs_base_url}}/assets/img/setup/integration-service/ldap_settings.png">
+
+####Step 3: Enable Service
+After setting up credentials on LDAP Settings, go back to LDAP Service record and enable it.
+While enabling, it will validate LDAP details and on successful validation, it will enables LDAP login option.
+
+<img class="screenshot" alt="LOGIN via LDAP" src="{{docs_base_url}}/assets/img/setup/integration-service/login_via_ldap.png">
\ No newline at end of file
diff --git a/erpnext/docs/user/manual/en/setting-up/integration-services/paypal-integration.md b/erpnext/docs/user/manual/en/setting-up/integration-services/paypal-integration.md
new file mode 100644
index 0000000..d1054ba
--- /dev/null
+++ b/erpnext/docs/user/manual/en/setting-up/integration-services/paypal-integration.md
@@ -0,0 +1,58 @@
+#Setting up PayPal
+
+A payment gateway is an e-commerce application service provider service that authorizes credit card payments for e-businesses, online retailers, bricks and clicks, or traditional brick and mortar.
+
+A payment gateway facilitates the transfer of information between a payment portal (such as a website, mobile phone or interactive voice response service) and the Front End Processor or acquiring bank.
+
+####Step 1: Create PayPal service
+
+`Explore > Setup > Integration Service`
+
+Make a new Integration Service and select `PayPal` as a service from dropdown then save the document.
+After saving a document, click on `PayPal Settings` button, to setup service.
+
+####Step 2: Setup  payment service
+
+To enable PayPal payment service, you need to configure parameters like API Username, API Password and Signature.
+
+<img class="screenshot" alt="PayPal Settings" src="{{docs_base_url}}/assets/img/setup/integration-service/paypal_settings.png">
+
+You also can set test payment environment, by settings `Use Sandbox`
+
+####Step 3: Enable Service
+After setting up credentials on PayPal Settings, go back to PayPal Service record and enable it.
+On enabling service, the system will create Payment Gateway record and Account head in chart of account with account type as Bank.
+
+<img class="screenshot" alt="PayPal COA" src="{{docs_base_url}}/assets/img/setup/integration-service/paypal_coa.png">
+
+Also it will create Payment Gateway Account entry. Payment Gateway Account is configuration hub from this you can set account head from existing COA, default Payment Request email body template.
+
+<img class="screenshot" alt="Payment Gateway Account" src="{{docs_base_url}}/assets/img/setup/integration-service/payment_gateway_account_paypal.png">
+
+After enabling service and configuring Payment Gateway Account your system is able to accept online payments.
+
+####Supporting transaction currencies
+AUD, BRL, CAD, CZK, DKK, EUR, HKD, HUF, ILS, JPY, MYR, MXN, TWD, NZD, NOK, PHP, PLN, GBP, RUB, SGD, SEK, CHF, THB, TRY, USD
+
+##Get PayPal credentials
+
+#### Paypal Sanbox API Signature
+ - Login to paypal developer account, <a href="https://developer.paypal.com/">PayPal Developer Account</a>
+ - From **Accounts** tab. create a new business account.
+<img class="screenshot" alt="Payment Request" src="{{ docs_base_url }}/assets/img/setup/integration-service/setup-sanbox-1.png">
+ 
+ - From this account profile you will get your sandbox api credentials
+<img class="screenshot" alt="Payment Request" src="{{ docs_base_url }}/assets/img/setup/integration-service/sanbox-credentials.png">
+
+
+---
+
+#### PayPal Account API Signature
+ - Login to PayPal Account and go to profile
+<img class="screenshot" alt="Payment Request" src="{{ docs_base_url }}/assets/img/setup/integration-service/api-step-1.png">
+
+ - From **My Selling Tools** go to **api Access**
+<img class="screenshot" alt="Payment Request" src="{{ docs_base_url }}/assets/img/setup/integration-service/api-step-2.png">
+
+ - On API Access Page, choose option 2 to generate API credentials
+<img class="screenshot" alt="Payment Request" src="{{ docs_base_url }}/assets/img/setup/integration-service/api-step-3.png">
diff --git a/erpnext/docs/user/manual/en/setting-up/integration-services/razorpay-integration.md b/erpnext/docs/user/manual/en/setting-up/integration-services/razorpay-integration.md
new file mode 100644
index 0000000..ad43f63
--- /dev/null
+++ b/erpnext/docs/user/manual/en/setting-up/integration-services/razorpay-integration.md
@@ -0,0 +1,33 @@
+#Setting up Razorpay
+
+A payment gateway is an e-commerce application service provider service that authorizes credit card payments for e-businesses, online retailers, bricks and clicks, or traditional brick and mortar.
+
+A payment gateway facilitates the transfer of information between a payment portal (such as a website, mobile phone or interactive voice response service) and the Front End Processor or acquiring bank.
+
+####Step 1: Create Razorpay service
+
+`Explore > Setup > Integration Service`
+
+Make a new Integration Service and select `Razorpay` as a service from dropdown then save the document.
+After saving a document, click on `Razorpay Settings` button, to setup service.
+
+####Step 2: Setup  payment service
+
+To enable Razorpay payment service, you need to configure parameters like API Username, API Password and Signature.
+
+<img class="screenshot" alt="Razorpay Settings" src="{{docs_base_url}}/assets/img/setup/integration-service/razorpay_settings.png">
+
+####Step 3: Enable Service
+After setting up credentials on Razorpay Settings, go back to Razorpay Service record and enable it.
+On enabling service, the system will create Payment Gateway record and Account head in chart of account with account type as Bank.
+
+<img class="screenshot" alt="Razorpay COA" src="{{docs_base_url}}/assets/img/setup/integration-service/razorpay_coa.png">
+
+Also it will create Payment Gateway Account entry. Payment Gateway Account is configuration hub from this you can set account head from existing COA, default Payment Request email body template.
+
+<img class="screenshot" alt="Payment Gateway Account" src="{{docs_base_url}}/assets/img/setup/integration-service/payment_gateway_account_razorpay.png">
+
+After enabling service and configuring Payment Gateway Account your system is able to accept online payments.
+
+####Supporting transaction currencies
+INR
diff --git a/erpnext/docs/user/manual/en/setting-up/print/multi-lingual-print-format.md b/erpnext/docs/user/manual/en/setting-up/print/custom-translations.md
similarity index 98%
rename from erpnext/docs/user/manual/en/setting-up/print/multi-lingual-print-format.md
rename to erpnext/docs/user/manual/en/setting-up/print/custom-translations.md
index a15834c..1dab1c1 100644
--- a/erpnext/docs/user/manual/en/setting-up/print/multi-lingual-print-format.md
+++ b/erpnext/docs/user/manual/en/setting-up/print/custom-translations.md
@@ -1,4 +1,4 @@
-#Multi-lngual Print Formats
+#Custom Translations
 
 User can print the customer's and supplier's document in their local language. For an example if I have customers from germany, france who want quotation in german, french language will be possible with these feature.
 
diff --git a/erpnext/docs/user/manual/en/setting-up/print/index.txt b/erpnext/docs/user/manual/en/setting-up/print/index.txt
index 80b5946..fa23652 100644
--- a/erpnext/docs/user/manual/en/setting-up/print/index.txt
+++ b/erpnext/docs/user/manual/en/setting-up/print/index.txt
@@ -5,4 +5,4 @@
 address-template
 terms-and-conditions
 cheque-print-template
-multi-lingual-print-format
\ No newline at end of file
+custom-translations
\ No newline at end of file
diff --git a/erpnext/docs/user/manual/en/setting-up/settings/naming-series.md b/erpnext/docs/user/manual/en/setting-up/settings/naming-series.md
index df7de6d..086a272 100644
--- a/erpnext/docs/user/manual/en/setting-up/settings/naming-series.md
+++ b/erpnext/docs/user/manual/en/setting-up/settings/naming-series.md
@@ -46,3 +46,12 @@
 
 {next}
 
+### 4. Custom Field in Naming Series
+ Some companies prefers to make use of "short-codes" for suppliers, i.e. WN for company "Web Notes" that later can be used in naming series for quick identification.
+ 
+#### Example:
+
+    A custom field "Vendor ID" is created under Document: Supplier.
+    Then under Naming Series, we should allow something like
+        PO-.YY.MM.-.vendor_id.-.#####
+        Resulting in "PO-1503-WN-00001"
diff --git a/erpnext/docs/user/manual/en/stock/articles/track-items-using-barcode.md b/erpnext/docs/user/manual/en/stock/articles/track-items-using-barcode.md
index c880dfb..6d8fcb6 100644
--- a/erpnext/docs/user/manual/en/stock/articles/track-items-using-barcode.md
+++ b/erpnext/docs/user/manual/en/stock/articles/track-items-using-barcode.md
@@ -2,15 +2,9 @@
 
 A barcode is a value decoded into vertical spaced lines. Barcode scanners are the input medium, like Keyboard. When it scans a barcode, the data appears in the computer screens at the point of a cursor.
 
-To enable barcode feature in ERPNext go to:
+### Item Master
 
-`Setup > Customize > Features Setup`
-
-Check "Item Barcode".
-
-<img alt="Material Transfer" class="screenshot" src="{{docs_base_url}}/assets/img/articles/barcode-feature-setup.png">
-
-Now a new field "Barcode" will be appear in Item master. Enter barcode while creating a new item.
+To set the barcode of a particular item, you will have to open the Item record. You can also enter barcode while creating a new item.
 
 <img alt="Material Transfer" class="screenshot" src="{{docs_base_url}}/assets/img/articles/barcode-item-master.png">
 
diff --git a/erpnext/docs/user/manual/en/stock/item/index.md b/erpnext/docs/user/manual/en/stock/item/index.md
index 7ca9d4e..ad44866 100644
--- a/erpnext/docs/user/manual/en/stock/item/index.md
+++ b/erpnext/docs/user/manual/en/stock/item/index.md
@@ -10,7 +10,7 @@
   * **Default Unit of Measure:** This is the default measuring unit that you will use for your product. It could be in nos, kgs, meters, etc. You can store all the UOM’s that your product will require under Set Up> Master Data > UOM. These can be preselected while filling New Item by using % sign to get a pop up of the UOM list.
   * **Brand:** If you have more than one brand save them under Set Up> Master Data> Brand and pre-select them while filling a New Item.
   * **Variant:** A Item Variant is a different version of a Item.To learn more about managing varaints see [Item Variants]({{docs_base_url}}/user/manual/en/stock/item/item-variants.html)
-  
+
 ### Upload an Image
 
 To upload an image for your icon that will appear in all transactions, save
@@ -24,8 +24,8 @@
 Asset Item, Stock Item or even Manufacturing Item.
 
   * **Stock Item:** If you are maintaining stock of this Item in your Inventory, ERPNext will make a stock ledger entry for each transaction of this item.
-  * **Default Warehouse:** This is the Warehouse that is automatically selected in your transactions. 
-  * **Allowance Percentage:** This is the percent by which you will be allowed to over-bill or over-deliver this Item. If not set, it will select from the Global Defaults. 
+  * **Default Warehouse:** This is the Warehouse that is automatically selected in your transactions.
+  * **Allowance Percentage:** This is the percent by which you will be allowed to over-bill or over-deliver this Item. If not set, it will select from the Global Defaults.
   * **Valuation Method:** There are two options to maintain valuation of stock. FIFO (first in - first out) and Moving Average. To understand this topic in detail please visit “ Item Valuation, FIFO and Moving Average”.
 
 ### Serialized and Batched Inventory
@@ -34,11 +34,11 @@
 
 > Important: Once you mark an item as serialized or batched or neither, you cannot change it after you have made any stock entry.
 
-  * [Discussion on Serialized Inventory]({{docs_base_url}}/user/manual/en/setting-up/stock-reconciliation-for-non-serialized-item.html)  
+  * [Discussion on Serialized Inventory]({{docs_base_url}}/user/manual/en/setting-up/stock-reconciliation-for-non-serialized-item.html)
 
 ### Re Ordering
 
-  * **Re-order level** suggests the amount of stock balance in the Warehouse. 
+  * **Re-order level** suggests the amount of stock balance in the Warehouse.
   * **Re-order Qty** suggests the amount of stock to be ordered to maintain minimum stock levels.
   * **Minimum Order Qty** is the minimum quantity for which a Material Request / Purchase Order must be made.
 
@@ -86,7 +86,7 @@
 
 ![Manufacturing]({{docs_base_url}}/assets/old_images/erpnext/item-manufacturing-website.png)
 
-Visit [Manufacturing]({{docs_base_url}}/user/manual/en/manufacturing.html) and [Website ]({{docs_base_url}}/user/manual/en/website.html)to understand these topics in detail.
+Visit [Manufacturing]({{docs_base_url}}/user/manual/en/manufacturing) and [Website ]({{docs_base_url}}/user/manual/en/website)to understand these topics in detail.
 
 ### Learn more about Item
 
diff --git a/erpnext/docs/user/manual/en/using-erpnext/articles/merging-documents.md b/erpnext/docs/user/manual/en/using-erpnext/articles/merging-documents.md
index 15dd117..f03bbd8 100644
--- a/erpnext/docs/user/manual/en/using-erpnext/articles/merging-documents.md
+++ b/erpnext/docs/user/manual/en/using-erpnext/articles/merging-documents.md
@@ -1,6 +1,6 @@
 #Merging Documents
 
-For a document, of you have two records which are identical, and meant for common purpose, you can merge them into one record.
+For a document, if you have two records which are identical, and meant for common purpose, you can merge them into one record.
 
 Following are step to merge documents. Let's assume we are merging two Accounts.
 
@@ -10,7 +10,7 @@
 
 #### Step 2: Go to Account 
 
-For an Account to be merge, click on "Rename" option.
+For an Account to be merged, click on the "Rename" option.
 
 <img alt="Sales Order File Attachment" class="screenshot" src="{{docs_base_url}}/assets/img/articles/merge-docs-1.png">
 
@@ -18,7 +18,7 @@
 
 In the New Name field, enter another account name with which this account will be merged. Check "Merge with existing" option. Then press 'Rename' button to merge.
 
-Following is how merged account will appear in the Chart of Account master.
+Following is how the merged account will appear in the Chart of Accounts master.
 
 <img alt="Sales Order File Attachment" class="screenshot" src="{{docs_base_url}}/assets/img/articles/merge-docs-2.gif">
 
@@ -28,4 +28,4 @@
 
 <div class="well"> Note: Group Account cannot be merged into Child Account and vice versa.</div>
 
-<!-- markdown -->
\ No newline at end of file
+<!-- markdown -->
diff --git a/erpnext/docs/user/manual/en/website/articles/index.txt b/erpnext/docs/user/manual/en/website/articles/index.txt
index a89040a..97c24d5 100644
--- a/erpnext/docs/user/manual/en/website/articles/index.txt
+++ b/erpnext/docs/user/manual/en/website/articles/index.txt
@@ -1,3 +1,3 @@
 managing-user-sign-up-via-website
 website-security
-wesite-home-page
\ No newline at end of file
+website-home-page
diff --git a/erpnext/docs/user/manual/en/website/articles/wesite-home-page.md b/erpnext/docs/user/manual/en/website/articles/website-home-page.md
similarity index 97%
rename from erpnext/docs/user/manual/en/website/articles/wesite-home-page.md
rename to erpnext/docs/user/manual/en/website/articles/website-home-page.md
index 0cf5fdc..9212643 100644
--- a/erpnext/docs/user/manual/en/website/articles/wesite-home-page.md
+++ b/erpnext/docs/user/manual/en/website/articles/website-home-page.md
@@ -1,4 +1,4 @@
-<h1>Wesite Home Page</h1>
+<h1>Website Home Page</h1>
 
 It is very much possible in ERPNext to setup certain standard page as default website Home Page. Following are steps to setup default website home page.
 
diff --git a/erpnext/hr/doctype/daily_work_summary/daily_work_summary.json b/erpnext/hr/doctype/daily_work_summary/daily_work_summary.json
index 43cef68..b457cf2 100644
--- a/erpnext/hr/doctype/daily_work_summary/daily_work_summary.json
+++ b/erpnext/hr/doctype/daily_work_summary/daily_work_summary.json
@@ -22,7 +22,6 @@
    "ignore_user_permissions": 0, 
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
-   "in_global_search": 0, 
    "in_list_view": 1, 
    "in_standard_filter": 0, 
    "label": "Company", 
@@ -53,7 +52,6 @@
    "ignore_user_permissions": 0, 
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
-   "in_global_search": 0, 
    "in_list_view": 1, 
    "in_standard_filter": 0, 
    "label": "Status", 
@@ -83,7 +81,6 @@
    "ignore_user_permissions": 0, 
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
-   "in_global_search": 0, 
    "in_list_view": 0, 
    "in_standard_filter": 0, 
    "label": "Email Sent To", 
@@ -106,13 +103,13 @@
  "hide_toolbar": 0, 
  "idx": 0, 
  "image_view": 0, 
- "in_create": 0, 
+ "in_create": 1, 
  "in_dialog": 0, 
  "is_submittable": 0, 
  "issingle": 0, 
  "istable": 0, 
  "max_attachments": 0, 
- "modified": "2016-11-18 12:09:01.580414", 
+ "modified": "2016-11-21 01:05:55.258867", 
  "modified_by": "Administrator", 
  "module": "HR", 
  "name": "Daily Work Summary", 
@@ -144,7 +141,7 @@
    "amend": 0, 
    "apply_user_permissions": 0, 
    "cancel": 0, 
-   "create": 1, 
+   "create": 0, 
    "delete": 1, 
    "email": 1, 
    "export": 1, 
@@ -159,11 +156,11 @@
    "set_user_permissions": 0, 
    "share": 1, 
    "submit": 0, 
-   "write": 1
+   "write": 0
   }
  ], 
  "quick_entry": 1, 
- "read_only": 0, 
+ "read_only": 1, 
  "read_only_onload": 0, 
  "sort_field": "modified", 
  "sort_order": "DESC", 
diff --git a/erpnext/hr/doctype/daily_work_summary/daily_work_summary.py b/erpnext/hr/doctype/daily_work_summary/daily_work_summary.py
index fe5fd8e..7fff5f5 100644
--- a/erpnext/hr/doctype/daily_work_summary/daily_work_summary.py
+++ b/erpnext/hr/doctype/daily_work_summary/daily_work_summary.py
@@ -9,6 +9,7 @@
 from email_reply_parser import EmailReplyParser
 from erpnext.hr.doctype.employee.employee import is_holiday
 from frappe.utils import formatdate
+from markdown2 import markdown
 
 class DailyWorkSummary(Document):
 	def send_mails(self, settings, emails):
@@ -38,15 +39,18 @@
 
 		replies = frappe.get_all('Communication', fields=['content', 'text_content', 'sender'],
 			filters=dict(reference_doctype=self.doctype, reference_name=self.name,
-				communication_type='Communication', sent_or_received='Received'))
+				communication_type='Communication', sent_or_received='Received'),
+				order_by='creation asc')
 
 		did_not_reply = self.email_sent_to.split()
 
 		for d in replies:
+			d.sender_name = frappe.db.get_value("Employee", {"user_id": d.sender},
+				"employee_name") or d.sender
 			if d.sender in did_not_reply:
 				did_not_reply.remove(d.sender)
 			if d.text_content:
-				d.content = EmailReplyParser.parse_reply(d.text_content)
+				d.content = markdown(EmailReplyParser.parse_reply(d.text_content))
 
 
 		did_not_reply = [(frappe.db.get_value("Employee", {"user_id": email}, "employee_name") or email)
@@ -61,17 +65,17 @@
 
 	def get_summary_template(self):
 		return '''
-<h4>{{ title }}</h4>
+<h3>{{ title }}</h3>
 
 {% for reply in replies %}
-<h5>{{ frappe.db.get_value("Employee", {"user_id": reply.sender}, "employee_name") or reply.sender }}<h5>
+<h4>{{ reply.sender_name }}</h4>
 <p style="padding-bottom: 20px">
 	{{ reply.content }}
 </p>
+<hr>
 {% endfor %}
 
 {% if did_not_reply %}
-<hr>
 <p>{{ did_not_reply_title }}: {{ did_not_reply }}</p>
 {% endif %}
 
@@ -89,7 +93,7 @@
 		if e.user_id:
 			if only_working and is_holiday(e.name):
 				# don't add if holiday
-				pass
+				continue
 			out.append(e.user_id)
 
 	return out
diff --git a/erpnext/hr/doctype/daily_work_summary_settings/daily_work_summary_settings.json b/erpnext/hr/doctype/daily_work_summary_settings/daily_work_summary_settings.json
index 00e90ea..f52af39 100644
--- a/erpnext/hr/doctype/daily_work_summary_settings/daily_work_summary_settings.json
+++ b/erpnext/hr/doctype/daily_work_summary_settings/daily_work_summary_settings.json
@@ -16,6 +16,7 @@
    "bold": 0, 
    "collapsible": 0, 
    "columns": 0, 
+   "description": "Emails will be sent to all Active Employees of the company at the given hour, if they do not have holiday. Summary of responses will be sent at midnight.", 
    "fieldname": "select_companies", 
    "fieldtype": "Section Break", 
    "hidden": 0, 
@@ -165,7 +166,7 @@
  "issingle": 1, 
  "istable": 0, 
  "max_attachments": 0, 
- "modified": "2016-11-08 05:48:53.068957", 
+ "modified": "2016-11-21 00:55:20.726328", 
  "modified_by": "Administrator", 
  "module": "HR", 
  "name": "Daily Work Summary Settings", 
diff --git a/erpnext/manufacturing/doctype/bom/bom.js b/erpnext/manufacturing/doctype/bom/bom.js
index ce4c4cb..5181cf4 100644
--- a/erpnext/manufacturing/doctype/bom/bom.js
+++ b/erpnext/manufacturing/doctype/bom/bom.js
@@ -4,9 +4,19 @@
 frappe.provide("erpnext.bom");
 
 frappe.ui.form.on("BOM", {
+	setup: function(frm) {
+		frm.add_fetch('buying_price_list', 'currency', 'currency')
+		frm.fields_dict["items"].grid.get_field("bom_no").get_query = function(doc, cdt, cdn){
+			return {
+				filters: {'currency': frm.doc.currency}
+			}
+		}
+	},
+
 	onload_post_render: function(frm) {
 		frm.get_field("items").grid.set_multiple_add("item_code", "qty");
 	},
+
 	refresh: function(frm) {
 		frm.toggle_enable("item", frm.doc.__islocal);
 		toggle_operations(frm);
@@ -31,6 +41,7 @@
 			});
 		}
 	},
+
 	update_cost: function(frm) {
 		return frappe.call({
 			doc: frm.doc,
@@ -43,6 +54,28 @@
 	}
 });
 
+erpnext.bom.BomController = erpnext.TransactionController.extend({
+	conversion_rate: function(doc, cdt, cdn) {
+		if(this.frm.doc.currency === this.get_company_currency()) {
+			this.frm.set_value("conversion_rate", 1.0);
+		} else {
+			erpnext.bom.update_cost(doc);
+		}
+	},
+	
+	item_code: function(doc, cdt, cdn){
+		var scrap_items = false;
+		child = locals[cdt][cdn];
+		if(child.doctype == 'BOM Scrap Item') {
+			scrap_items = true;
+		}
+
+		get_bom_material_detail(doc, cdt, cdn, scrap_items);
+	},
+})
+
+$.extend(cur_frm.cscript, new erpnext.bom.BomController({frm: cur_frm}));
+
 cur_frm.add_fetch("item", "description", "description");
 cur_frm.add_fetch("item", "image", "image");
 cur_frm.add_fetch("item", "item_name", "item_name");
@@ -56,19 +89,15 @@
 
 cur_frm.cscript.time_in_mins = cur_frm.cscript.hour_rate;
 
-cur_frm.cscript.item_code = function(doc, cdt, cdn) {
-	get_bom_material_detail(doc, cdt, cdn);
-}
-
 cur_frm.cscript.bom_no	= function(doc, cdt, cdn) {
-	get_bom_material_detail(doc, cdt, cdn);
+	get_bom_material_detail(doc, cdt, cdn, false);
 }
 
 cur_frm.cscript.is_default = function(doc) {
 	if (doc.is_default) cur_frm.set_value("is_active", 1);
 }
 
-var get_bom_material_detail= function(doc, cdt, cdn) {
+var get_bom_material_detail= function(doc, cdt, cdn, scrap_items) {
 	var d = locals[cdt][cdn];
 	if (d.item_code) {
 		return frappe.call({
@@ -77,6 +106,7 @@
 			args: {
 				'item_code': d.item_code,
 				'bom_no': d.bom_no != null ? d.bom_no: '',
+				"scrap_items": scrap_items,
 				'qty': d.qty
 			},
 			callback: function(r) {
@@ -96,60 +126,99 @@
 
 cur_frm.cscript.qty = function(doc, cdt, cdn) {
 	erpnext.bom.calculate_rm_cost(doc);
+	erpnext.bom.calculate_scrap_materials_cost(doc);
 	erpnext.bom.calculate_total(doc);
 }
 
 cur_frm.cscript.rate = function(doc, cdt, cdn) {
 	var d = locals[cdt][cdn];
+	var scrap_items = false;
+
+	if(child.doctype == 'BOM Scrap Item') {
+		scrap_items = true;
+	}
+
 	if (d.bom_no) {
 		msgprint(__("You can not change rate if BOM mentioned agianst any item"));
-		get_bom_material_detail(doc, cdt, cdn);
+		get_bom_material_detail(doc, cdt, cdn, scrap_items);
 	} else {
 		erpnext.bom.calculate_rm_cost(doc);
+		erpnext.bom.calculate_scrap_materials_cost(doc);
 		erpnext.bom.calculate_total(doc);
 	}
 }
 
+erpnext.bom.update_cost = function(doc) {
+	erpnext.bom.calculate_op_cost(doc);
+	erpnext.bom.calculate_rm_cost(doc);
+	erpnext.bom.calculate_scrap_materials_cost(doc);
+	erpnext.bom.calculate_total(doc);
+}
+
 erpnext.bom.calculate_op_cost = function(doc) {
 	var op = doc.operations || [];
 	doc.operating_cost = 0.0;
+	doc.base_operating_cost = 0.0;
+
 	for(var i=0;i<op.length;i++) {
 		operating_cost = flt(flt(op[i].hour_rate) * flt(op[i].time_in_mins) / 60, 2);
+		base_operating_cost = flt(flt(op[i].base_hour_rate) * flt(op[i].time_in_mins) / 60, 2);
 		frappe.model.set_value('BOM Operation',op[i].name, "operating_cost", operating_cost);
+		frappe.model.set_value('BOM Operation',op[i].name, "base_operating_cost", base_operating_cost);
 
 		doc.operating_cost += operating_cost;
+		doc.base_operating_cost += base_operating_cost;
 	}
-	refresh_field('operating_cost');
+	refresh_field(['operating_cost', 'base_operating_cost']);
 }
 
 // rm : raw material
 erpnext.bom.calculate_rm_cost = function(doc) {
 	var rm = doc.items || [];
 	total_rm_cost = 0;
+	base_total_rm_cost = 0;
 	for(var i=0;i<rm.length;i++) {
-		amt =	flt(rm[i].rate) * flt(rm[i].qty);
-		set_multiple('BOM Item',rm[i].name, {'amount': amt}, 'items');
-		set_multiple('BOM Item',rm[i].name,
-			{'qty_consumed_per_unit': flt(rm[i].qty)/flt(doc.quantity)}, 'items');
-		total_rm_cost += amt;
+		amount = flt(rm[i].rate) * flt(rm[i].qty);
+		base_amount = flt(rm[i].rate) * flt(doc.conversion_rate) * flt(rm[i].qty);
+		frappe.model.set_value('BOM Item', rm[i].name, 'base_rate', flt(rm[i].rate) * flt(doc.conversion_rate))
+		frappe.model.set_value('BOM Item', rm[i].name, 'amount', amount)
+		frappe.model.set_value('BOM Item', rm[i].name, 'qty_consumed_per_unit', flt(rm[i].qty)/flt(doc.quantity))
+		frappe.model.set_value('BOM Item', rm[i].name, 'base_amount', base_amount)
+		total_rm_cost += amount;
+		base_total_rm_cost += base_amount;
 	}
 	cur_frm.set_value("raw_material_cost", total_rm_cost);
+	cur_frm.set_value("base_raw_material_cost", base_total_rm_cost);
 }
 
 //sm : scrap material
 erpnext.bom.calculate_scrap_materials_cost = function(doc) {
 	var sm = doc.scrap_items || [];
 	total_sm_cost = 0;
+	base_total_sm_cost = 0;
+
 	for(var i=0;i<sm.length;i++) {
-		amt =	flt(sm[i].rate) * flt(sm[i].qty);
-		set_multiple('BOM Scrap Item',sm[i].name, {'amount': amt}, 'scrap_items');
+		base_rate = flt(sm[i].rate) * flt(doc.conversion_rate);
+		amount =	flt(sm[i].rate) * flt(sm[i].qty);
+		base_amount =	flt(sm[i].rate) * flt(sm[i].qty) * flt(doc.conversion_rate);
+		frappe.model.set_value('BOM Scrap Item',sm[i].name, 'base_rate', base_rate);
+		frappe.model.set_value('BOM Scrap Item',sm[i].name, 'amount', amount);
+		frappe.model.set_value('BOM Scrap Item',sm[i].name, 'base_amount', base_amount);
+		
+		total_sm_cost += amount;
+		base_total_sm_cost += base_amount;
 	}
+	
+	cur_frm.set_value("scrap_material_cost", total_sm_cost);
+	cur_frm.set_value("base_scrap_material_cost", base_total_sm_cost);
 }
 
 // Calculate Total Cost
 erpnext.bom.calculate_total = function(doc) {
-	total_cost = flt(doc.operating_cost) + flt(doc.raw_material_cost);
-	frappe.model.set_value(doc.doctype, doc.name, "total_cost", total_cost);
+	total_cost = flt(doc.operating_cost) + flt(doc.raw_material_cost) - flt(doc.scrap_material_cost);
+	base_total_cost = flt(doc.base_operating_cost) + flt(doc.base_raw_material_cost) - flt(doc.base_scrap_material_cost);
+	cur_frm.set_value("total_cost", total_cost);
+	cur_frm.set_value("base_total_cost", base_total_cost);
 }
 
 
@@ -186,10 +255,7 @@
 }
 
 cur_frm.cscript.validate = function(doc, dt, dn) {
-	erpnext.bom.calculate_op_cost(doc);
-	erpnext.bom.calculate_rm_cost(doc);
-	erpnext.bom.calculate_scrap_materials_cost(doc);
-	erpnext.bom.calculate_total(doc);
+	erpnext.bom.update_cost(doc)
 }
 
 frappe.ui.form.on("BOM Operation", "operation", function(frm, cdt, cdn) {
@@ -225,6 +291,7 @@
 		},
 		callback: function (data) {
 			frappe.model.set_value(d.doctype, d.name, "hour_rate", data.message.hour_rate);
+			frappe.model.set_value(d.doctype, d.name, "base_hour_rate", flt(data.message.hour_rate) * flt(frm.doc.conversion_rate));
 			erpnext.bom.calculate_op_cost(frm.doc);
 			erpnext.bom.calculate_total(frm.doc);
 		}
@@ -252,7 +319,6 @@
 	toggle_operations(frm);
 });
 
-
 cur_frm.cscript.image = function() {
 	refresh_field("image_view");
 }
diff --git a/erpnext/manufacturing/doctype/bom/bom.json b/erpnext/manufacturing/doctype/bom/bom.json
index ea43090..193f920 100644
--- a/erpnext/manufacturing/doctype/bom/bom.json
+++ b/erpnext/manufacturing/doctype/bom/bom.json
@@ -276,6 +276,118 @@
    "bold": 0, 
    "collapsible": 0, 
    "columns": 0, 
+   "fieldname": "currency_detail", 
+   "fieldtype": "Section Break", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "", 
+   "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_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "currency", 
+   "fieldtype": "Link", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Currency", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "Currency", 
+   "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_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "column_break_12", 
+   "fieldtype": "Column Break", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 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_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "conversion_rate", 
+   "fieldtype": "Float", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Conversion Rate", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "9", 
+   "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_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
    "depends_on": "", 
    "description": "Specify the operations, operating cost and give a unique Operation no to your operations.", 
    "fieldname": "operations_section", 
@@ -490,7 +602,7 @@
    "label": "Operating Cost", 
    "length": 0, 
    "no_copy": 0, 
-   "options": "Company:company:default_currency", 
+   "options": "currency", 
    "permlevel": 0, 
    "print_hide": 0, 
    "print_hide_if_no_value": 0, 
@@ -518,7 +630,7 @@
    "label": "Raw Material Cost", 
    "length": 0, 
    "no_copy": 0, 
-   "options": "Company:company:default_currency", 
+   "options": "currency", 
    "permlevel": 0, 
    "print_hide": 0, 
    "print_hide_if_no_value": 0, 
@@ -535,6 +647,35 @@
    "bold": 0, 
    "collapsible": 0, 
    "columns": 0, 
+   "fieldname": "scrap_material_cost", 
+   "fieldtype": "Currency", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Scrap Material Cost", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "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_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "cb1", 
    "fieldtype": "Column Break", 
    "hidden": 0, 
@@ -561,6 +702,120 @@
    "bold": 0, 
    "collapsible": 0, 
    "columns": 0, 
+   "fieldname": "base_operating_cost", 
+   "fieldtype": "Currency", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Operating Cost (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_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "base_raw_material_cost", 
+   "fieldtype": "Currency", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Raw Material Cost(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_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "base_scrap_material_cost", 
+   "fieldtype": "Data", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Scrap Material Cost(Company Currency)", 
+   "length": 0, 
+   "no_copy": 1, 
+   "options": "Company:company:default_currency", 
+   "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_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "total_cost_of_bom", 
+   "fieldtype": "Section Break", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 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_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "total_cost", 
    "fieldtype": "Currency", 
    "hidden": 0, 
@@ -572,7 +827,7 @@
    "label": "Total Cost", 
    "length": 0, 
    "no_copy": 0, 
-   "options": "Company:company:default_currency", 
+   "options": "currency", 
    "permlevel": 0, 
    "print_hide": 0, 
    "print_hide_if_no_value": 0, 
@@ -589,6 +844,62 @@
    "bold": 0, 
    "collapsible": 0, 
    "columns": 0, 
+   "fieldname": "column_break_26", 
+   "fieldtype": "Column Break", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 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_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "base_total_cost", 
+   "fieldtype": "Currency", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Total Cost(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_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "more_info_section", 
    "fieldtype": "Section Break", 
    "hidden": 0, 
@@ -960,8 +1271,8 @@
  "issingle": 0, 
  "istable": 0, 
  "max_attachments": 0, 
- "modified": "2016-11-07 05:13:12.904755", 
- "modified_by": "Administrator", 
+ "modified": "2016-11-21 17:06:49.349654", 
+ "modified_by": "rohit@erpnext.com", 
  "module": "Manufacturing", 
  "name": "BOM", 
  "owner": "Administrator", 
@@ -969,6 +1280,27 @@
   {
    "amend": 0, 
    "apply_user_permissions": 0, 
+   "cancel": 0, 
+   "create": 1, 
+   "delete": 1, 
+   "email": 1, 
+   "export": 1, 
+   "if_owner": 0, 
+   "import": 0, 
+   "is_custom": 0, 
+   "permlevel": 0, 
+   "print": 1, 
+   "read": 1, 
+   "report": 1, 
+   "role": "All", 
+   "set_user_permissions": 0, 
+   "share": 1, 
+   "submit": 0, 
+   "write": 1
+  }, 
+  {
+   "amend": 0, 
+   "apply_user_permissions": 0, 
    "cancel": 1, 
    "create": 1, 
    "delete": 1, 
@@ -1016,4 +1348,4 @@
  "sort_field": "modified", 
  "sort_order": "DESC", 
  "track_seen": 0
-}
+}
\ No newline at end of file
diff --git a/erpnext/manufacturing/doctype/bom/bom.py b/erpnext/manufacturing/doctype/bom/bom.py
index c6a3f1f..2a27922 100644
--- a/erpnext/manufacturing/doctype/bom/bom.py
+++ b/erpnext/manufacturing/doctype/bom/bom.py
@@ -5,6 +5,7 @@
 import frappe
 from frappe.utils import cint, cstr, flt
 from frappe import _
+from erpnext.setup.utils import get_exchange_rate
 from frappe.model.document import Document
 
 from operator import itemgetter
@@ -35,6 +36,8 @@
 	def validate(self):
 		self.clear_operations()
 		self.validate_main_item()
+		self.validate_currency()
+		self.set_conversion_rate()
 
 		from erpnext.utilities.transaction_base import validate_uom_is_integer
 		validate_uom_is_integer(self, "stock_uom", "qty", "BOM Item")
@@ -84,6 +87,8 @@
 			for r in ret:
 				if not item.get(r):
 					item.set(r, ret[r])
+					
+			self.validate_bom_currecny(item)
 
 	def get_bom_material_detail(self, args=None):
 		""" Get raw material details like uom, desc and rate"""
@@ -102,19 +107,27 @@
 
 		rate = self.get_rm_rate(args)
 		ret_item = {
-			'item_name'	: item and args['item_name'] or '',
-			'description'  : item and args['description'] or '',
-			'image'		: item and args['image'] or '',
-			'stock_uom'	: item and args['stock_uom'] or '',
-			'bom_no'	: args['bom_no'],
-			'rate'		: rate
+			 'item_name'	: item and args['item_name'] or '',
+			 'description'  : item and args['description'] or '',
+			 'image'		: item and args['image'] or '',
+			 'stock_uom'	: item and args['stock_uom'] or '',
+			 'bom_no'		: args['bom_no'],
+			 'rate'			: rate,
+			 'base_rate'	: rate if self.company_currency() == self.currency else rate * self.conversion_rate
 		}
 		return ret_item
 
+	def validate_bom_currecny(self, item):
+		if item.get('bom_no') and frappe.db.get_value('BOM', item.get('bom_no'), 'currency') != self.currency:
+			frappe.throw(_("Row {0}: Currency of the BOM #{1} should be equal to the selected currency {2}").format(item.idx, item.bom_no, self.currency))
+
 	def get_rm_rate(self, arg):
 		"""	Get raw material rate as per selected method, if bom exists takes bom cost """
 		rate = 0
-		if arg['bom_no']:
+
+		if arg.get('scrap_items'):
+			rate = self.get_valuation_rate(arg)
+		elif arg['bom_no']:
 			rate = self.get_bom_unitcost(arg['bom_no'])
 		elif arg:
 			if self.rm_cost_as_per == 'Valuation Rate':
@@ -209,6 +222,14 @@
 
 		if not self.quantity:
 			frappe.throw(_("Quantity should be greater than 0"))
+			
+	def validate_currency(self):
+		if self.rm_cost_as_per == 'Price List' and \
+			frappe.db.get_value('Price List', self.buying_price_list, 'currency') != self.currency:
+			frappe.throw(_("Currency of the price list {0} is not similar with the selected currency {1}").format(self.buying_price_list, self.currency))
+
+	def set_conversion_rate(self):
+		self.conversion_rate = get_exchange_rate(self.currency, self.company_currency())
 
 	def validate_materials(self):
 		""" Validate raw material entries """
@@ -270,11 +291,14 @@
 		"""Calculate bom totals"""
 		self.calculate_op_cost()
 		self.calculate_rm_cost()
-		self.total_cost = self.operating_cost + self.raw_material_cost
+		self.calculate_sm_cost()
+		self.total_cost = self.operating_cost + self.raw_material_cost - self.scrap_material_cost
+		self.base_total_cost = self.base_operating_cost + self.base_raw_material_cost - self.base_scrap_material_cost
 
 	def calculate_op_cost(self):
 		"""Update workstation rate and calculates totals"""
 		self.operating_cost = 0
+		self.base_operating_cost = 0
 		for d in self.get('operations'):
 			if d.workstation:
 				if not d.hour_rate:
@@ -282,20 +306,45 @@
 
 			if d.hour_rate and d.time_in_mins:
 				d.operating_cost = flt(d.hour_rate) * flt(d.time_in_mins) / 60.0
+				d.base_hour_rate = flt(d.hour_rate) * flt(self.conversion_rate)
+				d.base_operating_cost = flt(d.base_hour_rate) * flt(d.time_in_mins) / 60.0
 
 			self.operating_cost += flt(d.operating_cost)
+			self.base_operating_cost += flt(d.base_operating_cost)
 
 	def calculate_rm_cost(self):
 		"""Fetch RM rate as per today's valuation rate and calculate totals"""
 		total_rm_cost = 0
+		base_total_rm_cost = 0
+
 		for d in self.get('items'):
 			if d.bom_no:
 				d.rate = self.get_bom_unitcost(d.bom_no)
+				
+			d.base_rate = d.rate * self.conversion_rate
 			d.amount = flt(d.rate, self.precision("rate", d)) * flt(d.qty, self.precision("qty", d))
+			d.base_amount = d.amount * self.conversion_rate
 			d.qty_consumed_per_unit = flt(d.qty, self.precision("qty", d)) / flt(self.quantity, self.precision("quantity"))
 			total_rm_cost += d.amount
+			base_total_rm_cost += d.base_amount
 
 		self.raw_material_cost = total_rm_cost
+		self.base_raw_material_cost = base_total_rm_cost
+
+	def calculate_sm_cost(self):
+		"""Fetch RM rate as per today's valuation rate and calculate totals"""
+		total_sm_cost = 0
+		base_total_sm_cost = 0
+
+		for d in self.get('scrap_items'):
+			d.base_rate = d.rate * self.conversion_rate
+			d.amount = flt(d.rate, self.precision("rate", d)) * flt(d.qty, self.precision("qty", d))
+			d.base_amount = d.amount * self.conversion_rate
+			total_sm_cost += d.amount
+			base_total_sm_cost += d.base_amount
+
+		self.scrap_material_cost = total_sm_cost
+		self.base_scrap_material_cost = base_total_sm_cost
 
 	def update_exploded_items(self):
 		""" Update Flat BOM, following will be correct data"""
@@ -316,8 +365,11 @@
 					'image'			: d.image,
 					'stock_uom'		: d.stock_uom,
 					'qty'			: flt(d.qty),
-					'rate'			: flt(d.rate),
+					'rate'			: d.base_rate,
 				}))
+				
+	def company_currency(self):
+		return frappe.db.get_value('Company', self.company, 'default_currency')
 
 	def add_to_cur_exploded_items(self, args):
 		if self.cur_exploded_items.get(args.item_code):
diff --git a/erpnext/manufacturing/doctype/bom/test_records.json b/erpnext/manufacturing/doctype/bom/test_records.json
index da8d67b..5baa0cb 100644
--- a/erpnext/manufacturing/doctype/bom/test_records.json
+++ b/erpnext/manufacturing/doctype/bom/test_records.json
@@ -22,6 +22,7 @@
   ],
   "docstatus": 1,
   "doctype": "BOM",
+  "currency": "USD",
   "is_active": 1,
   "is_default": 1,
   "item": "_Test Item Home Desktop Manufactured",
@@ -63,6 +64,7 @@
   "doctype": "BOM",
   "is_active": 1,
   "is_default": 1,
+  "currency": "USD",
   "item": "_Test FG Item",
   "quantity": 1.0
  },
@@ -101,6 +103,7 @@
   "doctype": "BOM",
   "is_active": 1,
   "is_default": 1,
+  "currency": "USD",
   "item": "_Test FG Item 2",
   "quantity": 1.0,
   "with_operations": 1
@@ -130,6 +133,7 @@
   "doctype": "BOM",
   "is_active": 1,
   "is_default": 1,
+  "currency": "USD",
   "item": "_Test Variant Item",
   "quantity": 1.0,
   "with_operations": 1
diff --git a/erpnext/manufacturing/doctype/bom_item/bom_item.json b/erpnext/manufacturing/doctype/bom_item/bom_item.json
index d485abc..bb55c73 100644
--- a/erpnext/manufacturing/doctype/bom_item/bom_item.json
+++ b/erpnext/manufacturing/doctype/bom_item/bom_item.json
@@ -7,6 +7,7 @@
  "custom": 0, 
  "docstatus": 0, 
  "doctype": "DocType", 
+ "document_type": "Setup", 
  "editable_grid": 1, 
  "fields": [
   {
@@ -317,7 +318,7 @@
    "label": "Rate", 
    "length": 0, 
    "no_copy": 0, 
-   "options": "Company:company:default_currency", 
+   "options": "currency", 
    "permlevel": 0, 
    "print_hide": 0, 
    "print_hide_if_no_value": 0, 
@@ -333,6 +334,36 @@
    "bold": 0, 
    "collapsible": 0, 
    "columns": 0, 
+   "fieldname": "amount", 
+   "fieldtype": "Currency", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_list_view": 1, 
+   "label": "Amount", 
+   "length": 0, 
+   "no_copy": 0, 
+   "oldfieldname": "amount_as_per_mar", 
+   "oldfieldtype": "Currency", 
+   "options": "currency", 
+   "permlevel": 0, 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "print_width": "150px", 
+   "read_only": 1, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0, 
+   "width": "150px"
+  }, 
+  {
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "col_break2", 
    "fieldtype": "Column Break", 
    "hidden": 0, 
@@ -385,30 +416,79 @@
    "bold": 0, 
    "collapsible": 0, 
    "columns": 0, 
-   "fieldname": "amount", 
+   "fieldname": "base_rate", 
    "fieldtype": "Currency", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
-   "in_list_view": 1, 
-   "label": "Amount", 
+   "in_list_view": 0, 
+   "label": "Basic Rate (Company Currency)", 
    "length": 0, 
    "no_copy": 0, 
-   "oldfieldname": "amount_as_per_mar", 
-   "oldfieldtype": "Currency", 
    "options": "Company:company:default_currency", 
    "permlevel": 0, 
-   "print_hide": 0, 
+   "precision": "", 
+   "print_hide": 1, 
    "print_hide_if_no_value": 0, 
-   "print_width": "150px", 
    "read_only": 1, 
    "report_hide": 0, 
    "reqd": 0, 
    "search_index": 0, 
    "set_only_once": 0, 
-   "unique": 0, 
-   "width": "150px"
+   "unique": 0
+  }, 
+  {
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "base_amount", 
+   "fieldtype": "Currency", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "label": "Amount (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, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "section_break_18", 
+   "fieldtype": "Section Break", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
   }, 
   {
    "allow_on_submit": 0, 
@@ -475,7 +555,7 @@
  "issingle": 0, 
  "istable": 1, 
  "max_attachments": 0, 
- "modified": "2016-08-26 02:42:40.468812", 
+ "modified": "2016-10-21 15:57:22.521537", 
  "modified_by": "Administrator", 
  "module": "Manufacturing", 
  "name": "BOM Item", 
diff --git a/erpnext/manufacturing/doctype/bom_operation/bom_operation.json b/erpnext/manufacturing/doctype/bom_operation/bom_operation.json
index 8b6406e..50f1c6c 100644
--- a/erpnext/manufacturing/doctype/bom_operation/bom_operation.json
+++ b/erpnext/manufacturing/doctype/bom_operation/bom_operation.json
@@ -9,11 +9,13 @@
  "doctype": "DocType", 
  "document_type": "Setup", 
  "editable_grid": 1, 
+ "engine": "InnoDB", 
  "fields": [
   {
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "operation", 
    "fieldtype": "Link", 
    "hidden": 0, 
@@ -41,6 +43,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "workstation", 
    "fieldtype": "Link", 
    "hidden": 0, 
@@ -68,6 +71,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "description", 
    "fieldtype": "Text Editor", 
    "hidden": 0, 
@@ -94,6 +98,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "col_break1", 
    "fieldtype": "Column Break", 
    "hidden": 0, 
@@ -117,8 +122,9 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "hour_rate", 
-   "fieldtype": "Float", 
+   "fieldtype": "Currency", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
    "ignore_xss_filter": 0, 
@@ -129,6 +135,7 @@
    "no_copy": 0, 
    "oldfieldname": "hour_rate", 
    "oldfieldtype": "Currency", 
+   "options": "currency", 
    "permlevel": 0, 
    "print_hide": 0, 
    "print_hide_if_no_value": 0, 
@@ -143,6 +150,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "description": "In minutes", 
    "fieldname": "time_in_mins", 
    "fieldtype": "Float", 
@@ -171,6 +179,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "operating_cost", 
    "fieldtype": "Currency", 
    "hidden": 0, 
@@ -183,6 +192,7 @@
    "no_copy": 0, 
    "oldfieldname": "operating_cost", 
    "oldfieldtype": "Currency", 
+   "options": "currency", 
    "permlevel": 0, 
    "print_hide": 0, 
    "print_hide_if_no_value": 0, 
@@ -192,6 +202,61 @@
    "search_index": 0, 
    "set_only_once": 0, 
    "unique": 0
+  }, 
+  {
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "base_hour_rate", 
+   "fieldtype": "Currency", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "label": "Base Hour Rate(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, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "default": "5", 
+   "fieldname": "base_operating_cost", 
+   "fieldtype": "Currency", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "label": "Operating Cost(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, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
   }
  ], 
  "hide_heading": 0, 
@@ -204,7 +269,7 @@
  "issingle": 0, 
  "istable": 1, 
  "max_attachments": 0, 
- "modified": "2016-07-11 03:27:58.625909", 
+ "modified": "2016-10-21 18:38:14.700637", 
  "modified_by": "Administrator", 
  "module": "Manufacturing", 
  "name": "BOM Operation", 
diff --git a/erpnext/manufacturing/doctype/bom_scrap_item/bom_scrap_item.json b/erpnext/manufacturing/doctype/bom_scrap_item/bom_scrap_item.json
index ea5e6c1..fe81592 100644
--- a/erpnext/manufacturing/doctype/bom_scrap_item/bom_scrap_item.json
+++ b/erpnext/manufacturing/doctype/bom_scrap_item/bom_scrap_item.json
@@ -130,7 +130,7 @@
    "label": "Rate", 
    "length": 0, 
    "no_copy": 0, 
-   "options": "Company:company:default_currency", 
+   "options": "currency", 
    "permlevel": 0, 
    "precision": "", 
    "print_hide": 0, 
@@ -147,6 +147,33 @@
    "bold": 0, 
    "collapsible": 0, 
    "columns": 0, 
+   "fieldname": "amount", 
+   "fieldtype": "Currency", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "label": "Amount", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "currency", 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 1, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "column_break_6", 
    "fieldtype": "Column Break", 
    "hidden": 0, 
@@ -199,20 +226,47 @@
    "bold": 0, 
    "collapsible": 0, 
    "columns": 0, 
-   "fieldname": "amount", 
+   "fieldname": "base_rate", 
    "fieldtype": "Currency", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
-   "label": "Amount", 
+   "label": "Basic Rate (Company Currency)", 
    "length": 0, 
    "no_copy": 0, 
    "options": "Company:company:default_currency", 
    "permlevel": 0, 
    "precision": "", 
-   "print_hide": 0, 
+   "print_hide": 1, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 1, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "base_amount", 
+   "fieldtype": "Currency", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "label": "Basic Amount (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, 
    "report_hide": 0, 
@@ -232,7 +286,7 @@
  "issingle": 0, 
  "istable": 1, 
  "max_attachments": 0, 
- "modified": "2016-09-26 02:58:58.433348", 
+ "modified": "2016-10-25 00:27:53.712140", 
  "modified_by": "Administrator", 
  "module": "Manufacturing", 
  "name": "BOM Scrap Item", 
diff --git a/erpnext/manufacturing/doctype/production_order/production_order.py b/erpnext/manufacturing/doctype/production_order/production_order.py
index 7d0405b..aa69342 100644
--- a/erpnext/manufacturing/doctype/production_order/production_order.py
+++ b/erpnext/manufacturing/doctype/production_order/production_order.py
@@ -217,7 +217,7 @@
 			return
 		self.set('operations', [])
 		operations = frappe.db.sql("""select operation, description, workstation, idx,
-			hour_rate, time_in_mins, "Pending" as status from `tabBOM Operation`
+			base_hour_rate as hour_rate, time_in_mins, "Pending" as status from `tabBOM Operation`
 			where parent = %s order by idx""", self.bom_no, as_dict=1)
 		self.set('operations', operations)
 		self.calculate_time()
@@ -466,6 +466,9 @@
 		if variant_of:
 			res["bom_no"] = frappe.db.get_value("BOM", filters={"item": variant_of, "is_default": 1})
 
+	if not res["bom_no"]:
+		frappe.throw(_("Default BOM for {0} not found").format(item))
+
 	res.update(check_if_scrap_warehouse_mandatory(res["bom_no"]))
 
 	return res
diff --git a/erpnext/manufacturing/doctype/production_planning_tool/production_planning_tool.py b/erpnext/manufacturing/doctype/production_planning_tool/production_planning_tool.py
index 3433f1f..aaa0e95 100644
--- a/erpnext/manufacturing/doctype/production_planning_tool/production_planning_tool.py
+++ b/erpnext/manufacturing/doctype/production_planning_tool/production_planning_tool.py
@@ -486,7 +486,9 @@
 						"qty": requested_qty,
 						"schedule_date": add_days(nowdate(), cint(item_wrapper.lead_time_days)),
 						"warehouse": self.purchase_request_for_warehouse,
-						"sales_order": sales_order if sales_order!="No Sales Order" else None
+						"sales_order": sales_order if sales_order!="No Sales Order" else None,
+						"project": frappe.db.get_value("Sales Order", sales_order, "project") \
+							if sales_order!="No Sales Order" else None
 					})
 
 				material_request.flags.ignore_permissions = 1
diff --git a/erpnext/manufacturing/doctype/workstation/workstation.js b/erpnext/manufacturing/doctype/workstation/workstation.js
index 153d7e5..ba8e30c 100644
--- a/erpnext/manufacturing/doctype/workstation/workstation.js
+++ b/erpnext/manufacturing/doctype/workstation/workstation.js
@@ -1,17 +1,19 @@
 // Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
 // License: GNU General Public License v3. See license.txt
 
-
-
-//--------- ONLOAD -------------
-cur_frm.cscript.onload = function(doc, cdt, cdn) {
-	frappe.call({
-		type:"GET",
-		method:"erpnext.manufacturing.doctype.workstation.workstation.get_default_holiday_list",
-		callback: function(r) {
-			if(!r.exe && r.message){
-				cur_frm.set_value("holiday_list", r.message);
-			}
+frappe.ui.form.on("Workstation", {
+	onload: function(frm) {
+		if(frm.is_new())
+		{
+			frappe.call({
+				type:"GET",
+				method:"erpnext.manufacturing.doctype.workstation.workstation.get_default_holiday_list",
+				callback: function(r) {
+					if(!r.exe && r.message){
+						cur_frm.set_value("holiday_list", r.message);
+					}
+				}
+			})
 		}
-	})
-}
+	}
+})
\ No newline at end of file
diff --git a/erpnext/manufacturing/doctype/workstation/workstation.py b/erpnext/manufacturing/doctype/workstation/workstation.py
index b939803..5095784 100644
--- a/erpnext/manufacturing/doctype/workstation/workstation.py
+++ b/erpnext/manufacturing/doctype/workstation/workstation.py
@@ -60,9 +60,10 @@
 	workstation = frappe.get_doc("Workstation", workstation)
 
 	for working_hour in workstation.working_hours:
-		slot_length = (to_timedelta(working_hour.end_time or "") - to_timedelta(working_hour.start_time or "")).total_seconds()
-		if slot_length >= operation_length:
-			return
+		if working_hour.start_time and working_hour.end_time:
+			slot_length = (to_timedelta(working_hour.end_time or "") - to_timedelta(working_hour.start_time or "")).total_seconds()
+			if slot_length >= operation_length:
+				return
 
 	frappe.throw(_("Operation {0} longer than any available working hours in workstation {1}, break down the operation into multiple operations").format(operation, workstation.name), NotInWorkingHoursError)
 
diff --git a/erpnext/patches.txt b/erpnext/patches.txt
index 03ad708..1ab2dd0 100644
--- a/erpnext/patches.txt
+++ b/erpnext/patches.txt
@@ -349,4 +349,7 @@
 erpnext.patches.v7_0.set_base_amount_in_invoice_payment_table
 erpnext.patches.v7_1.update_invoice_status
 erpnext.patches.v7_0.po_status_issue_for_pr_return
-erpnext.patches.v7_1.update_missing_salary_component_type
\ No newline at end of file
+erpnext.patches.v7_1.update_missing_salary_component_type
+erpnext.patches.v7_1.rename_quality_inspection_field
+erpnext.patches.v7_0.update_autoname_field
+erpnext.patches.v7_1.update_bom_base_currency
diff --git a/erpnext/patches/v7_0/fix_duplicate_icons.py b/erpnext/patches/v7_0/fix_duplicate_icons.py
index 3e762f7..f6d227d 100644
--- a/erpnext/patches/v7_0/fix_duplicate_icons.py
+++ b/erpnext/patches/v7_0/fix_duplicate_icons.py
@@ -6,6 +6,8 @@
 
 def execute():
 	'''hide new style icons if old ones are set'''
+	frappe.reload_doc('desk', 'doctype', 'desktop_icon')
+
 	reload_doctypes_for_schools_icons()
 
 	sync_desktop_icons()
diff --git a/erpnext/patches/v7_0/repost_gle_for_pi_with_update_stock.py b/erpnext/patches/v7_0/repost_gle_for_pi_with_update_stock.py
index 2883a8a..9f159be 100644
--- a/erpnext/patches/v7_0/repost_gle_for_pi_with_update_stock.py
+++ b/erpnext/patches/v7_0/repost_gle_for_pi_with_update_stock.py
@@ -9,6 +9,8 @@
 	if not cint(frappe.defaults.get_global_default("auto_accounting_for_stock")):
 		return
 
+	frappe.reload_doctype("Purchase Invoice")
+
 	for pi in frappe.db.sql("""select name from `tabPurchase Invoice` 
 		where update_stock=1 and docstatus=1  order by posting_date asc""", as_dict=1):
 		
diff --git a/erpnext/patches/v7_0/update_autoname_field.py b/erpnext/patches/v7_0/update_autoname_field.py
new file mode 100644
index 0000000..bfa9b28
--- /dev/null
+++ b/erpnext/patches/v7_0/update_autoname_field.py
@@ -0,0 +1,14 @@
+# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
+# License: GNU General Public License v3. See license.txt
+
+from __future__ import unicode_literals
+import frappe
+
+def execute():
+	doctypes = frappe.db.sql(""" select name, autoname from `tabDocType`
+		where autoname like 'field:%' and allow_rename = 1""", as_dict=1)
+
+	for doctype in doctypes:
+		fieldname = doctype.autoname.split(":")[1]
+		if fieldname:
+			frappe.db.sql(""" update `tab%s` set %s = name """%(doctype.name, fieldname))
\ No newline at end of file
diff --git a/erpnext/patches/v7_1/rename_quality_inspection_field.py b/erpnext/patches/v7_1/rename_quality_inspection_field.py
new file mode 100644
index 0000000..3b5a7d9
--- /dev/null
+++ b/erpnext/patches/v7_1/rename_quality_inspection_field.py
@@ -0,0 +1,38 @@
+from __future__ import unicode_literals
+import frappe
+from frappe.model.utils.rename_field import *
+
+def execute():
+	for doctype in ("Purchase Receipt Item", "Delivery Note Item"):
+		frappe.reload_doctype(doctype)
+
+		table_columns = frappe.db.get_table_columns(doctype)
+		if "qa_no" in table_columns:
+			rename_field(doctype, "qa_no", "quality_inspection")
+
+	frappe.reload_doctype("Item")
+	rename_field("Item", "inspection_required", "inspection_required_before_purchase")
+
+	frappe.reload_doc('stock', 'doctype', 'quality_inspection')
+	frappe.db.sql("""
+		update
+			`tabQuality Inspection`
+		set
+			reference_type = 'Purchase Receipt', reference_name = purchase_receipt_no
+		where
+			ifnull(purchase_receipt_no, '') != '' and inspection_type = 'Incoming'
+	""")
+
+	frappe.db.sql("""
+		update
+			`tabQuality Inspection`
+		set
+			reference_type = 'Delivery Note', reference_name = delivery_note_no
+		where
+			ifnull(delivery_note_no, '') != '' and inspection_type = 'Outgoing'
+	""")
+
+	for old_fieldname in ["purchase_receipt_no", "delivery_note_no"]:
+		update_reports("Quality Inspection", old_fieldname, "reference_name")
+		update_users_report_view_settings("Quality Inspection", old_fieldname, "reference_name")
+		update_property_setters("Quality Inspection", old_fieldname, "reference_name")
diff --git a/erpnext/patches/v7_1/update_bom_base_currency.py b/erpnext/patches/v7_1/update_bom_base_currency.py
new file mode 100644
index 0000000..c8af033
--- /dev/null
+++ b/erpnext/patches/v7_1/update_bom_base_currency.py
@@ -0,0 +1,19 @@
+import frappe
+from erpnext import get_default_currency
+
+def execute():
+	frappe.reload_doc("manufacturing", "doctype", "bom")
+	frappe.reload_doc("manufacturing", "doctype", "bom_item")
+	frappe.reload_doc("manufacturing", "doctype", "bom_explosion_item")
+	frappe.reload_doc("manufacturing", "doctype", "bom_operation")
+	frappe.reload_doc("manufacturing", "doctype", "bom_scrap_item")
+
+	frappe.db.sql(""" update `tabBOM Operation` set base_hour_rate = hour_rate,
+		base_operating_cost = operating_cost """)
+
+	frappe.db.sql(""" update `tabBOM Item` set base_rate = rate, base_amount = amount """)
+	frappe.db.sql(""" update `tabBOM Scrap Item` set base_rate = rate, base_amount = amount """)
+
+	frappe.db.sql(""" update `tabBOM` set `tabBOM`.base_operating_cost = `tabBOM`.operating_cost, 
+		`tabBOM`.base_raw_material_cost = `tabBOM`.raw_material_cost,
+		`tabBOM`.currency = (select default_currency from `tabCompany` where name = `tabBOM`.company)""")
diff --git a/erpnext/projects/doctype/timesheet/timesheet.json b/erpnext/projects/doctype/timesheet/timesheet.json
index 751b793..baad029 100644
--- a/erpnext/projects/doctype/timesheet/timesheet.json
+++ b/erpnext/projects/doctype/timesheet/timesheet.json
@@ -6,7 +6,7 @@
  "beta": 0, 
  "creation": "2013-02-28 17:57:33", 
  "custom": 0, 
- "description": "Batch Time Logs for Billing.", 
+ "description": "", 
  "docstatus": 0, 
  "doctype": "DocType", 
  "document_type": "Document", 
@@ -220,7 +220,7 @@
    "collapsible": 0, 
    "columns": 0, 
    "depends_on": "", 
-   "description": "List of employee which has \"Salary Slip Based on Timesheet\" is enabled in salary structure.", 
+   "description": "", 
    "fieldname": "employee", 
    "fieldtype": "Link", 
    "hidden": 0, 
@@ -877,7 +877,7 @@
  "issingle": 0, 
  "istable": 0, 
  "max_attachments": 0, 
- "modified": "2016-11-07 06:00:12.460318", 
+ "modified": "2016-11-23 17:35:51.194690", 
  "modified_by": "Administrator", 
  "module": "Projects", 
  "name": "Timesheet", 
diff --git a/erpnext/public/js/controllers/transaction.js b/erpnext/public/js/controllers/transaction.js
index aa20e79..6c03706 100644
--- a/erpnext/public/js/controllers/transaction.js
+++ b/erpnext/public/js/controllers/transaction.js
@@ -79,11 +79,9 @@
 
 			frm.cscript.calculate_taxes_and_totals();
 		});
-
 	},
 	onload: function() {
 		var me = this;
-		//this.frm.show_print_first = true;
 		if(this.frm.doc.__islocal) {
 			var today = get_today(),
 				currency = frappe.defaults.get_user_default("currency");
@@ -136,7 +134,42 @@
 				}
 			});
 		}
+		
+		this.setup_quality_inspection();
+	},
 
+	setup_quality_inspection: function() {
+		if(!in_list(["Delivery Note", "Sales Invoice", "Purchase Receipt", "Purchase Invoice"], this.frm.doc.doctype)) {
+			return;
+		}
+		var me = this;
+		var inspection_type = in_list(["Purchase Receipt", "Purchase Invoice"], this.frm.doc.doctype) 
+			? "Incoming" : "Outgoing";
+			
+		var quality_inspection_field = this.frm.get_docfield("items", "quality_inspection");
+		quality_inspection_field.get_route_options_for_new_doc = function(row) {
+			if(me.frm.is_new()) return;
+			return {
+				"inspection_type": inspection_type,
+				"reference_type": me.frm.doc.doctype,
+				"reference_name": me.frm.doc.name,
+				"item_code": row.doc.item_code,
+				"description": row.doc.description,
+				"item_serial_no": row.doc.serial_no ? row.doc.serial_no.split("\n")[0] : null,
+				"batch_no": row.doc.batch_no
+			}
+		}
+		
+		this.frm.set_query("quality_inspection", "items", function(doc, cdt, cdn) {
+			var d = locals[cdt][cdn];
+			return {
+				filters: {
+					docstatus: 1,
+					inspection_type: inspection_type,
+					item_code: d.item_code
+				}
+			}
+		});
 	},
 
 	onload_post_render: function() {
@@ -517,28 +550,20 @@
 
 	change_form_labels: function(company_currency) {
 		var me = this;
-		var field_label_map = {};
 
-		var setup_field_label_map = function(fields_list, currency) {
-			$.each(fields_list, function(i, fname) {
-				var docfield = frappe.meta.docfield_map[me.frm.doc.doctype][fname];
-				if(docfield) {
-					var label = __(docfield.label || "").replace(/\([^\)]*\)/g, "");
-					field_label_map[fname] = label.trim() + " (" + currency + ")";
-				}
-			});
-		};
-		setup_field_label_map(["base_total", "base_net_total", "base_total_taxes_and_charges",
+		this.frm.set_currency_labels(["base_total", "base_net_total", "base_total_taxes_and_charges",
 			"base_discount_amount", "base_grand_total", "base_rounded_total", "base_in_words",
 			"base_taxes_and_charges_added", "base_taxes_and_charges_deducted", "total_amount_to_pay",
-			"base_paid_amount", "base_write_off_amount", "base_change_amount"
+			"base_paid_amount", "base_write_off_amount", "base_change_amount", "base_operating_cost", 
+			"base_raw_material_cost", "base_total_cost", "base_scrap_material_cost"
 		], company_currency);
 
-		setup_field_label_map(["total", "net_total", "total_taxes_and_charges", "discount_amount",
+		this.frm.set_currency_labels(["total", "net_total", "total_taxes_and_charges", "discount_amount",
 			"grand_total", "taxes_and_charges_added", "taxes_and_charges_deducted",
-			"rounded_total", "in_words", "paid_amount", "write_off_amount"], this.frm.doc.currency);
+			"rounded_total", "in_words", "paid_amount", "write_off_amount", "operating_cost", "scrap_material_cost",
+			"raw_material_cost", "total_cost"], this.frm.doc.currency);
 
-		setup_field_label_map(["outstanding_amount", "total_advance"], this.frm.doc.party_account_currency);
+		this.frm.set_currency_labels(["outstanding_amount", "total_advance"], this.frm.doc.party_account_currency);
 
 		cur_frm.set_df_property("conversion_rate", "description", "1 " + this.frm.doc.currency
 			+ " = [?] " + company_currency)
@@ -552,17 +577,13 @@
 		this.frm.toggle_display(["conversion_rate", "base_total", "base_net_total", "base_total_taxes_and_charges",
 			"base_taxes_and_charges_added", "base_taxes_and_charges_deducted",
 			"base_grand_total", "base_rounded_total", "base_in_words", "base_discount_amount",
-			"base_paid_amount", "base_write_off_amount"],
+			"base_paid_amount", "base_write_off_amount", "base_operating_cost", 
+			"base_raw_material_cost", "base_total_cost", "base_scrap_material_cost"],
 			this.frm.doc.currency != company_currency);
 
 		this.frm.toggle_display(["plc_conversion_rate", "price_list_currency"],
 			this.frm.doc.price_list_currency != company_currency);
 
-		// set labels
-		$.each(field_label_map, function(fname, label) {
-			me.frm.fields_dict[fname].set_label(label);
-		});
-
 		var show =cint(cur_frm.doc.discount_amount) ||
 				((cur_frm.doc.taxes || []).filter(function(d) {return d.included_in_print_rate===1}).length);
 
@@ -576,34 +597,43 @@
 
 	change_grid_labels: function(company_currency) {
 		var me = this;
-		var field_label_map = {};
 
-		var setup_field_label_map = function(fields_list, currency, parentfield) {
-			var grid_doctype = me.frm.fields_dict[parentfield].grid.doctype;
-			$.each(fields_list, function(i, fname) {
-				var docfield = frappe.meta.docfield_map[grid_doctype][fname];
-				if(docfield) {
-					var label = __(docfield.label || "").replace(/\([^\)]*\)/g, "");
-					field_label_map[grid_doctype + "-" + fname] =
-						label.trim() + " (" + __(currency) + ")";
-				}
+		this.frm.set_currency_labels(["base_rate", "base_net_rate", "base_price_list_rate", "base_amount", "base_net_amount"],
+			company_currency, "items");
+
+		this.frm.set_currency_labels(["rate", "net_rate", "price_list_rate", "amount", "net_amount"],
+			this.frm.doc.currency, "items");
+
+		if(this.frm.fields_dict["operations"]) {
+			this.frm.set_currency_labels(["operating_cost", "hour_rate"], this.frm.doc.currency, "operations");
+			this.frm.set_currency_labels(["base_operating_cost", "base_hour_rate"], company_currency, "operations");
+
+			var item_grid = this.frm.fields_dict["operations"].grid;
+			$.each(["base_operating_cost", "base_hour_rate"], function(i, fname) {
+				if(frappe.meta.get_docfield(item_grid.doctype, fname))
+					item_grid.set_column_disp(fname, me.frm.doc.currency != company_currency);
 			});
 		}
 
-		setup_field_label_map(["base_rate", "base_net_rate", "base_price_list_rate", "base_amount", "base_net_amount"],
-			company_currency, "items");
+		if(this.frm.fields_dict["scrap_items"]) {
+			this.frm.set_currency_labels(["rate", "amount"], this.frm.doc.currency, "scrap_items");
+			this.frm.set_currency_labels(["base_rate", "base_amount"], company_currency, "scrap_items");
 
-		setup_field_label_map(["rate", "net_rate", "price_list_rate", "amount", "net_amount"],
-			this.frm.doc.currency, "items");
+			var item_grid = this.frm.fields_dict["scrap_items"].grid;
+			$.each(["base_rate", "base_amount"], function(i, fname) {
+				if(frappe.meta.get_docfield(item_grid.doctype, fname))
+					item_grid.set_column_disp(fname, me.frm.doc.currency != company_currency);
+			});
+		}
 
 		if(this.frm.fields_dict["taxes"]) {
-			setup_field_label_map(["tax_amount", "total", "tax_amount_after_discount"], this.frm.doc.currency, "taxes");
+			this.frm.set_currency_labels(["tax_amount", "total", "tax_amount_after_discount"], this.frm.doc.currency, "taxes");
 
-			setup_field_label_map(["base_tax_amount", "base_total", "base_tax_amount_after_discount"], company_currency, "taxes");
+			this.frm.set_currency_labels(["base_tax_amount", "base_total", "base_tax_amount_after_discount"], company_currency, "taxes");
 		}
 
 		if(this.frm.fields_dict["advances"]) {
-			setup_field_label_map(["advance_amount", "allocated_amount"],
+			this.frm.set_currency_labels(["advance_amount", "allocated_amount"],
 				this.frm.doc.party_account_currency, "advances");
 		}
 
@@ -629,11 +659,6 @@
 
 		// set labels
 		var $wrapper = $(this.frm.wrapper);
-		$.each(field_label_map, function(fname, label) {
-			fname = fname.split("-");
-			var df = frappe.meta.get_docfield(fname[0], fname[1], me.frm.doc.name);
-			if(df) df.label = label;
-		});
 	},
 
 	recalculate: function() {
@@ -1004,5 +1029,6 @@
 		}
 
 		return method
-	}
+	},
+	
 });
\ No newline at end of file
diff --git a/erpnext/public/js/utils.js b/erpnext/public/js/utils.js
index 39e87f8..c80d418 100644
--- a/erpnext/public/js/utils.js
+++ b/erpnext/public/js/utils.js
@@ -143,8 +143,35 @@
 			if(!cur_frm.doc.items[0].item_code) {
 				cur_frm.doc.items = cur_frm.doc.items.splice(1);
 			}
+
+			// find the doctype of the items table
+			var items_doctype = frappe.meta.get_docfield(cur_frm.doctype, 'items').options;
+			
+			// find the link fieldname from items table for the given
+			// source_doctype
+			var link_fieldname = null;
+			frappe.get_meta(items_doctype).fields.forEach(function(d) { 
+				if(d.options===opts.source_doctype) link_fieldname = d.fieldname; });
+
+			// search in existing items if the source_name is already set
+			var already_set = false;
+
+			$.each(cur_frm.doc.items, function(i, d) {
+				if(d[link_fieldname]==opts.source_name) {
+					already_set = true;
+					return false;
+				}
+			});
+
+			if(already_set) {
+				frappe.msgprint(__("You have already selected items from {0} {1}", 
+					[opts.source_doctype, opts.source_name]));
+				return;
+			}
+
 		}
 
+
 		return frappe.call({
 			// Sometimes we hit the limit for URL length of a GET request
 			// as we send the full target_doc. Hence this is a POST request.
diff --git a/erpnext/schools/doctype/assessment/assessment.js b/erpnext/schools/doctype/assessment/assessment.js
index efadbd6..e842f41 100644
--- a/erpnext/schools/doctype/assessment/assessment.js
+++ b/erpnext/schools/doctype/assessment/assessment.js
@@ -6,46 +6,46 @@
 cur_frm.add_fetch("supervisor", "instructor_name", "supervisor_name");
 cur_frm.add_fetch("student", "title", "student_name");
 
-frappe.ui.form.on("Assessment" ,{
-	student_group : function(frm) {
-		frm.set_value("results" ,"");
-		if (frm.doc.student_group) {
-			frappe.call({
-				method: "erpnext.schools.api.get_student_group_students",
-				args: {
-					"student_group": frm.doc.student_group
-				},
-				callback: function(r) {
-					if (r.message) {
-						$.each(r.message, function(i, d) {
-							var row = frappe.model.add_child(cur_frm.doc, "Assessment Result", "results");
-							row.student = d.student;
-							row.student_name = d.student_name;
-						});
-					}
-					refresh_field("results");
-				}
-			});
-		}
-	}
+frappe.ui.form.on("Assessment", {
+    student_group: function(frm) {
+        frm.set_value("results", "");
+        if (frm.doc.student_group) {
+            frappe.call({
+                method: "erpnext.schools.api.get_student_group_students",
+                args: {
+                    "student_group": frm.doc.student_group
+                },
+                callback: function(r) {
+                    if (r.message) {
+                        $.each(r.message, function(i, d) {
+                            var row = frappe.model.add_child(cur_frm.doc, "Assessment Result", "results");
+                            row.student = d.student;
+                            row.student_name = d.student_name;
+                        });
+                    }
+                    refresh_field("results");
+                }
+            });
+        }
+    }
 });
 
-frappe.ui.form.on("Assessment Result" ,{
-	result : function(frm, cdt, cdn) {
-		if(frm.doc.grading_structure){
-			var assessment_result = locals[cdt][cdn];
-			frappe.call({
-				method:"erpnext.schools.doctype.assessment.assessment.get_grade",
-				args:{
-					grading_structure: frm.doc.grading_structure,
-					result: assessment_result.result
-				},
-				callback: function(r){
-					if(r.message){
-						frappe.model.set_value(cdt, cdn, 'grade', r.message);
-					}
-				}
-			});
-		}
-	}
+frappe.ui.form.on("Assessment Result", {
+    result: function(frm, cdt, cdn) {
+        if (frm.doc.grading_structure) {
+            var assessment_result = locals[cdt][cdn];
+            frappe.call({
+                method: "erpnext.schools.doctype.assessment.assessment.get_grade",
+                args: {
+                    grading_structure: frm.doc.grading_structure,
+                    result: assessment_result.result
+                },
+                callback: function(r) {
+                    if (r.message) {
+                        frappe.model.set_value(cdt, cdn, 'grade', r.message);
+                    }
+                }
+            });
+        }
+    }
 });
\ No newline at end of file
diff --git a/erpnext/schools/doctype/assessment/assessment.py b/erpnext/schools/doctype/assessment/assessment.py
index cb307cb..003b427 100644
--- a/erpnext/schools/doctype/assessment/assessment.py
+++ b/erpnext/schools/doctype/assessment/assessment.py
@@ -10,7 +10,7 @@
 class Assessment(Document):
 	def validate(self):
 		self.validate_overlap()
-	
+
 	def validate_overlap(self):
 		"""Validates overlap for Student Group/Student Batch, Instructor, Room"""
 		
diff --git a/erpnext/schools/doctype/course_schedule/course_schedule.js b/erpnext/schools/doctype/course_schedule/course_schedule.js
index ab34ae9..04a8cde 100644
--- a/erpnext/schools/doctype/course_schedule/course_schedule.js
+++ b/erpnext/schools/doctype/course_schedule/course_schedule.js
@@ -1,137 +1,134 @@
 frappe.provide("schools")
 
-frappe.ui.form.on("Course Schedule" ,{
-	onload: function(frm) {
-		if (frm.doc.from_datetime && frm.doc.to_datetime) {
-			var from_datetime = moment(frm.doc.from_datetime);
-			var to_datetime = moment(frm.doc.to_datetime);
-			frm.doc.schedule_date = from_datetime.format(moment.defaultFormat);
-			frm.doc.from_time = from_datetime.format("HH:mm:ss");
-			frm.doc.to_time = to_datetime.format("HH:mm:ss");
-		}
-	},
-	
-	refresh :function(frm) {
-		if(!frm.doc.__islocal && frm.doc.student_group) {
-			frappe.call({
-				method: "erpnext.schools.api.check_attendance_records_exist",
-				args: {
-					"course_schedule": frm.doc.name
-				},
-				callback: function(r) {
-					if(r.message) {
-						hide_field('attendance');
-						frm.events.view_attendance(frm)
-					}
-					else {
-						frappe.call({
-							method: "erpnext.schools.api.get_student_group_students",
-							args: {
-								"student_group": frm.doc.student_group
-							},
-							callback: function(r) {
-								if (r.message) {
-									frm.events.get_students(frm, r.message)
-								}
-							}
-						});
-					}
-				}
-			});
-		}
-		else {
-			hide_field('attendance');
-		}
-	},
-	
-	view_attendance: function(frm) {
-		hide_field('attendance');
-		frm.add_custom_button(__("View attendance"), function() {
-			frappe.route_options = {
-				course_schedule: frm.doc.name
-			}
-			frappe.set_route("List", "Student Attendance");
-		});
-	},
-	
-	get_students: function(frm, students) {
-		if(!frm.students_area) {
-		frm.students_area = $('<div>')
-			.appendTo(frm.fields_dict.students_html.wrapper);
-		}
-		frm.students_editor = new schools.StudentsEditor(frm, frm.students_area, students)
-	}
+frappe.ui.form.on("Course Schedule", {
+    onload: function(frm) {
+        if (frm.doc.from_datetime && frm.doc.to_datetime) {
+            var from_datetime = moment(frm.doc.from_datetime);
+            var to_datetime = moment(frm.doc.to_datetime);
+            frm.doc.schedule_date = from_datetime.format(moment.defaultFormat);
+            frm.doc.from_time = from_datetime.format("HH:mm:ss");
+            frm.doc.to_time = to_datetime.format("HH:mm:ss");
+        }
+    },
+
+    refresh: function(frm) {
+        if (!frm.doc.__islocal && frm.doc.student_group) {
+            frappe.call({
+                method: "erpnext.schools.api.check_attendance_records_exist",
+                args: {
+                    "course_schedule": frm.doc.name
+                },
+                callback: function(r) {
+                    if (r.message) {
+                        hide_field('attendance');
+                        frm.events.view_attendance(frm)
+                    } else {
+                        frappe.call({
+                            method: "erpnext.schools.api.get_student_group_students",
+                            args: {
+                                "student_group": frm.doc.student_group
+                            },
+                            callback: function(r) {
+                                if (r.message) {
+                                    frm.events.get_students(frm, r.message)
+                                }
+                            }
+                        });
+                    }
+                }
+            });
+        } else {
+            hide_field('attendance');
+        }
+    },
+
+    view_attendance: function(frm) {
+        hide_field('attendance');
+        frm.add_custom_button(__("View attendance"), function() {
+            frappe.route_options = {
+                course_schedule: frm.doc.name
+            }
+            frappe.set_route("List", "Student Attendance");
+        });
+    },
+
+    get_students: function(frm, students) {
+        if (!frm.students_area) {
+            frm.students_area = $('<div>')
+                .appendTo(frm.fields_dict.students_html.wrapper);
+        }
+        frm.students_editor = new schools.StudentsEditor(frm, frm.students_area, students)
+    }
 });
 
 
 schools.StudentsEditor = Class.extend({
-	init: function(frm, wrapper, students) {
-		this.wrapper = wrapper;
-		this.frm = frm;
-		this.make(frm, students);
-	},
-	make: function(frm, students) {
-		var me = this;
-		
-		$(this.wrapper).empty();
-		var student_toolbar = $('<p>\
+    init: function(frm, wrapper, students) {
+        this.wrapper = wrapper;
+        this.frm = frm;
+        this.make(frm, students);
+    },
+    make: function(frm, students) {
+        var me = this;
+
+        $(this.wrapper).empty();
+        var student_toolbar = $('<p>\
 			<button class="btn btn-default btn-add btn-xs" style="margin-right: 5px;"></button>\
 			<button class="btn btn-xs btn-default btn-remove" style="margin-right: 5px;"></button>\
 			<button class="btn btn-default btn-primary btn-mark-att btn-xs"></button></p>').appendTo($(this.wrapper));
 
-		student_toolbar.find(".btn-add")
-			.html(__('Check all'))
-			.on("click", function() {
-			$(me.wrapper).find('input[type="checkbox"]').each(function(i, check) {
-				if(!$(check).is(":checked")) {
-					check.checked = true;
-				}
-			});
-		});
+        student_toolbar.find(".btn-add")
+            .html(__('Check all'))
+            .on("click", function() {
+                $(me.wrapper).find('input[type="checkbox"]').each(function(i, check) {
+                    if (!$(check).is(":checked")) {
+                        check.checked = true;
+                    }
+                });
+            });
 
-		student_toolbar.find(".btn-remove")
-			.html(__('Uncheck all'))
-			.on("click", function() {
-			$(me.wrapper).find('input[type="checkbox"]').each(function(i, check) {
-				if($(check).is(":checked")) {
-					check.checked = false;
-				}
-			});
-		});
-		
-		student_toolbar.find(".btn-mark-att")
-			.html(__('Mark Attendence'))
-			.on("click", function() {
-				var students_present = [];
-				var students_absent = [];
-				$(me.wrapper).find('input[type="checkbox"]').each(function(i, check) {
-					if($(check).is(":checked")) {
-						students_present.push(students[i]);
-					}
-					else {
-						students_absent.push(students[i]);
-					}
-				});
-				frappe.call({
-					method: "erpnext.schools.api.mark_attendance",
-					args: {
-						"students_present": students_present,
-						"students_absent": students_absent,
-						"course_schedule": frm.doc.name
-					},
-					callback: function(r) {
-						frm.events.view_attendance(frm)
-					}
-				});
-		});
+        student_toolbar.find(".btn-remove")
+            .html(__('Uncheck all'))
+            .on("click", function() {
+                $(me.wrapper).find('input[type="checkbox"]').each(function(i, check) {
+                    if ($(check).is(":checked")) {
+                        check.checked = false;
+                    }
+                });
+            });
 
-		
-		$.each(students, function(i, m) {
-			$(repl('<div class="col-sm-6">\
+        student_toolbar.find(".btn-mark-att")
+            .html(__('Mark Attendence'))
+            .on("click", function() {
+                var students_present = [];
+                var students_absent = [];
+                $(me.wrapper).find('input[type="checkbox"]').each(function(i, check) {
+                    if ($(check).is(":checked")) {
+                        students_present.push(students[i]);
+                    } else {
+                        students_absent.push(students[i]);
+                    }
+                });
+                frappe.call({
+                    method: "erpnext.schools.api.mark_attendance",
+                    args: {
+                        "students_present": students_present,
+                        "students_absent": students_absent,
+                        "course_schedule": frm.doc.name
+                    },
+                    callback: function(r) {
+                        frm.events.view_attendance(frm)
+                    }
+                });
+            });
+
+
+        $.each(students, function(i, m) {
+            $(repl('<div class="col-sm-6">\
 				<div class="checkbox">\
 				<label><input type="checkbox" class="students-check" student="%(student)s">\
 				%(student)s</label>\
-			</div></div>', {student: m.student_name})).appendTo(me.wrapper);
-		});
-	}
+			</div></div>', { student: m.student_name })).appendTo(me.wrapper);
+        });
+    }
 })
\ No newline at end of file
diff --git a/erpnext/schools/doctype/course_schedule/course_schedule.json b/erpnext/schools/doctype/course_schedule/course_schedule.json
index 4a4b2d3..122285e 100644
--- a/erpnext/schools/doctype/course_schedule/course_schedule.json
+++ b/erpnext/schools/doctype/course_schedule/course_schedule.json
@@ -478,7 +478,7 @@
  "istable": 0, 
  "max_attachments": 0, 
  "menu_index": 0, 
- "modified": "2016-11-16 16:38:00.454295", 
+ "modified": "2016-12-01 12:59:25.086606", 
  "modified_by": "Administrator", 
  "module": "Schools", 
  "name": "Course Schedule", 
@@ -490,6 +490,27 @@
    "apply_user_permissions": 0, 
    "cancel": 0, 
    "create": 1, 
+   "delete": 0, 
+   "email": 0, 
+   "export": 0, 
+   "if_owner": 0, 
+   "import": 0, 
+   "is_custom": 0, 
+   "permlevel": 0, 
+   "print": 0, 
+   "read": 1, 
+   "report": 1, 
+   "role": "Instructor", 
+   "set_user_permissions": 0, 
+   "share": 0, 
+   "submit": 0, 
+   "write": 1
+  }, 
+  {
+   "amend": 0, 
+   "apply_user_permissions": 0, 
+   "cancel": 0, 
+   "create": 1, 
    "delete": 1, 
    "email": 1, 
    "export": 1, 
diff --git a/erpnext/schools/doctype/scheduling_tool/__init__.py b/erpnext/schools/doctype/course_scheduling_tool/__init__.py
similarity index 100%
rename from erpnext/schools/doctype/scheduling_tool/__init__.py
rename to erpnext/schools/doctype/course_scheduling_tool/__init__.py
diff --git a/erpnext/schools/doctype/course_scheduling_tool/course_scheduling_tool.js b/erpnext/schools/doctype/course_scheduling_tool/course_scheduling_tool.js
new file mode 100644
index 0000000..ea62b8f
--- /dev/null
+++ b/erpnext/schools/doctype/course_scheduling_tool/course_scheduling_tool.js
@@ -0,0 +1,21 @@
+// Copyright (c) 2016, Frappe Technologies Pvt. Ltd. and contributors
+// For license information, please see license.txt
+
+cur_frm.add_fetch("student_group", "program", "program");
+cur_frm.add_fetch("student_group", "student_batch", "student_batch");
+cur_frm.add_fetch("student_group", "course", "course");
+cur_frm.add_fetch("student_group", "academic_year", "academic_year");
+cur_frm.add_fetch("student_group", "academic_term", "academic_term");
+
+frappe.ui.form.on("Course Scheduling Tool", {
+
+    refresh: function(frm) {
+        frm.disable_save();
+        frm.page.set_primary_action(__("Schedule Course"), function() {
+            frappe.call({
+                method: "schedule_course",
+                doc: frm.doc
+            })
+        });
+    }
+});
\ No newline at end of file
diff --git a/erpnext/schools/doctype/scheduling_tool/scheduling_tool.json b/erpnext/schools/doctype/course_scheduling_tool/course_scheduling_tool.json
similarity index 99%
rename from erpnext/schools/doctype/scheduling_tool/scheduling_tool.json
rename to erpnext/schools/doctype/course_scheduling_tool/course_scheduling_tool.json
index cf2c1a3..a66960e 100644
--- a/erpnext/schools/doctype/scheduling_tool/scheduling_tool.json
+++ b/erpnext/schools/doctype/course_scheduling_tool/course_scheduling_tool.json
@@ -244,62 +244,6 @@
    "bold": 0, 
    "collapsible": 0, 
    "columns": 0, 
-   "fieldname": "room", 
-   "fieldtype": "Link", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "ignore_xss_filter": 0, 
-   "in_filter": 0, 
-   "in_list_view": 0, 
-   "in_standard_filter": 0, 
-   "label": "Room", 
-   "length": 0, 
-   "no_copy": 0, 
-   "options": "Room", 
-   "permlevel": 0, 
-   "precision": "", 
-   "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_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "columns": 0, 
-   "fieldname": "column_break_9", 
-   "fieldtype": "Column Break", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "ignore_xss_filter": 0, 
-   "in_filter": 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_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "columns": 0, 
    "fieldname": "instructor", 
    "fieldtype": "Link", 
    "hidden": 0, 
@@ -358,6 +302,62 @@
    "bold": 0, 
    "collapsible": 0, 
    "columns": 0, 
+   "fieldname": "column_break_9", 
+   "fieldtype": "Column Break", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 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_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "room", 
+   "fieldtype": "Link", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Room", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "Room", 
+   "permlevel": 0, 
+   "precision": "", 
+   "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_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "section_break_7", 
    "fieldtype": "Section Break", 
    "hidden": 0, 
@@ -592,10 +592,10 @@
  "istable": 0, 
  "max_attachments": 0, 
  "menu_index": 0, 
- "modified": "2016-11-16 16:03:41.854229", 
+ "modified": "2016-11-21 16:58:29.295922", 
  "modified_by": "Administrator", 
  "module": "Schools", 
- "name": "Scheduling Tool", 
+ "name": "Course Scheduling Tool", 
  "name_case": "", 
  "owner": "Administrator", 
  "permissions": [
diff --git a/erpnext/schools/doctype/scheduling_tool/scheduling_tool.py b/erpnext/schools/doctype/course_scheduling_tool/course_scheduling_tool.py
similarity index 96%
rename from erpnext/schools/doctype/scheduling_tool/scheduling_tool.py
rename to erpnext/schools/doctype/course_scheduling_tool/course_scheduling_tool.py
index b8ba578..86fefe2 100644
--- a/erpnext/schools/doctype/scheduling_tool/scheduling_tool.py
+++ b/erpnext/schools/doctype/course_scheduling_tool/course_scheduling_tool.py
@@ -1,5 +1,5 @@
 # -*- coding: utf-8 -*-
-# Copyright (c) 2015, Frappe Technologies and contributors
+# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and contributors
 # For license information, please see license.txt
 
 from __future__ import unicode_literals
@@ -10,7 +10,7 @@
 from frappe.utils import add_days, getdate
 from erpnext.schools.utils import OverlapError
 
-class SchedulingTool(Document):
+class CourseSchedulingTool(Document):
 	def schedule_course(self):
 		"""Creates course schedules as per specified parametes"""
 		
@@ -102,3 +102,4 @@
 		course_schedule.from_time= self.from_time
 		course_schedule.to_time= self.to_time
 		return course_schedule
+	
diff --git a/erpnext/schools/doctype/program_enrollment/program_enrollment.json b/erpnext/schools/doctype/program_enrollment/program_enrollment.json
index 8fed228..e7269f0 100644
--- a/erpnext/schools/doctype/program_enrollment/program_enrollment.json
+++ b/erpnext/schools/doctype/program_enrollment/program_enrollment.json
@@ -104,6 +104,35 @@
    "bold": 0, 
    "collapsible": 0, 
    "columns": 0, 
+   "fieldname": "student_batch_name", 
+   "fieldtype": "Link", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Student Batch Name", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "Student Batch Name", 
+   "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_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "column_break_4", 
    "fieldtype": "Column Break", 
    "hidden": 0, 
@@ -340,7 +369,7 @@
  "istable": 0, 
  "max_attachments": 0, 
  "menu_index": 0, 
- "modified": "2016-11-07 05:25:17.473070", 
+ "modified": "2016-11-18 14:20:10.023790", 
  "modified_by": "Administrator", 
  "module": "Schools", 
  "name": "Program Enrollment", 
diff --git a/erpnext/schools/doctype/scheduling_tool/scheduling_tool.js b/erpnext/schools/doctype/scheduling_tool/scheduling_tool.js
deleted file mode 100644
index 5011375..0000000
--- a/erpnext/schools/doctype/scheduling_tool/scheduling_tool.js
+++ /dev/null
@@ -1,15 +0,0 @@
-cur_frm.add_fetch("student_group", "program", "program");
-cur_frm.add_fetch("student_group", "student_batch", "student_batch");
-cur_frm.add_fetch("student_group", "course", "course");
-cur_frm.add_fetch("student_group", "academic_year", "academic_year");
-cur_frm.add_fetch("student_group", "academic_term", "academic_term");
-
-frappe.ui.form.on("Scheduling Tool", "refresh", function(frm) {
-	frm.disable_save();
-	frm.page.set_primary_action(__("Schedule Course"), function() {
-		frappe.call({
-			method: "schedule_course",
-			doc:frm.doc
-		})
-	});
-});
\ No newline at end of file
diff --git a/erpnext/schools/doctype/scheduling_tool/test_scheduling_tool.py b/erpnext/schools/doctype/scheduling_tool/test_scheduling_tool.py
deleted file mode 100644
index 4ec3747..0000000
--- a/erpnext/schools/doctype/scheduling_tool/test_scheduling_tool.py
+++ /dev/null
@@ -1,12 +0,0 @@
-# -*- coding: utf-8 -*-
-# Copyright (c) 2015, Frappe and Contributors
-# See license.txt
-from __future__ import unicode_literals
-
-import frappe
-import unittest
-
-# test_records = frappe.get_test_records('Scheduling Tool')
-
-class TestSchedulingTool(unittest.TestCase):
-	pass
diff --git a/erpnext/schools/doctype/student/student.json b/erpnext/schools/doctype/student/student.json
index d188db3..6984d38 100644
--- a/erpnext/schools/doctype/student/student.json
+++ b/erpnext/schools/doctype/student/student.json
@@ -24,6 +24,7 @@
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "in_standard_filter": 0, 
    "label": "First Name", 
    "length": 0, 
    "no_copy": 0, 
@@ -32,6 +33,7 @@
    "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, 
@@ -50,6 +52,7 @@
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "in_standard_filter": 0, 
    "label": "Middle Name", 
    "length": 0, 
    "no_copy": 0, 
@@ -58,6 +61,7 @@
    "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, 
@@ -76,6 +80,7 @@
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "in_standard_filter": 0, 
    "label": "Last Name", 
    "length": 0, 
    "no_copy": 0, 
@@ -84,6 +89,7 @@
    "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, 
@@ -102,6 +108,7 @@
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "in_standard_filter": 0, 
    "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
@@ -109,6 +116,7 @@
    "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, 
@@ -127,6 +135,7 @@
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "in_standard_filter": 0, 
    "label": "Naming Series", 
    "length": 0, 
    "no_copy": 0, 
@@ -136,6 +145,7 @@
    "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, 
@@ -154,6 +164,7 @@
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "in_standard_filter": 0, 
    "label": "Student Email ID", 
    "length": 0, 
    "no_copy": 0, 
@@ -162,6 +173,7 @@
    "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, 
@@ -180,6 +192,7 @@
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "in_standard_filter": 0, 
    "label": "Student Mobile Number", 
    "length": 0, 
    "no_copy": 0, 
@@ -189,6 +202,7 @@
    "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, 
@@ -208,6 +222,7 @@
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 1, 
+   "in_standard_filter": 0, 
    "label": "Joining Date", 
    "length": 0, 
    "no_copy": 0, 
@@ -216,6 +231,7 @@
    "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, 
@@ -234,6 +250,7 @@
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "in_standard_filter": 0, 
    "label": "Image", 
    "length": 0, 
    "no_copy": 0, 
@@ -242,6 +259,7 @@
    "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, 
@@ -262,6 +280,7 @@
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "in_standard_filter": 0, 
    "label": "Personal Details", 
    "length": 0, 
    "no_copy": 0, 
@@ -270,6 +289,7 @@
    "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, 
@@ -288,6 +308,7 @@
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "in_standard_filter": 0, 
    "label": "Date of Birth", 
    "length": 0, 
    "no_copy": 0, 
@@ -296,6 +317,7 @@
    "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, 
@@ -314,6 +336,7 @@
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "in_standard_filter": 0, 
    "label": "Blood Group", 
    "length": 0, 
    "no_copy": 0, 
@@ -323,6 +346,7 @@
    "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, 
@@ -341,6 +365,7 @@
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "in_standard_filter": 0, 
    "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
@@ -348,6 +373,7 @@
    "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, 
@@ -366,6 +392,7 @@
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "in_standard_filter": 0, 
    "label": "Gender", 
    "length": 0, 
    "no_copy": 0, 
@@ -375,6 +402,7 @@
    "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, 
@@ -393,6 +421,7 @@
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "in_standard_filter": 0, 
    "label": "Nationality", 
    "length": 0, 
    "no_copy": 0, 
@@ -402,6 +431,7 @@
    "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, 
@@ -420,6 +450,7 @@
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "in_standard_filter": 0, 
    "label": "Student Applicant", 
    "length": 0, 
    "no_copy": 0, 
@@ -429,6 +460,7 @@
    "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, 
@@ -447,6 +479,7 @@
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "in_standard_filter": 0, 
    "label": "Home Address", 
    "length": 0, 
    "no_copy": 0, 
@@ -455,6 +488,7 @@
    "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, 
@@ -473,6 +507,7 @@
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "in_standard_filter": 0, 
    "label": "Address Line 1", 
    "length": 0, 
    "no_copy": 0, 
@@ -481,6 +516,7 @@
    "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, 
@@ -499,6 +535,7 @@
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "in_standard_filter": 0, 
    "label": "Address Line 2", 
    "length": 0, 
    "no_copy": 0, 
@@ -507,6 +544,7 @@
    "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, 
@@ -525,6 +563,7 @@
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "in_standard_filter": 0, 
    "label": "Pincode", 
    "length": 0, 
    "no_copy": 0, 
@@ -533,6 +572,7 @@
    "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, 
@@ -551,6 +591,7 @@
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "in_standard_filter": 0, 
    "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
@@ -558,6 +599,7 @@
    "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, 
@@ -576,6 +618,7 @@
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "in_standard_filter": 0, 
    "label": "City", 
    "length": 0, 
    "no_copy": 0, 
@@ -584,6 +627,7 @@
    "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, 
@@ -602,6 +646,7 @@
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "in_standard_filter": 0, 
    "label": "State", 
    "length": 0, 
    "no_copy": 0, 
@@ -610,6 +655,7 @@
    "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, 
@@ -628,6 +674,7 @@
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "in_standard_filter": 0, 
    "label": "Guardian Details", 
    "length": 0, 
    "no_copy": 0, 
@@ -636,6 +683,7 @@
    "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, 
@@ -654,6 +702,7 @@
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "in_standard_filter": 0, 
    "label": "Guardians", 
    "length": 0, 
    "no_copy": 0, 
@@ -663,6 +712,7 @@
    "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, 
@@ -681,6 +731,7 @@
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "in_standard_filter": 0, 
    "label": "Sibling Details", 
    "length": 0, 
    "no_copy": 0, 
@@ -690,6 +741,7 @@
    "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, 
@@ -708,6 +760,7 @@
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "in_standard_filter": 0, 
    "label": "Siblings", 
    "length": 0, 
    "no_copy": 0, 
@@ -717,6 +770,7 @@
    "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, 
@@ -736,6 +790,7 @@
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "in_standard_filter": 0, 
    "label": "Title", 
    "length": 0, 
    "no_copy": 0, 
@@ -744,6 +799,7 @@
    "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, 
@@ -763,7 +819,7 @@
  "istable": 0, 
  "max_attachments": 0, 
  "menu_index": 0, 
- "modified": "2016-10-26 12:24:10.533118", 
+ "modified": "2016-12-01 12:55:32.453131", 
  "modified_by": "Administrator", 
  "module": "Schools", 
  "name": "Student", 
@@ -774,6 +830,27 @@
    "amend": 0, 
    "apply_user_permissions": 0, 
    "cancel": 0, 
+   "create": 0, 
+   "delete": 0, 
+   "email": 0, 
+   "export": 0, 
+   "if_owner": 0, 
+   "import": 0, 
+   "is_custom": 0, 
+   "permlevel": 0, 
+   "print": 0, 
+   "read": 1, 
+   "report": 0, 
+   "role": "Instructor", 
+   "set_user_permissions": 0, 
+   "share": 0, 
+   "submit": 0, 
+   "write": 0
+  }, 
+  {
+   "amend": 0, 
+   "apply_user_permissions": 0, 
+   "cancel": 0, 
    "create": 1, 
    "delete": 1, 
    "email": 1, 
diff --git a/erpnext/schools/doctype/student_admission/student_admission.py b/erpnext/schools/doctype/student_admission/student_admission.py
index b0c7b55..a849d65 100644
--- a/erpnext/schools/doctype/student_admission/student_admission.py
+++ b/erpnext/schools/doctype/student_admission/student_admission.py
@@ -23,7 +23,7 @@
 		context.parents = [{'name': 'admissions', 'title': _('All Student Admissions') }]
 
 	def get_title(self):
-		return _("Admissions for {0}").format(self.academic_term)
+		return _("Admissions for {0}").format(self.academic_year)
 
 def get_list_context(context):
 	context.title = _("Student Admissions")
diff --git a/erpnext/schools/doctype/student_attendance/student_attendance.js b/erpnext/schools/doctype/student_attendance/student_attendance.js
index 6e79d52..ec2a0cb 100644
--- a/erpnext/schools/doctype/student_attendance/student_attendance.js
+++ b/erpnext/schools/doctype/student_attendance/student_attendance.js
@@ -2,10 +2,4 @@
 // For license information, please see license.txt
 
 cur_frm.add_fetch("course_schedule", "schedule_date", "date");
-cur_frm.add_fetch("course_schedule", "student_batch", "student_batch");
-
-frappe.ui.form.on('Student Attendance', {
-	refresh: function(frm) {
-
-	}
-});
+cur_frm.add_fetch("course_schedule", "student_batch", "student_batch")
\ No newline at end of file
diff --git a/erpnext/schools/doctype/student_attendance/student_attendance.json b/erpnext/schools/doctype/student_attendance/student_attendance.json
index 70fcdf3..3ea47f37 100644
--- a/erpnext/schools/doctype/student_attendance/student_attendance.json
+++ b/erpnext/schools/doctype/student_attendance/student_attendance.json
@@ -252,7 +252,7 @@
  "issingle": 0, 
  "istable": 0, 
  "max_attachments": 0, 
- "modified": "2016-11-16 16:58:35.779867", 
+ "modified": "2016-12-01 12:56:21.537215", 
  "modified_by": "Administrator", 
  "module": "Schools", 
  "name": "Student Attendance", 
@@ -265,6 +265,27 @@
    "cancel": 1, 
    "create": 1, 
    "delete": 1, 
+   "email": 0, 
+   "export": 0, 
+   "if_owner": 0, 
+   "import": 0, 
+   "is_custom": 0, 
+   "permlevel": 0, 
+   "print": 1, 
+   "read": 1, 
+   "report": 1, 
+   "role": "Instructor", 
+   "set_user_permissions": 0, 
+   "share": 0, 
+   "submit": 1, 
+   "write": 1
+  }, 
+  {
+   "amend": 1, 
+   "apply_user_permissions": 0, 
+   "cancel": 1, 
+   "create": 1, 
+   "delete": 1, 
    "email": 1, 
    "export": 1, 
    "if_owner": 0, 
diff --git a/erpnext/schools/doctype/student_attendance/student_attendance.py b/erpnext/schools/doctype/student_attendance/student_attendance.py
index d9949b0..45b3014 100644
--- a/erpnext/schools/doctype/student_attendance/student_attendance.py
+++ b/erpnext/schools/doctype/student_attendance/student_attendance.py
@@ -31,7 +31,8 @@
 				(self.student, self.course_schedule, self.name))
 		else:
 			attendance_records= frappe.db.sql("""select name from `tabStudent Attendance` where \
-				student= %s and date= %s and name != %s and course_schedule='' and docstatus=1""",
+				student= %s and date= %s and name != %s and docstatus=1 and \
+				(course_schedule is Null or course_schedule='')""",
 				(self.student, self.date, self.name))
 			
 		if attendance_records:
diff --git a/erpnext/schools/doctype/student_batch/student_batch.json b/erpnext/schools/doctype/student_batch/student_batch.json
index 1e529d7..f571d9d 100644
--- a/erpnext/schools/doctype/student_batch/student_batch.json
+++ b/erpnext/schools/doctype/student_batch/student_batch.json
@@ -18,7 +18,7 @@
    "collapsible": 0, 
    "columns": 0, 
    "fieldname": "student_batch_name", 
-   "fieldtype": "Data", 
+   "fieldtype": "Link", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
    "ignore_xss_filter": 0, 
@@ -28,6 +28,7 @@
    "label": "Student Batch Name", 
    "length": 0, 
    "no_copy": 0, 
+   "options": "Student Batch Name", 
    "permlevel": 0, 
    "precision": "", 
    "print_hide": 0, 
@@ -74,6 +75,35 @@
    "bold": 0, 
    "collapsible": 0, 
    "columns": 0, 
+   "default": "1", 
+   "fieldname": "enabled", 
+   "fieldtype": "Check", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Active", 
+   "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_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "column_break_2", 
    "fieldtype": "Column Break", 
    "hidden": 0, 
@@ -159,7 +189,7 @@
    "bold": 0, 
    "collapsible": 0, 
    "columns": 0, 
-   "fieldname": "section_break_8", 
+   "fieldname": "section_break_6", 
    "fieldtype": "Section Break", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
@@ -167,6 +197,7 @@
    "in_filter": 0, 
    "in_list_view": 0, 
    "in_standard_filter": 0, 
+   "label": "Students", 
    "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
@@ -209,6 +240,63 @@
    "search_index": 0, 
    "set_only_once": 0, 
    "unique": 0
+  }, 
+  {
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "section_break_8", 
+   "fieldtype": "Section Break", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Instructors", 
+   "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_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "instructors", 
+   "fieldtype": "Table", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Instructors", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "Student Batch Instructor", 
+   "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, 
@@ -221,7 +309,7 @@
  "issingle": 0, 
  "istable": 0, 
  "max_attachments": 0, 
- "modified": "2016-11-07 05:59:36.920495", 
+ "modified": "2016-12-01 13:18:12.024001", 
  "modified_by": "Administrator", 
  "module": "Schools", 
  "name": "Student Batch", 
@@ -248,6 +336,27 @@
    "share": 1, 
    "submit": 0, 
    "write": 1
+  }, 
+  {
+   "amend": 0, 
+   "apply_user_permissions": 0, 
+   "cancel": 0, 
+   "create": 0, 
+   "delete": 0, 
+   "email": 0, 
+   "export": 0, 
+   "if_owner": 0, 
+   "import": 0, 
+   "is_custom": 0, 
+   "permlevel": 0, 
+   "print": 0, 
+   "read": 1, 
+   "report": 0, 
+   "role": "Instructor", 
+   "set_user_permissions": 0, 
+   "share": 0, 
+   "submit": 0, 
+   "write": 0
   }
  ], 
  "quick_entry": 1, 
diff --git a/erpnext/schools/doctype/student_batch/student_batch.py b/erpnext/schools/doctype/student_batch/student_batch.py
index ec2dc79..1a0d799 100644
--- a/erpnext/schools/doctype/student_batch/student_batch.py
+++ b/erpnext/schools/doctype/student_batch/student_batch.py
@@ -8,12 +8,11 @@
 import frappe
 
 class StudentBatch(Document):
-    def autoname(self):
-        prog_abb = frappe.db.get_value("Program", self.program, "program_abbreviation")
-        if not prog_abb:
-            prog_abb = self.program
-        self.name = prog_abb + "-"+ self.student_batch_name + "-" + self.academic_year
-        
-    def validate(self):
-        validate_duplicate_student(self.students)
-        
\ No newline at end of file
+	def autoname(self):
+		prog_abb = frappe.db.get_value("Program", self.program, "program_abbreviation")
+		if not prog_abb:
+			prog_abb = self.program
+		self.name = prog_abb + "-"+ self.student_batch_name + "-" + self.academic_year
+		
+	def validate(self):
+		validate_duplicate_student(self.students)
diff --git a/erpnext/schools/doctype/student_batch_attendance_tool/student_batch_attendance_tool.js b/erpnext/schools/doctype/student_batch_attendance_tool/student_batch_attendance_tool.js
index a6d035a..6dc9181 100644
--- a/erpnext/schools/doctype/student_batch_attendance_tool/student_batch_attendance_tool.js
+++ b/erpnext/schools/doctype/student_batch_attendance_tool/student_batch_attendance_tool.js
@@ -3,126 +3,124 @@
 frappe.provide("schools")
 
 frappe.ui.form.on('Student Batch Attendance Tool', {
-	refresh: function(frm) {
-		frm.disable_save();
-		hide_field('attendance');
-	},
-	
-	student_batch :function(frm) {
-		if(frm.doc.student_batch && frm.doc.date) {
-			frappe.call({
-				method: "erpnext.schools.api.check_attendance_records_exist",
-				args: {
-					"student_batch": frm.doc.student_batch,
-					"date": frm.doc.date
-				},
-				callback: function(r) {
-					if(r.message) {
-						frappe.msgprint("Attendance already marked.");
-						hide_field('attendance');
-					}
-					else {
-						frappe.call({
-							method: "erpnext.schools.api.get_student_batch_students",
-							args: {
-								"student_batch": frm.doc.student_batch
-							},
-							callback: function(r) {
-								if (r.message) {
-									unhide_field('attendance');
-									frm.events.get_students(frm, r.message)
-								}
-							}
-						});
-					}
-				}
-			});
-		}
-	},
-	
-	date: function(frm) {
-		frm.trigger("student_batch");
-	},
-	
-	get_students: function(frm, students) {
-		if(!frm.students_area) {
-		frm.students_area = $('<div>')
-			.appendTo(frm.fields_dict.students_html.wrapper);
-		}
-		frm.students_editor = new schools.StudentsEditor(frm, frm.students_area, students)
-	}
+    refresh: function(frm) {
+        frm.disable_save();
+        hide_field('attendance');
+    },
+
+    student_batch: function(frm) {
+        if (frm.doc.student_batch && frm.doc.date) {
+            frappe.call({
+                method: "erpnext.schools.api.check_attendance_records_exist",
+                args: {
+                    "student_batch": frm.doc.student_batch,
+                    "date": frm.doc.date
+                },
+                callback: function(r) {
+                    if (r.message) {
+                        frappe.msgprint("Attendance already marked.");
+                        hide_field('attendance');
+                    } else {
+                        frappe.call({
+                            method: "erpnext.schools.api.get_student_batch_students",
+                            args: {
+                                "student_batch": frm.doc.student_batch
+                            },
+                            callback: function(r) {
+                                if (r.message) {
+                                    unhide_field('attendance');
+                                    frm.events.get_students(frm, r.message)
+                                }
+                            }
+                        });
+                    }
+                }
+            });
+        }
+    },
+
+    date: function(frm) {
+        frm.trigger("student_batch");
+    },
+
+    get_students: function(frm, students) {
+        if (!frm.students_area) {
+            frm.students_area = $('<div>')
+                .appendTo(frm.fields_dict.students_html.wrapper);
+        }
+        frm.students_editor = new schools.StudentsEditor(frm, frm.students_area, students)
+    }
 });
 
 
 schools.StudentsEditor = Class.extend({
-	init: function(frm, wrapper, students) {
-		this.wrapper = wrapper;
-		this.frm = frm;
-		this.make(frm, students);
-	},
-	make: function(frm, students) {
-		var me = this;
-		
-		$(this.wrapper).empty();
-		var student_toolbar = $('<p>\
+    init: function(frm, wrapper, students) {
+        this.wrapper = wrapper;
+        this.frm = frm;
+        this.make(frm, students);
+    },
+    make: function(frm, students) {
+        var me = this;
+
+        $(this.wrapper).empty();
+        var student_toolbar = $('<p>\
 			<button class="btn btn-default btn-add btn-xs" style="margin-right: 5px;"></button>\
 			<button class="btn btn-xs btn-default btn-remove" style="margin-right: 5px;"></button>\
 			<button class="btn btn-default btn-primary btn-mark-att btn-xs"></button></p>').appendTo($(this.wrapper));
 
-		student_toolbar.find(".btn-add")
-			.html(__('Check all'))
-			.on("click", function() {
-			$(me.wrapper).find('input[type="checkbox"]').each(function(i, check) {
-				if(!$(check).is(":checked")) {
-					check.checked = true;
-				}
-			});
-		});
+        student_toolbar.find(".btn-add")
+            .html(__('Check all'))
+            .on("click", function() {
+                $(me.wrapper).find('input[type="checkbox"]').each(function(i, check) {
+                    if (!$(check).is(":checked")) {
+                        check.checked = true;
+                    }
+                });
+            });
 
-		student_toolbar.find(".btn-remove")
-			.html(__('Uncheck all'))
-			.on("click", function() {
-			$(me.wrapper).find('input[type="checkbox"]').each(function(i, check) {
-				if($(check).is(":checked")) {
-					check.checked = false;
-				}
-			});
-		});
-		
-		student_toolbar.find(".btn-mark-att")
-			.html(__('Mark Attendence'))
-			.on("click", function() {
-				var students_present = [];
-				var students_absent = [];
-				$(me.wrapper).find('input[type="checkbox"]').each(function(i, check) {
-					if($(check).is(":checked")) {
-						students_present.push(students[i]);
-					}
-					else {
-						students_absent.push(students[i]);
-					}
-				});
-				frappe.call({
-					method: "erpnext.schools.api.mark_attendance",
-					args: {
-						"students_present": students_present,
-						"students_absent": students_absent,
-						"student_batch": frm.doc.student_batch,
-						"date": frm.doc.date
-					},
-					callback: function(r) {
-						hide_field('attendance');
-					}
-				});
-		});
+        student_toolbar.find(".btn-remove")
+            .html(__('Uncheck all'))
+            .on("click", function() {
+                $(me.wrapper).find('input[type="checkbox"]').each(function(i, check) {
+                    if ($(check).is(":checked")) {
+                        check.checked = false;
+                    }
+                });
+            });
 
-		
-		$.each(students, function(i, m) {
-			$(repl('<div class="col-sm-6">\
+        student_toolbar.find(".btn-mark-att")
+            .html(__('Mark Attendence'))
+            .on("click", function() {
+                var students_present = [];
+                var students_absent = [];
+                $(me.wrapper).find('input[type="checkbox"]').each(function(i, check) {
+                    if ($(check).is(":checked")) {
+                        students_present.push(students[i]);
+                    } else {
+                        students_absent.push(students[i]);
+                    }
+                });
+                frappe.call({
+                    method: "erpnext.schools.api.mark_attendance",
+                    args: {
+                        "students_present": students_present,
+                        "students_absent": students_absent,
+                        "student_batch": frm.doc.student_batch,
+                        "date": frm.doc.date
+                    },
+                    callback: function(r) {
+                        hide_field('attendance');
+                    }
+                });
+            });
+
+
+        $.each(students, function(i, m) {
+            $(repl('<div class="col-sm-6">\
 				<div class="checkbox">\
 				<label><input type="checkbox" class="students-check" student="%(student)s">\
 				%(student)s</label>\
-			</div></div>', {student: m.student_name})).appendTo(me.wrapper);
-		});
-	}
-});
+			</div></div>', { student: m.student_name })).appendTo(me.wrapper);
+        });
+    }
+});
\ No newline at end of file
diff --git a/erpnext/schools/doctype/student_batch_attendance_tool/student_batch_attendance_tool.json b/erpnext/schools/doctype/student_batch_attendance_tool/student_batch_attendance_tool.json
index 3361dcb..defc886 100644
--- a/erpnext/schools/doctype/student_batch_attendance_tool/student_batch_attendance_tool.json
+++ b/erpnext/schools/doctype/student_batch_attendance_tool/student_batch_attendance_tool.json
@@ -163,7 +163,7 @@
  "issingle": 1, 
  "istable": 0, 
  "max_attachments": 0, 
- "modified": "2016-11-16 17:16:43.835693", 
+ "modified": "2016-12-01 12:58:31.822014", 
  "modified_by": "Administrator", 
  "module": "Schools", 
  "name": "Student Batch Attendance Tool", 
@@ -176,6 +176,27 @@
    "cancel": 0, 
    "create": 1, 
    "delete": 0, 
+   "email": 0, 
+   "export": 0, 
+   "if_owner": 0, 
+   "import": 0, 
+   "is_custom": 0, 
+   "permlevel": 0, 
+   "print": 0, 
+   "read": 1, 
+   "report": 0, 
+   "role": "Instructor", 
+   "set_user_permissions": 0, 
+   "share": 0, 
+   "submit": 0, 
+   "write": 1
+  }, 
+  {
+   "amend": 0, 
+   "apply_user_permissions": 0, 
+   "cancel": 0, 
+   "create": 1, 
+   "delete": 0, 
    "email": 1, 
    "export": 0, 
    "if_owner": 0, 
diff --git a/erpnext/schools/doctype/scheduling_tool/__init__.py b/erpnext/schools/doctype/student_batch_creation_tool/__init__.py
similarity index 100%
copy from erpnext/schools/doctype/scheduling_tool/__init__.py
copy to erpnext/schools/doctype/student_batch_creation_tool/__init__.py
diff --git a/erpnext/schools/doctype/student_batch_creation_tool/student_batch_creation_tool.js b/erpnext/schools/doctype/student_batch_creation_tool/student_batch_creation_tool.js
new file mode 100644
index 0000000..3167174
--- /dev/null
+++ b/erpnext/schools/doctype/student_batch_creation_tool/student_batch_creation_tool.js
@@ -0,0 +1,8 @@
+// Copyright (c) 2016, Frappe Technologies Pvt. Ltd. and contributors
+// For license information, please see license.txt
+
+frappe.ui.form.on('Student Batch Creation Tool', {
+	refresh: function(frm) {
+		frm.disable_save();
+	}
+});
diff --git a/erpnext/schools/doctype/student_batch_creation_tool/student_batch_creation_tool.json b/erpnext/schools/doctype/student_batch_creation_tool/student_batch_creation_tool.json
new file mode 100644
index 0000000..d94c480
--- /dev/null
+++ b/erpnext/schools/doctype/student_batch_creation_tool/student_batch_creation_tool.json
@@ -0,0 +1,176 @@
+{
+ "allow_copy": 1, 
+ "allow_import": 0, 
+ "allow_rename": 0, 
+ "beta": 0, 
+ "creation": "2016-11-14 18:20:12.160405", 
+ "custom": 0, 
+ "docstatus": 0, 
+ "doctype": "DocType", 
+ "document_type": "", 
+ "editable_grid": 1, 
+ "engine": "InnoDB", 
+ "fields": [
+  {
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "academic_year", 
+   "fieldtype": "Link", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Academic Year", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "Academic Year", 
+   "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_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "program", 
+   "fieldtype": "Link", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Program", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "Program", 
+   "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_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "student_batch_name", 
+   "fieldtype": "Link", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Student Batch Name", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "Student Batch Name", 
+   "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_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "make_student_batch", 
+   "fieldtype": "Button", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Make Student Batch", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "make_batch", 
+   "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": 1, 
+ "hide_toolbar": 1, 
+ "idx": 0, 
+ "image_view": 0, 
+ "in_create": 0, 
+ "in_dialog": 0, 
+ "is_submittable": 0, 
+ "issingle": 1, 
+ "istable": 0, 
+ "max_attachments": 0, 
+ "modified": "2016-11-21 16:47:56.823988", 
+ "modified_by": "Administrator", 
+ "module": "Schools", 
+ "name": "Student Batch Creation Tool", 
+ "name_case": "", 
+ "owner": "Administrator", 
+ "permissions": [
+  {
+   "amend": 0, 
+   "apply_user_permissions": 0, 
+   "cancel": 0, 
+   "create": 0, 
+   "delete": 0, 
+   "email": 1, 
+   "export": 0, 
+   "if_owner": 0, 
+   "import": 0, 
+   "is_custom": 0, 
+   "permlevel": 0, 
+   "print": 1, 
+   "read": 1, 
+   "report": 0, 
+   "role": "Academics User", 
+   "set_user_permissions": 0, 
+   "share": 1, 
+   "submit": 0, 
+   "write": 1
+  }
+ ], 
+ "quick_entry": 0, 
+ "read_only": 0, 
+ "read_only_onload": 0, 
+ "sort_field": "modified", 
+ "sort_order": "DESC", 
+ "track_seen": 0
+}
\ No newline at end of file
diff --git a/erpnext/schools/doctype/student_batch_creation_tool/student_batch_creation_tool.py b/erpnext/schools/doctype/student_batch_creation_tool/student_batch_creation_tool.py
new file mode 100644
index 0000000..deda137
--- /dev/null
+++ b/erpnext/schools/doctype/student_batch_creation_tool/student_batch_creation_tool.py
@@ -0,0 +1,27 @@
+# -*- coding: utf-8 -*-
+# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and contributors
+# For license information, please see license.txt
+
+from __future__ import unicode_literals
+import frappe
+from frappe.model.document import Document
+
+class StudentBatchCreationTool(Document):
+	def make_batch(self):
+		if self.academic_year and self.program and self.student_batch_name:
+			students = frappe.get_list("Program Enrollment", fields=["student", "student_name"],
+				 filters={"academic_year":self.academic_year, "program": self.program, "student_batch_name": self.student_batch_name},
+				 order_by= "student_name")
+			if students:
+				student_batch = frappe.new_doc("Student Batch")
+				student_batch.update({
+					"academic_year": self.academic_year,
+					"program": self.program,
+					"student_batch_name": self.student_batch_name,
+					"students": students
+				})
+				student_batch.save()
+				frappe.msgprint("Student Batch created.")
+			else:
+				frappe.msgprint("No students found.")
+
diff --git a/erpnext/schools/doctype/scheduling_tool/__init__.py b/erpnext/schools/doctype/student_batch_instructor/__init__.py
similarity index 100%
copy from erpnext/schools/doctype/scheduling_tool/__init__.py
copy to erpnext/schools/doctype/student_batch_instructor/__init__.py
diff --git a/erpnext/schools/doctype/student_batch_instructor/student_batch_instructor.json b/erpnext/schools/doctype/student_batch_instructor/student_batch_instructor.json
new file mode 100644
index 0000000..29680fb
--- /dev/null
+++ b/erpnext/schools/doctype/student_batch_instructor/student_batch_instructor.json
@@ -0,0 +1,123 @@
+{
+ "allow_copy": 0, 
+ "allow_import": 0, 
+ "allow_rename": 0, 
+ "beta": 0, 
+ "creation": "2016-11-21 19:04:48.211565", 
+ "custom": 0, 
+ "docstatus": 0, 
+ "doctype": "DocType", 
+ "document_type": "", 
+ "editable_grid": 1, 
+ "engine": "InnoDB", 
+ "fields": [
+  {
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "instructor", 
+   "fieldtype": "Link", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_list_view": 1, 
+   "in_standard_filter": 0, 
+   "label": "Instructor", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "Instructor", 
+   "permlevel": 0, 
+   "precision": "", 
+   "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_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "column_break_2", 
+   "fieldtype": "Column Break", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 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_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "instructor_name", 
+   "fieldtype": "Read Only", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_list_view": 1, 
+   "in_standard_filter": 0, 
+   "label": "Instructor Name", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "instructor.instructor_name", 
+   "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, 
+ "hide_toolbar": 0, 
+ "idx": 0, 
+ "image_view": 0, 
+ "in_create": 0, 
+ "in_dialog": 0, 
+ "is_submittable": 0, 
+ "issingle": 0, 
+ "istable": 1, 
+ "max_attachments": 0, 
+ "modified": "2016-11-21 19:08:07.680320", 
+ "modified_by": "Administrator", 
+ "module": "Schools", 
+ "name": "Student Batch Instructor", 
+ "name_case": "", 
+ "owner": "Administrator", 
+ "permissions": [], 
+ "quick_entry": 1, 
+ "read_only": 0, 
+ "read_only_onload": 0, 
+ "sort_field": "modified", 
+ "sort_order": "DESC", 
+ "track_seen": 0
+}
\ No newline at end of file
diff --git a/erpnext/schools/doctype/student_batch_instructor/student_batch_instructor.py b/erpnext/schools/doctype/student_batch_instructor/student_batch_instructor.py
new file mode 100644
index 0000000..19a759d
--- /dev/null
+++ b/erpnext/schools/doctype/student_batch_instructor/student_batch_instructor.py
@@ -0,0 +1,10 @@
+# -*- coding: utf-8 -*-
+# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and contributors
+# For license information, please see license.txt
+
+from __future__ import unicode_literals
+import frappe
+from frappe.model.document import Document
+
+class StudentBatchInstructor(Document):
+	pass
diff --git a/erpnext/schools/doctype/scheduling_tool/__init__.py b/erpnext/schools/doctype/student_batch_name/__init__.py
similarity index 100%
copy from erpnext/schools/doctype/scheduling_tool/__init__.py
copy to erpnext/schools/doctype/student_batch_name/__init__.py
diff --git a/erpnext/schools/doctype/student_batch_name/student_batch_name.js b/erpnext/schools/doctype/student_batch_name/student_batch_name.js
new file mode 100644
index 0000000..7ed3021
--- /dev/null
+++ b/erpnext/schools/doctype/student_batch_name/student_batch_name.js
@@ -0,0 +1,8 @@
+// Copyright (c) 2016, Frappe Technologies Pvt. Ltd. and contributors
+// For license information, please see license.txt
+
+frappe.ui.form.on('Student Batch Name', {
+	refresh: function(frm) {
+
+	}
+});
diff --git a/erpnext/schools/doctype/student_batch_name/student_batch_name.json b/erpnext/schools/doctype/student_batch_name/student_batch_name.json
new file mode 100644
index 0000000..7f5f16d
--- /dev/null
+++ b/erpnext/schools/doctype/student_batch_name/student_batch_name.json
@@ -0,0 +1,89 @@
+{
+ "allow_copy": 0, 
+ "allow_import": 0, 
+ "allow_rename": 0, 
+ "autoname": "field:batch_name", 
+ "beta": 0, 
+ "creation": "2016-11-17 18:45:57.965091", 
+ "custom": 0, 
+ "docstatus": 0, 
+ "doctype": "DocType", 
+ "document_type": "Setup", 
+ "editable_grid": 1, 
+ "engine": "InnoDB", 
+ "fields": [
+  {
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "batch_name", 
+   "fieldtype": "Data", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Batch Name", 
+   "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": 1, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }
+ ], 
+ "hide_heading": 0, 
+ "hide_toolbar": 0, 
+ "idx": 0, 
+ "image_view": 0, 
+ "in_create": 0, 
+ "in_dialog": 0, 
+ "is_submittable": 0, 
+ "issingle": 0, 
+ "istable": 0, 
+ "max_attachments": 0, 
+ "modified": "2016-11-21 16:31:50.775958", 
+ "modified_by": "Administrator", 
+ "module": "Schools", 
+ "name": "Student Batch Name", 
+ "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, 
+   "is_custom": 0, 
+   "permlevel": 0, 
+   "print": 1, 
+   "read": 1, 
+   "report": 1, 
+   "role": "Academics User", 
+   "set_user_permissions": 0, 
+   "share": 1, 
+   "submit": 0, 
+   "write": 1
+  }
+ ], 
+ "quick_entry": 1, 
+ "read_only": 0, 
+ "read_only_onload": 0, 
+ "sort_field": "modified", 
+ "sort_order": "DESC", 
+ "track_seen": 0
+}
\ No newline at end of file
diff --git a/erpnext/schools/doctype/student_batch_name/student_batch_name.py b/erpnext/schools/doctype/student_batch_name/student_batch_name.py
new file mode 100644
index 0000000..e6d38ea
--- /dev/null
+++ b/erpnext/schools/doctype/student_batch_name/student_batch_name.py
@@ -0,0 +1,10 @@
+# -*- coding: utf-8 -*-
+# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and contributors
+# For license information, please see license.txt
+
+from __future__ import unicode_literals
+import frappe
+from frappe.model.document import Document
+
+class StudentBatchName(Document):
+	pass
diff --git a/erpnext/schools/doctype/student_batch_name/test_student_batch_name.py b/erpnext/schools/doctype/student_batch_name/test_student_batch_name.py
new file mode 100644
index 0000000..09534f3
--- /dev/null
+++ b/erpnext/schools/doctype/student_batch_name/test_student_batch_name.py
@@ -0,0 +1,12 @@
+# -*- coding: utf-8 -*-
+# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
+# See license.txt
+from __future__ import unicode_literals
+
+import frappe
+import unittest
+
+# test_records = frappe.get_test_records('Student Batch Name')
+
+class TestStudentBatchName(unittest.TestCase):
+	pass
diff --git a/erpnext/schools/doctype/student_group/student_group.js b/erpnext/schools/doctype/student_group/student_group.js
index 784f557..6f4084b 100644
--- a/erpnext/schools/doctype/student_group/student_group.js
+++ b/erpnext/schools/doctype/student_group/student_group.js
@@ -1,34 +1,36 @@
 cur_frm.add_fetch("student", "title", "student_name");
 
-frappe.ui.form.on("Student Group", "refresh", function(frm) {
-	if(!frm.doc.__islocal) {
-		frm.add_custom_button(__("Course Schedule"), function() {
-			frappe.route_options = {
-				student_group: frm.doc.name
-			}
-			frappe.set_route("List", "Course Schedule");
-		});
-		
-		frm.add_custom_button(__("Assessment"), function() {
-			frappe.route_options = {
-				student_group: frm.doc.name
-			}
-			frappe.set_route("List", "Assessment");
-		});
-	}
-});
+frappe.ui.form.on("Student Group", {
+    refresh: function(frm) {
+        if (!frm.doc.__islocal) {
+            frm.add_custom_button(__("Course Schedule"), function() {
+                frappe.route_options = {
+                    student_group: frm.doc.name
+                }
+                frappe.set_route("List", "Course Schedule");
+            });
 
-frappe.ui.form.on("Student Group", "onload", function(frm){
-	cur_frm.set_query("academic_term",function(){
-		return{
-			"filters":{
-				"academic_year": (frm.doc.academic_year)
-			}
-		};
-	});
+            frm.add_custom_button(__("Assessment"), function() {
+                frappe.route_options = {
+                    student_group: frm.doc.name
+                }
+                frappe.set_route("List", "Assessment");
+            });
+        }
+    },
+
+    onload: function(frm) {
+        cur_frm.set_query("academic_term", function() {
+            return {
+                "filters": {
+                    "academic_year": (frm.doc.academic_year)
+                }
+            };
+        });
+    }
 });
 
 //If Student Batch is entered, deduce program, academic_year and academic term from it
 cur_frm.add_fetch("student_batch", "program", "program");
 cur_frm.add_fetch("student_batch", "academic_term", "academic_term");
-cur_frm.add_fetch("student_batch", "academic_year", "academic_year");
+cur_frm.add_fetch("student_batch", "academic_year", "academic_year");
\ No newline at end of file
diff --git a/erpnext/schools/doctype/student_group/student_group.json b/erpnext/schools/doctype/student_group/student_group.json
index adab0c7..9e44f51 100644
--- a/erpnext/schools/doctype/student_group/student_group.json
+++ b/erpnext/schools/doctype/student_group/student_group.json
@@ -311,7 +311,7 @@
  "istable": 0, 
  "max_attachments": 0, 
  "menu_index": 0, 
- "modified": "2016-11-07 05:26:38.673266", 
+ "modified": "2016-12-01 12:57:17.125085", 
  "modified_by": "Administrator", 
  "module": "Schools", 
  "name": "Student Group", 
@@ -322,6 +322,27 @@
    "amend": 0, 
    "apply_user_permissions": 0, 
    "cancel": 0, 
+   "create": 0, 
+   "delete": 0, 
+   "email": 0, 
+   "export": 0, 
+   "if_owner": 0, 
+   "import": 0, 
+   "is_custom": 0, 
+   "permlevel": 0, 
+   "print": 0, 
+   "read": 1, 
+   "report": 0, 
+   "role": "Instructor", 
+   "set_user_permissions": 0, 
+   "share": 0, 
+   "submit": 0, 
+   "write": 0
+  }, 
+  {
+   "amend": 0, 
+   "apply_user_permissions": 0, 
+   "cancel": 0, 
    "create": 1, 
    "delete": 1, 
    "email": 1, 
diff --git a/erpnext/schools/doctype/scheduling_tool/__init__.py b/erpnext/schools/doctype/student_leave_application/__init__.py
similarity index 100%
copy from erpnext/schools/doctype/scheduling_tool/__init__.py
copy to erpnext/schools/doctype/student_leave_application/__init__.py
diff --git a/erpnext/schools/doctype/student_leave_application/student_leave_application.js b/erpnext/schools/doctype/student_leave_application/student_leave_application.js
new file mode 100644
index 0000000..4746148
--- /dev/null
+++ b/erpnext/schools/doctype/student_leave_application/student_leave_application.js
@@ -0,0 +1,8 @@
+// Copyright (c) 2016, Frappe Technologies Pvt. Ltd. and contributors
+// For license information, please see license.txt
+
+frappe.ui.form.on('Student Leave Application', {
+	refresh: function(frm) {
+
+	}
+});
diff --git a/erpnext/schools/doctype/student_leave_application/student_leave_application.json b/erpnext/schools/doctype/student_leave_application/student_leave_application.json
new file mode 100644
index 0000000..238b134
--- /dev/null
+++ b/erpnext/schools/doctype/student_leave_application/student_leave_application.json
@@ -0,0 +1,280 @@
+{
+ "allow_copy": 0, 
+ "allow_import": 0, 
+ "allow_rename": 0, 
+ "autoname": "SLA.######", 
+ "beta": 0, 
+ "creation": "2016-11-28 15:38:54.793854", 
+ "custom": 0, 
+ "docstatus": 0, 
+ "doctype": "DocType", 
+ "document_type": "", 
+ "editable_grid": 1, 
+ "engine": "InnoDB", 
+ "fields": [
+  {
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "student", 
+   "fieldtype": "Link", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Student", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "Student", 
+   "permlevel": 0, 
+   "precision": "", 
+   "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_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "student_name", 
+   "fieldtype": "Read Only", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Student Name", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "student.title", 
+   "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_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "column_break_3", 
+   "fieldtype": "Column Break", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "", 
+   "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_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "date", 
+   "fieldtype": "Date", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_list_view": 1, 
+   "in_standard_filter": 0, 
+   "label": "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": 1, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "section_break_5", 
+   "fieldtype": "Section Break", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 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_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "reason", 
+   "fieldtype": "Text", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Reason", 
+   "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_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "amended_from", 
+   "fieldtype": "Link", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Amended From", 
+   "length": 0, 
+   "no_copy": 1, 
+   "options": "Student Leave Application", 
+   "permlevel": 0, 
+   "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
+  }
+ ], 
+ "hide_heading": 0, 
+ "hide_toolbar": 0, 
+ "idx": 0, 
+ "image_view": 0, 
+ "in_create": 0, 
+ "in_dialog": 0, 
+ "is_submittable": 1, 
+ "issingle": 0, 
+ "istable": 0, 
+ "max_attachments": 0, 
+ "modified": "2016-12-01 12:57:55.914656", 
+ "modified_by": "Administrator", 
+ "module": "Schools", 
+ "name": "Student Leave Application", 
+ "name_case": "", 
+ "owner": "Administrator", 
+ "permissions": [
+  {
+   "amend": 1, 
+   "apply_user_permissions": 0, 
+   "cancel": 1, 
+   "create": 1, 
+   "delete": 1, 
+   "email": 1, 
+   "export": 0, 
+   "if_owner": 0, 
+   "import": 0, 
+   "is_custom": 0, 
+   "permlevel": 0, 
+   "print": 1, 
+   "read": 1, 
+   "report": 1, 
+   "role": "Instructor", 
+   "set_user_permissions": 0, 
+   "share": 0, 
+   "submit": 1, 
+   "write": 1
+  }, 
+  {
+   "amend": 1, 
+   "apply_user_permissions": 0, 
+   "cancel": 1, 
+   "create": 1, 
+   "delete": 1, 
+   "email": 1, 
+   "export": 1, 
+   "if_owner": 0, 
+   "import": 0, 
+   "is_custom": 0, 
+   "permlevel": 0, 
+   "print": 1, 
+   "read": 1, 
+   "report": 1, 
+   "role": "Academics User", 
+   "set_user_permissions": 0, 
+   "share": 1, 
+   "submit": 1, 
+   "write": 1
+  }
+ ], 
+ "quick_entry": 1, 
+ "read_only": 0, 
+ "read_only_onload": 0, 
+ "sort_field": "modified", 
+ "sort_order": "DESC", 
+ "title_field": "student_name", 
+ "track_seen": 0
+}
\ No newline at end of file
diff --git a/erpnext/schools/doctype/student_leave_application/student_leave_application.py b/erpnext/schools/doctype/student_leave_application/student_leave_application.py
new file mode 100644
index 0000000..4a36590
--- /dev/null
+++ b/erpnext/schools/doctype/student_leave_application/student_leave_application.py
@@ -0,0 +1,10 @@
+# -*- coding: utf-8 -*-
+# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and contributors
+# For license information, please see license.txt
+
+from __future__ import unicode_literals
+import frappe
+from frappe.model.document import Document
+
+class StudentLeaveApplication(Document):
+	pass
diff --git a/erpnext/schools/doctype/student_leave_application/test_student_leave_application.py b/erpnext/schools/doctype/student_leave_application/test_student_leave_application.py
new file mode 100644
index 0000000..ddb30ac
--- /dev/null
+++ b/erpnext/schools/doctype/student_leave_application/test_student_leave_application.py
@@ -0,0 +1,12 @@
+# -*- coding: utf-8 -*-
+# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
+# See license.txt
+from __future__ import unicode_literals
+
+import frappe
+import unittest
+
+# test_records = frappe.get_test_records('Student Leave Application')
+
+class TestStudentLeaveApplication(unittest.TestCase):
+	pass
diff --git a/erpnext/schools/doctype/scheduling_tool/__init__.py b/erpnext/schools/report/absent_student_report/__init__.py
similarity index 100%
copy from erpnext/schools/doctype/scheduling_tool/__init__.py
copy to erpnext/schools/report/absent_student_report/__init__.py
diff --git a/erpnext/schools/report/absent_student_report/absent_student_report.js b/erpnext/schools/report/absent_student_report/absent_student_report.js
new file mode 100644
index 0000000..7515f22
--- /dev/null
+++ b/erpnext/schools/report/absent_student_report/absent_student_report.js
@@ -0,0 +1,15 @@
+// Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
+// License: GNU General Public License v3. See license.txt
+
+
+frappe.query_reports["Absent Student Report"] = {
+	"filters": [
+		{
+			"fieldname":"date",
+			"label": __("Date"),
+			"fieldtype": "Date",
+			"default": get_today(),
+			"reqd": 1
+		}
+	]
+}
diff --git a/erpnext/schools/report/absent_student_report/absent_student_report.json b/erpnext/schools/report/absent_student_report/absent_student_report.json
new file mode 100644
index 0000000..5f3ca71
--- /dev/null
+++ b/erpnext/schools/report/absent_student_report/absent_student_report.json
@@ -0,0 +1,18 @@
+{
+ "add_total_row": 0, 
+ "apply_user_permissions": 1, 
+ "creation": "2013-05-13 14:04:03", 
+ "disabled": 0, 
+ "docstatus": 0, 
+ "doctype": "Report", 
+ "idx": 1, 
+ "is_standard": "Yes", 
+ "modified": "2016-12-01 14:28:27.184668", 
+ "modified_by": "Administrator", 
+ "module": "Schools", 
+ "name": "Absent Student Report", 
+ "owner": "Administrator", 
+ "ref_doctype": "Student Attendance", 
+ "report_name": "Absent Student Report", 
+ "report_type": "Script Report"
+}
\ No newline at end of file
diff --git a/erpnext/schools/report/absent_student_report/absent_student_report.py b/erpnext/schools/report/absent_student_report/absent_student_report.py
new file mode 100644
index 0000000..82a20aa
--- /dev/null
+++ b/erpnext/schools/report/absent_student_report/absent_student_report.py
@@ -0,0 +1,60 @@
+# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
+# License: GNU General Public License v3. See license.txt
+
+from __future__ import unicode_literals
+import frappe
+from frappe.utils import cstr, cint, getdate
+from frappe import msgprint, _
+
+def execute(filters=None):
+	if not filters: filters = {}
+
+	if not filters.get("date"):
+		msgprint(_("Please select date"), raise_exception=1)
+	
+	columns = get_columns(filters)
+
+	absent_students = get_absent_students(filters.get("date"))
+	leave_applicants = get_leave_applications(filters.get("date"))
+
+	data = []
+	for student in absent_students:
+		if not student.student in leave_applicants:
+			row = [student.student, student.student_name, student.student_batch]
+			stud_details = frappe.db.get_value("Student", student.student, ['student_email_id', 'student_mobile_number'], as_dict=True)
+			
+			if stud_details.student_email_id:
+				row+=[stud_details.student_email_id]
+			else:
+				row+= [""]
+			
+			if stud_details.student_mobile_number:
+				row+=[stud_details.student_mobile_number]
+			else:
+				row+= [""]
+				
+			data.append(row)
+	
+	return columns, data
+
+def get_columns(filters):
+	columns = [ 
+		_("Student") + ":Link/Student:90", 
+		_("Student Name") + "::150", 
+		_("Student Batch") + "::180",
+		_("Student Email ID") + "::180",
+		_("Student Mobile No.") + "::150",
+	]
+	return columns
+
+def get_absent_students(date):
+	absent_students = frappe.db.sql("""select student, student_name, student_batch from `tabStudent Attendance` 
+		where docstatus = 1 and status="Absent" and date = %s order by student_batch, student_name""", date, as_dict=1)
+	return absent_students
+
+def get_leave_applications(date):
+	leave_applicants = []
+	for student in frappe.db.sql("""select student from `tabStudent Leave Application` 
+		where docstatus = 1 and date = %s""", date):
+		leave_applicants.append(student[0])
+	return leave_applicants
\ No newline at end of file
diff --git a/erpnext/schools/doctype/scheduling_tool/__init__.py b/erpnext/schools/report/student_batch_wise_attendance/__init__.py
similarity index 100%
copy from erpnext/schools/doctype/scheduling_tool/__init__.py
copy to erpnext/schools/report/student_batch_wise_attendance/__init__.py
diff --git a/erpnext/schools/report/student_batch_wise_attendance/student_batch_wise_attendance.js b/erpnext/schools/report/student_batch_wise_attendance/student_batch_wise_attendance.js
new file mode 100644
index 0000000..51f7346
--- /dev/null
+++ b/erpnext/schools/report/student_batch_wise_attendance/student_batch_wise_attendance.js
@@ -0,0 +1,12 @@
+// Copyright (c) 2016, Frappe Technologies Pvt. Ltd. and contributors
+// For license information, please see license.txt
+
+frappe.query_reports["Student Batch-Wise Attendance"] = {
+    "filters": [{
+        "fieldname": "date",
+        "label": __("Date"),
+        "fieldtype": "Date",
+        "default": get_today(),
+        "reqd": 1
+    }]
+}
\ No newline at end of file
diff --git a/erpnext/schools/report/student_batch_wise_attendance/student_batch_wise_attendance.json b/erpnext/schools/report/student_batch_wise_attendance/student_batch_wise_attendance.json
new file mode 100644
index 0000000..8e5e483
--- /dev/null
+++ b/erpnext/schools/report/student_batch_wise_attendance/student_batch_wise_attendance.json
@@ -0,0 +1,18 @@
+{
+ "add_total_row": 0, 
+ "apply_user_permissions": 1, 
+ "creation": "2016-11-28 22:07:03.859124", 
+ "disabled": 0, 
+ "docstatus": 0, 
+ "doctype": "Report", 
+ "idx": 0, 
+ "is_standard": "Yes", 
+ "modified": "2016-12-01 15:48:50.120579", 
+ "modified_by": "Administrator", 
+ "module": "Schools", 
+ "name": "Student Batch-Wise Attendance", 
+ "owner": "Administrator", 
+ "ref_doctype": "Student Attendance", 
+ "report_name": "Student Batch-Wise Attendance", 
+ "report_type": "Script Report"
+}
\ No newline at end of file
diff --git a/erpnext/schools/report/student_batch_wise_attendance/student_batch_wise_attendance.py b/erpnext/schools/report/student_batch_wise_attendance/student_batch_wise_attendance.py
new file mode 100644
index 0000000..eaf090e
--- /dev/null
+++ b/erpnext/schools/report/student_batch_wise_attendance/student_batch_wise_attendance.py
@@ -0,0 +1,64 @@
+# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
+# License: GNU General Public License v3. See license.txt
+
+from __future__ import unicode_literals
+import frappe
+from frappe.utils import cstr, cint, getdate
+from frappe import msgprint, _
+
+def execute(filters=None):
+	if not filters: filters = {}
+
+	if not filters.get("date"):
+		msgprint(_("Please select date"), raise_exception=1)
+	
+	columns = get_columns(filters)
+
+	active_student_batch = get_active_student_batch()
+
+	data = []
+	for student_batch in active_student_batch:
+		row = [student_batch.name]
+		present_students = 0
+		absent_students = 0
+		student_batch_strength = get_student_batch_strength(student_batch.name)
+		student_attendance = get_student_attendance(student_batch.name, filters.get("date"))
+		if student_attendance:
+			for attendance in student_attendance:
+				if attendance.status== "Present":
+					present_students = attendance.count
+				elif attendance.status== "Absent":
+					absent_students = attendance.count
+
+		unmarked_students = student_batch_strength - (present_students + absent_students)
+		row+= [student_batch_strength, present_students, absent_students, unmarked_students]
+		data.append(row)
+
+	return columns, data
+
+def get_columns(filters):
+	columns = [ 
+		_("Student batch") + ":Link/Student Batch:250", 
+		_("Student batch Strength") + "::170", 
+		_("Present") + "::90", 
+		_("Absent") + "::90",
+		_("Not Marked") + "::90"
+	]
+	return columns
+
+def get_active_student_batch():
+	active_student_batch = frappe.db.sql("""select name from `tabStudent Batch` 
+		where active = 1 order by name""", as_dict=1)
+	return active_student_batch
+
+def get_student_batch_strength(student_batch):
+	student_batch_strength = frappe.db.sql("""select count(*) from `tabStudent Batch Student` 
+		where parent = %s""", student_batch)[0][0]
+	return student_batch_strength
+
+def get_student_attendance(student_batch, date):
+	student_attendance = frappe.db.sql("""select count(*) as count, status from `tabStudent Attendance` where \
+				student_batch= %s and date= %s and docstatus=1 and\
+				(course_schedule is Null or course_schedule='') group by status""",
+				(student_batch, date), as_dict=1)
+	return student_attendance
\ No newline at end of file
diff --git a/erpnext/schools/doctype/scheduling_tool/__init__.py b/erpnext/schools/report/student_monthly_attendance_sheet/__init__.py
similarity index 100%
copy from erpnext/schools/doctype/scheduling_tool/__init__.py
copy to erpnext/schools/report/student_monthly_attendance_sheet/__init__.py
diff --git a/erpnext/schools/report/student_monthly_attendance_sheet/student_monthly_attendance_sheet.js b/erpnext/schools/report/student_monthly_attendance_sheet/student_monthly_attendance_sheet.js
new file mode 100644
index 0000000..32c0551
--- /dev/null
+++ b/erpnext/schools/report/student_monthly_attendance_sheet/student_monthly_attendance_sheet.js
@@ -0,0 +1,42 @@
+// Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
+// License: GNU General Public License v3. See license.txt
+
+
+frappe.query_reports["Student Monthly Attendance Sheet"] = {
+	"filters": [
+		{
+			"fieldname":"month",
+			"label": __("Month"),
+			"fieldtype": "Select",
+			"options": "Jan\nFeb\nMar\nApr\nMay\nJun\nJul\nAug\nSep\nOct\nNov\nDec",
+			"default": ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov",
+				"Dec"][frappe.datetime.str_to_obj(frappe.datetime.get_today()).getMonth()],
+		},
+		{
+			"fieldname":"year",
+			"label": __("Year"),
+			"fieldtype": "Select",
+			"reqd": 1
+		},
+		{
+			"fieldname":"student_batch",
+			"label": __("Student Batch"),
+			"fieldtype": "Link",
+			"options": "Student Batch",
+			"reqd": 1
+		}
+	],
+
+	"onload": function() {
+		return  frappe.call({
+			method: "erpnext.schools.report.student_monthly_attendance_sheet.student_monthly_attendance_sheet.get_attendance_years",
+			callback: function(r) {
+				var year_filter = frappe.query_report_filters_by_name.year;
+				year_filter.df.options = r.message;
+				year_filter.df.default = r.message.split("\n")[0];
+				year_filter.refresh();
+				year_filter.set_input(year_filter.df.default);
+			}
+		});
+	}
+}
diff --git a/erpnext/schools/report/student_monthly_attendance_sheet/student_monthly_attendance_sheet.json b/erpnext/schools/report/student_monthly_attendance_sheet/student_monthly_attendance_sheet.json
new file mode 100644
index 0000000..1d8f4d0
--- /dev/null
+++ b/erpnext/schools/report/student_monthly_attendance_sheet/student_monthly_attendance_sheet.json
@@ -0,0 +1,18 @@
+{
+ "add_total_row": 0, 
+ "apply_user_permissions": 1, 
+ "creation": "2013-05-13 14:04:03", 
+ "disabled": 0, 
+ "docstatus": 0, 
+ "doctype": "Report", 
+ "idx": 1, 
+ "is_standard": "Yes", 
+ "modified": "2016-12-01 14:29:53.547378", 
+ "modified_by": "Administrator", 
+ "module": "Schools", 
+ "name": "Student Monthly Attendance Sheet", 
+ "owner": "Administrator", 
+ "ref_doctype": "Student Attendance", 
+ "report_name": "Student Monthly Attendance Sheet", 
+ "report_type": "Script Report"
+}
\ No newline at end of file
diff --git a/erpnext/schools/report/student_monthly_attendance_sheet/student_monthly_attendance_sheet.py b/erpnext/schools/report/student_monthly_attendance_sheet/student_monthly_attendance_sheet.py
new file mode 100644
index 0000000..8c6006e
--- /dev/null
+++ b/erpnext/schools/report/student_monthly_attendance_sheet/student_monthly_attendance_sheet.py
@@ -0,0 +1,82 @@
+# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
+# License: GNU General Public License v3. See license.txt
+
+from __future__ import unicode_literals
+import frappe
+from frappe.utils import cstr, cint, getdate
+from frappe import msgprint, _
+from calendar import monthrange
+from erpnext.schools.api import get_student_batch_students
+
+def execute(filters=None):
+	if not filters: filters = {}
+
+	conditions, filters = get_conditions(filters)
+	columns = get_columns(filters)
+	att_map = get_attendance_list(conditions, filters)
+	students = get_student_batch_students(filters.get("student_batch"))
+	data = []
+	for stud in students:
+		row = [stud.student, stud.student_name]
+
+		total_p = total_a = 0.0
+		for day in range(filters["total_days_in_month"]):
+			status="None"
+			if att_map.get(stud.student):
+				status = att_map.get(stud.student).get(day + 1, "None")
+			status_map = {"Present": "P", "Absent": "A", "None": ""}
+			row.append(status_map[status])
+
+			if status == "Present":
+				total_p += 1
+			elif status == "Absent":
+				total_a += 1
+		
+		row += [total_p, total_a]
+		data.append(row)
+
+	return columns, data
+
+def get_columns(filters):
+	columns = [ _("Student") + ":Link/Student:90", _("Student Name") + "::150"]
+
+	for day in range(filters["total_days_in_month"]):
+		columns.append(cstr(day+1) +"::20")
+
+	columns += [_("Total Present") + ":Int:95", _("Total Absent") + ":Int:90"]
+	return columns
+
+def get_attendance_list(conditions, filters):
+	attendance_list = frappe.db.sql("""select student, day(date) as day_of_month,
+		status from `tabStudent Attendance` where docstatus = 1 %s order by student, date""" %
+		conditions, filters, as_dict=1)
+
+	att_map = {}
+	for d in attendance_list:
+		att_map.setdefault(d.student, frappe._dict()).setdefault(d.day_of_month, "")
+		att_map[d.student][d.day_of_month] = d.status
+
+	return att_map
+
+def get_conditions(filters):
+	if not (filters.get("month") and filters.get("year")):
+		msgprint(_("Please select month and year"), raise_exception=1)
+
+	filters["month"] = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov",
+		"Dec"].index(filters.month) + 1
+
+	filters["total_days_in_month"] = monthrange(cint(filters.year), filters.month)[1]
+
+	conditions = " and month(date) = %(month)s and year(date) = %(year)s"
+
+	if filters.get("student_batch"): conditions += " and student_batch = %(student_batch)s"
+
+	return conditions, filters
+
+@frappe.whitelist()
+def get_attendance_years():
+	year_list = frappe.db.sql_list("""select distinct YEAR(date) from `tabStudent Attendance` ORDER BY YEAR(date) DESC""")
+	if not year_list:
+		year_list = [getdate().year]
+
+	return "\n".join(str(year) for year in year_list)
diff --git a/erpnext/selling/sales_common.js b/erpnext/selling/sales_common.js
index a04c652..97eca54 100644
--- a/erpnext/selling/sales_common.js
+++ b/erpnext/selling/sales_common.js
@@ -66,27 +66,42 @@
 			});
 		}
 
+		if(this.frm.fields_dict["packed_items"] &&
+			this.frm.fields_dict["packed_items"].grid.get_field('batch_no')) {
+			this.frm.set_query("batch_no", "packed_items", function(doc, cdt, cdn) {
+				return me.set_query_for_batch(doc, cdt, cdn)
+			});
+		}
+
 		if(this.frm.fields_dict["items"].grid.get_field('batch_no')) {
 			this.frm.set_query("batch_no", "items", function(doc, cdt, cdn) {
-				var item = frappe.get_doc(cdt, cdn);
-				if(!item.item_code) {
-					frappe.throw(__("Please enter Item Code to get batch no"));
-				} else {
-					filters = {
-						'item_code': item.item_code,
-						'posting_date': me.frm.doc.posting_date || frappe.datetime.nowdate(),
-					}
-					if(item.warehouse) filters["warehouse"] = item.warehouse
-
-					return {
-						query : "erpnext.controllers.queries.get_batch_no",
-						filters: filters
-					}
-				}
+				return me.set_query_for_batch(doc, cdt, cdn)
 			});
 		}
 	},
 
+	set_query_for_batch: function(doc, cdt, cdn) {
+		// Show item's batches in the dropdown of batch no
+
+		var me = this;
+		var item = frappe.get_doc(cdt, cdn);
+
+		if(!item.item_code) {
+			frappe.throw(__("Please enter Item Code to get batch no"));
+		} else {
+			filters = {
+				'item_code': item.item_code,
+				'posting_date': me.frm.doc.posting_date || frappe.datetime.nowdate(),
+			}
+			if(item.warehouse) filters["warehouse"] = item.warehouse
+
+			return {
+				query : "erpnext.controllers.queries.get_batch_no",
+				filters: filters
+			}
+		}
+	},
+
 	refresh: function() {
 		this._super();
 		this.frm.toggle_display("customer_name",
diff --git a/erpnext/setup/doctype/company/company.json b/erpnext/setup/doctype/company/company.json
index a003bde..338d10a 100644
--- a/erpnext/setup/doctype/company/company.json
+++ b/erpnext/setup/doctype/company/company.json
@@ -10,11 +10,13 @@
  "docstatus": 0, 
  "doctype": "DocType", 
  "document_type": "Setup", 
+ "editable_grid": 0, 
  "fields": [
   {
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "details", 
    "fieldtype": "Section Break", 
    "hidden": 0, 
@@ -22,6 +24,7 @@
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "in_standard_filter": 0, 
    "label": "", 
    "length": 0, 
    "no_copy": 0, 
@@ -30,6 +33,7 @@
    "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, 
@@ -40,6 +44,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "company_name", 
    "fieldtype": "Data", 
    "hidden": 0, 
@@ -47,6 +52,7 @@
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "in_standard_filter": 0, 
    "label": "Company", 
    "length": 0, 
    "no_copy": 0, 
@@ -56,6 +62,7 @@
    "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, 
@@ -66,6 +73,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "description": "", 
    "fieldname": "abbr", 
    "fieldtype": "Data", 
@@ -74,6 +82,7 @@
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "in_standard_filter": 0, 
    "label": "Abbr", 
    "length": 0, 
    "no_copy": 0, 
@@ -83,6 +92,7 @@
    "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, 
@@ -93,6 +103,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "depends_on": "eval:!doc.__islocal && in_list(user_roles, \"System Manager\")", 
    "fieldname": "change_abbr", 
    "fieldtype": "Button", 
@@ -101,6 +112,7 @@
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "in_standard_filter": 0, 
    "label": "Change Abbreviation", 
    "length": 0, 
    "no_copy": 0, 
@@ -108,6 +120,7 @@
    "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, 
@@ -118,6 +131,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "cb0", 
    "fieldtype": "Column Break", 
    "hidden": 0, 
@@ -125,12 +139,14 @@
    "ignore_xss_filter": 0, 
    "in_filter": 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, 
@@ -141,6 +157,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "domain", 
    "fieldtype": "Select", 
    "hidden": 0, 
@@ -148,6 +165,7 @@
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "in_standard_filter": 0, 
    "label": "Domain", 
    "length": 0, 
    "no_copy": 0, 
@@ -156,6 +174,7 @@
    "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, 
@@ -166,6 +185,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "charts_section", 
    "fieldtype": "Section Break", 
    "hidden": 0, 
@@ -173,6 +193,7 @@
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "in_standard_filter": 0, 
    "label": "Default Values", 
    "length": 0, 
    "no_copy": 0, 
@@ -180,6 +201,7 @@
    "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, 
@@ -190,6 +212,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "default_letter_head", 
    "fieldtype": "Link", 
    "hidden": 0, 
@@ -197,6 +220,7 @@
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "in_standard_filter": 0, 
    "label": "Default Letter Head", 
    "length": 0, 
    "no_copy": 0, 
@@ -206,6 +230,7 @@
    "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, 
@@ -216,6 +241,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "default_holiday_list", 
    "fieldtype": "Link", 
    "hidden": 0, 
@@ -223,6 +249,7 @@
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "in_standard_filter": 0, 
    "label": "Default Holiday List", 
    "length": 0, 
    "no_copy": 0, 
@@ -232,6 +259,7 @@
    "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, 
@@ -242,6 +270,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "default_terms", 
    "fieldtype": "Link", 
    "hidden": 0, 
@@ -249,6 +278,7 @@
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "in_standard_filter": 0, 
    "label": "Default Terms", 
    "length": 0, 
    "no_copy": 0, 
@@ -257,6 +287,7 @@
    "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, 
@@ -267,55 +298,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
-   "fieldname": "column_break_10", 
-   "fieldtype": "Column Break", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "ignore_xss_filter": 0, 
-   "in_filter": 0, 
-   "in_list_view": 0, 
-   "length": 0, 
-   "no_copy": 0, 
-   "permlevel": 0, 
-   "precision": "", 
-   "print_hide": 0, 
-   "print_hide_if_no_value": 0, 
-   "read_only": 0, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
-   "unique": 0
-  }, 
-  {
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "fieldname": "country", 
-   "fieldtype": "Link", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "ignore_xss_filter": 0, 
-   "in_filter": 0, 
-   "in_list_view": 1, 
-   "label": "Country", 
-   "length": 0, 
-   "no_copy": 0, 
-   "options": "Country", 
-   "permlevel": 0, 
-   "print_hide": 0, 
-   "print_hide_if_no_value": 0, 
-   "read_only": 0, 
-   "report_hide": 0, 
-   "reqd": 1, 
-   "search_index": 0, 
-   "set_only_once": 0, 
-   "unique": 0
-  }, 
-  {
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "default_currency", 
    "fieldtype": "Link", 
    "hidden": 0, 
@@ -323,6 +306,7 @@
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "in_standard_filter": 0, 
    "label": "Default Currency", 
    "length": 0, 
    "no_copy": 0, 
@@ -331,6 +315,7 @@
    "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, 
@@ -341,21 +326,23 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
-   "fieldname": "chart_of_accounts", 
-   "fieldtype": "Select", 
+   "columns": 0, 
+   "fieldname": "column_break_10", 
+   "fieldtype": "Column Break", 
    "hidden": 0, 
-   "ignore_user_permissions": 1, 
+   "ignore_user_permissions": 0, 
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
-   "label": "Chart of Accounts", 
+   "in_standard_filter": 0, 
    "length": 0, 
    "no_copy": 0, 
-   "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, 
@@ -366,6 +353,124 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "country", 
+   "fieldtype": "Link", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_list_view": 1, 
+   "in_standard_filter": 0, 
+   "label": "Country", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "Country", 
+   "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_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "create_chart_of_accounts_based_on", 
+   "fieldtype": "Select", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Create Chart Of Accounts Based On", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "Standard Template\nExisting Company", 
+   "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_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "depends_on": "eval:doc.create_chart_of_accounts_based_on===\"Standard Template\"", 
+   "fieldname": "chart_of_accounts", 
+   "fieldtype": "Select", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Chart Of Accounts Template", 
+   "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_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "depends_on": "eval:doc.create_chart_of_accounts_based_on===\"Existing Company\"", 
+   "fieldname": "existing_company", 
+   "fieldtype": "Link", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Existing Company ", 
+   "length": 0, 
+   "no_copy": 1, 
+   "options": "Company", 
+   "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_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "default_settings", 
    "fieldtype": "Section Break", 
    "hidden": 0, 
@@ -373,6 +478,7 @@
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "in_standard_filter": 0, 
    "label": "Accounts Settings", 
    "length": 0, 
    "no_copy": 0, 
@@ -381,6 +487,7 @@
    "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, 
@@ -391,6 +498,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "depends_on": "eval:!doc.__islocal", 
    "fieldname": "default_bank_account", 
    "fieldtype": "Link", 
@@ -399,6 +507,7 @@
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "in_standard_filter": 0, 
    "label": "Default Bank Account", 
    "length": 0, 
    "no_copy": 1, 
@@ -409,6 +518,7 @@
    "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, 
@@ -419,6 +529,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "depends_on": "eval:!doc.__islocal", 
    "fieldname": "default_cash_account", 
    "fieldtype": "Link", 
@@ -427,6 +538,7 @@
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "in_standard_filter": 0, 
    "label": "Default Cash Account", 
    "length": 0, 
    "no_copy": 1, 
@@ -435,6 +547,7 @@
    "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, 
@@ -445,6 +558,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "depends_on": "eval:!doc.__islocal", 
    "fieldname": "default_receivable_account", 
    "fieldtype": "Link", 
@@ -453,6 +567,7 @@
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "in_standard_filter": 0, 
    "label": "Default Receivable Account", 
    "length": 0, 
    "no_copy": 1, 
@@ -463,6 +578,7 @@
    "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, 
@@ -473,6 +589,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "round_off_account", 
    "fieldtype": "Link", 
    "hidden": 0, 
@@ -480,6 +597,7 @@
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "in_standard_filter": 0, 
    "label": "Round Off Account", 
    "length": 0, 
    "no_copy": 0, 
@@ -489,6 +607,7 @@
    "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, 
@@ -499,6 +618,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "write_off_account", 
    "fieldtype": "Link", 
    "hidden": 0, 
@@ -506,6 +626,7 @@
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "in_standard_filter": 0, 
    "label": "Write Off Account", 
    "length": 0, 
    "no_copy": 0, 
@@ -515,6 +636,7 @@
    "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, 
@@ -525,6 +647,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "exchange_gain_loss_account", 
    "fieldtype": "Link", 
    "hidden": 0, 
@@ -532,6 +655,7 @@
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "in_standard_filter": 0, 
    "label": "Exchange Gain / Loss Account", 
    "length": 0, 
    "no_copy": 0, 
@@ -541,6 +665,7 @@
    "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, 
@@ -551,6 +676,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "column_break0", 
    "fieldtype": "Column Break", 
    "hidden": 0, 
@@ -558,6 +684,7 @@
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "in_standard_filter": 0, 
    "length": 0, 
    "no_copy": 0, 
    "oldfieldtype": "Column Break", 
@@ -565,6 +692,7 @@
    "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, 
@@ -576,6 +704,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "depends_on": "eval:!doc.__islocal", 
    "fieldname": "default_payable_account", 
    "fieldtype": "Link", 
@@ -584,6 +713,7 @@
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "in_standard_filter": 0, 
    "label": "Default Payable Account", 
    "length": 0, 
    "no_copy": 1, 
@@ -594,6 +724,7 @@
    "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, 
@@ -604,6 +735,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "depends_on": "eval:!doc.__islocal", 
    "fieldname": "default_expense_account", 
    "fieldtype": "Link", 
@@ -612,6 +744,7 @@
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "in_standard_filter": 0, 
    "label": "Default Cost of Goods Sold Account", 
    "length": 0, 
    "no_copy": 1, 
@@ -620,6 +753,7 @@
    "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, 
@@ -630,6 +764,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "depends_on": "eval:!doc.__islocal", 
    "fieldname": "default_income_account", 
    "fieldtype": "Link", 
@@ -638,6 +773,7 @@
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "in_standard_filter": 0, 
    "label": "Default Income Account", 
    "length": 0, 
    "no_copy": 1, 
@@ -646,6 +782,7 @@
    "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, 
@@ -656,6 +793,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "round_off_cost_center", 
    "fieldtype": "Link", 
    "hidden": 0, 
@@ -663,6 +801,7 @@
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "in_standard_filter": 0, 
    "label": "Round Off Cost Center", 
    "length": 0, 
    "no_copy": 0, 
@@ -672,6 +811,7 @@
    "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, 
@@ -682,6 +822,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "section_break_22", 
    "fieldtype": "Section Break", 
    "hidden": 0, 
@@ -689,6 +830,7 @@
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "in_standard_filter": 0, 
    "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
@@ -696,6 +838,7 @@
    "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, 
@@ -706,6 +849,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "depends_on": "eval:!doc.__islocal", 
    "fieldname": "cost_center", 
    "fieldtype": "Link", 
@@ -714,6 +858,7 @@
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "in_standard_filter": 0, 
    "label": "Default Cost Center", 
    "length": 0, 
    "no_copy": 1, 
@@ -722,6 +867,7 @@
    "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, 
@@ -732,6 +878,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "depends_on": "eval:!doc.__islocal", 
    "fieldname": "credit_limit", 
    "fieldtype": "Currency", 
@@ -740,6 +887,7 @@
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "in_standard_filter": 0, 
    "label": "Credit Limit", 
    "length": 0, 
    "no_copy": 0, 
@@ -750,6 +898,7 @@
    "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, 
@@ -760,6 +909,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "column_break_26", 
    "fieldtype": "Column Break", 
    "hidden": 0, 
@@ -767,6 +917,7 @@
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "in_standard_filter": 0, 
    "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
@@ -774,6 +925,7 @@
    "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, 
@@ -784,6 +936,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "credit_days_based_on", 
    "fieldtype": "Select", 
    "hidden": 0, 
@@ -791,6 +944,7 @@
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "in_standard_filter": 0, 
    "label": "Credit Days Based On", 
    "length": 0, 
    "no_copy": 0, 
@@ -800,6 +954,7 @@
    "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, 
@@ -810,6 +965,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "depends_on": "eval:(!doc.__islocal && doc.credit_days_based_on=='Fixed Days')", 
    "fieldname": "credit_days", 
    "fieldtype": "Int", 
@@ -818,6 +974,7 @@
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "in_standard_filter": 0, 
    "label": "Credit Days", 
    "length": 0, 
    "no_copy": 0, 
@@ -827,6 +984,7 @@
    "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, 
@@ -837,6 +995,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "depends_on": "eval:!doc.__islocal", 
    "fieldname": "auto_accounting_for_stock_settings", 
    "fieldtype": "Section Break", 
@@ -845,6 +1004,7 @@
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "in_standard_filter": 0, 
    "label": "Stock Settings", 
    "length": 0, 
    "no_copy": 0, 
@@ -852,6 +1012,7 @@
    "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, 
@@ -862,6 +1023,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "stock_received_but_not_billed", 
    "fieldtype": "Link", 
    "hidden": 0, 
@@ -869,6 +1031,7 @@
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "in_standard_filter": 0, 
    "label": "Stock Received But Not Billed", 
    "length": 0, 
    "no_copy": 1, 
@@ -877,6 +1040,7 @@
    "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, 
@@ -887,6 +1051,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "stock_adjustment_account", 
    "fieldtype": "Link", 
    "hidden": 0, 
@@ -894,6 +1059,7 @@
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "in_standard_filter": 0, 
    "label": "Stock Adjustment Account", 
    "length": 0, 
    "no_copy": 1, 
@@ -902,6 +1068,7 @@
    "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, 
@@ -912,6 +1079,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "column_break_32", 
    "fieldtype": "Column Break", 
    "hidden": 0, 
@@ -919,6 +1087,7 @@
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "in_standard_filter": 0, 
    "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
@@ -926,6 +1095,7 @@
    "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, 
@@ -936,6 +1106,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "expenses_included_in_valuation", 
    "fieldtype": "Link", 
    "hidden": 0, 
@@ -943,6 +1114,7 @@
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "in_standard_filter": 0, 
    "label": "Expenses Included In Valuation", 
    "length": 0, 
    "no_copy": 1, 
@@ -951,6 +1123,7 @@
    "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, 
@@ -961,6 +1134,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "fixed_asset_depreciation_settings", 
    "fieldtype": "Section Break", 
    "hidden": 0, 
@@ -968,6 +1142,7 @@
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "in_standard_filter": 0, 
    "label": "Fixed Asset Depreciation Settings", 
    "length": 0, 
    "no_copy": 0, 
@@ -976,6 +1151,7 @@
    "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, 
@@ -986,6 +1162,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "accumulated_depreciation_account", 
    "fieldtype": "Link", 
    "hidden": 0, 
@@ -993,6 +1170,7 @@
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "in_standard_filter": 0, 
    "label": "Accumulated Depreciation Account", 
    "length": 0, 
    "no_copy": 1, 
@@ -1002,6 +1180,7 @@
    "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, 
@@ -1012,6 +1191,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "depreciation_expense_account", 
    "fieldtype": "Link", 
    "hidden": 0, 
@@ -1019,6 +1199,7 @@
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "in_standard_filter": 0, 
    "label": "Depreciation Expense Account", 
    "length": 0, 
    "no_copy": 1, 
@@ -1028,6 +1209,7 @@
    "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, 
@@ -1038,6 +1220,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "column_break_40", 
    "fieldtype": "Column Break", 
    "hidden": 0, 
@@ -1045,6 +1228,7 @@
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "in_standard_filter": 0, 
    "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
@@ -1052,6 +1236,7 @@
    "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, 
@@ -1062,6 +1247,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "disposal_account", 
    "fieldtype": "Link", 
    "hidden": 0, 
@@ -1069,6 +1255,7 @@
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "in_standard_filter": 0, 
    "label": "Gain/Loss Account on Asset Disposal", 
    "length": 0, 
    "no_copy": 1, 
@@ -1078,6 +1265,7 @@
    "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, 
@@ -1088,6 +1276,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "depreciation_cost_center", 
    "fieldtype": "Link", 
    "hidden": 0, 
@@ -1095,6 +1284,7 @@
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "in_standard_filter": 0, 
    "label": "Asset Depreciation Cost Center", 
    "length": 0, 
    "no_copy": 1, 
@@ -1104,6 +1294,7 @@
    "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, 
@@ -1114,6 +1305,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "description": "For reference only.", 
    "fieldname": "company_info", 
    "fieldtype": "Section Break", 
@@ -1122,6 +1314,7 @@
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "in_standard_filter": 0, 
    "label": "Company Info", 
    "length": 0, 
    "no_copy": 0, 
@@ -1129,6 +1322,7 @@
    "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, 
@@ -1139,6 +1333,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "address", 
    "fieldtype": "Small Text", 
    "hidden": 0, 
@@ -1146,6 +1341,7 @@
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "in_standard_filter": 0, 
    "label": "Address", 
    "length": 0, 
    "no_copy": 0, 
@@ -1155,6 +1351,7 @@
    "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, 
@@ -1165,6 +1362,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "column_break1", 
    "fieldtype": "Column Break", 
    "hidden": 0, 
@@ -1172,6 +1370,7 @@
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "in_standard_filter": 0, 
    "length": 0, 
    "no_copy": 0, 
    "oldfieldtype": "Column Break", 
@@ -1179,6 +1378,7 @@
    "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, 
@@ -1190,6 +1390,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "phone_no", 
    "fieldtype": "Data", 
    "hidden": 0, 
@@ -1197,6 +1398,7 @@
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "in_standard_filter": 0, 
    "label": "Phone No", 
    "length": 0, 
    "no_copy": 0, 
@@ -1207,6 +1409,7 @@
    "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, 
@@ -1217,6 +1420,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "fax", 
    "fieldtype": "Data", 
    "hidden": 0, 
@@ -1224,6 +1428,7 @@
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "in_standard_filter": 0, 
    "label": "Fax", 
    "length": 0, 
    "no_copy": 0, 
@@ -1234,6 +1439,7 @@
    "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, 
@@ -1244,6 +1450,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "email", 
    "fieldtype": "Data", 
    "hidden": 0, 
@@ -1251,6 +1458,7 @@
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "in_standard_filter": 0, 
    "label": "Email", 
    "length": 0, 
    "no_copy": 0, 
@@ -1261,6 +1469,7 @@
    "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, 
@@ -1271,6 +1480,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "website", 
    "fieldtype": "Data", 
    "hidden": 0, 
@@ -1278,6 +1488,7 @@
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "in_standard_filter": 0, 
    "label": "Website", 
    "length": 0, 
    "no_copy": 0, 
@@ -1287,6 +1498,7 @@
    "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, 
@@ -1297,6 +1509,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "description": "", 
    "fieldname": "registration_info", 
    "fieldtype": "Section Break", 
@@ -1305,6 +1518,7 @@
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "in_standard_filter": 0, 
    "label": "", 
    "length": 0, 
    "no_copy": 0, 
@@ -1313,6 +1527,7 @@
    "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, 
@@ -1324,6 +1539,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "description": "Company registration numbers for your reference. Tax numbers etc.", 
    "fieldname": "registration_details", 
    "fieldtype": "Code", 
@@ -1332,6 +1548,7 @@
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "in_standard_filter": 0, 
    "label": "Registration Details", 
    "length": 0, 
    "no_copy": 0, 
@@ -1341,6 +1558,7 @@
    "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, 
@@ -1351,6 +1569,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "delete_company_transactions", 
    "fieldtype": "Button", 
    "hidden": 0, 
@@ -1358,6 +1577,7 @@
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "in_standard_filter": 0, 
    "label": "Delete Company Transactions", 
    "length": 0, 
    "no_copy": 0, 
@@ -1366,6 +1586,7 @@
    "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, 
@@ -1385,7 +1606,7 @@
  "istable": 0, 
  "max_attachments": 0, 
  "menu_index": 0, 
- "modified": "2016-10-26 09:08:50.476200", 
+ "modified": "2016-11-23 16:32:04.893315", 
  "modified_by": "Administrator", 
  "module": "Setup", 
  "name": "Company", 
@@ -1401,6 +1622,7 @@
    "export": 0, 
    "if_owner": 0, 
    "import": 0, 
+   "is_custom": 0, 
    "permlevel": 0, 
    "print": 1, 
    "read": 1, 
@@ -1421,6 +1643,7 @@
    "export": 0, 
    "if_owner": 0, 
    "import": 0, 
+   "is_custom": 0, 
    "permlevel": 0, 
    "print": 1, 
    "read": 1, 
@@ -1441,6 +1664,7 @@
    "export": 0, 
    "if_owner": 0, 
    "import": 0, 
+   "is_custom": 0, 
    "permlevel": 0, 
    "print": 0, 
    "read": 1, 
@@ -1461,6 +1685,7 @@
    "export": 0, 
    "if_owner": 0, 
    "import": 0, 
+   "is_custom": 0, 
    "permlevel": 0, 
    "print": 0, 
    "read": 1, 
@@ -1481,6 +1706,7 @@
    "export": 0, 
    "if_owner": 0, 
    "import": 0, 
+   "is_custom": 0, 
    "permlevel": 0, 
    "print": 0, 
    "read": 1, 
@@ -1501,6 +1727,7 @@
    "export": 0, 
    "if_owner": 0, 
    "import": 0, 
+   "is_custom": 0, 
    "permlevel": 0, 
    "print": 0, 
    "read": 1, 
@@ -1521,6 +1748,7 @@
    "export": 0, 
    "if_owner": 0, 
    "import": 0, 
+   "is_custom": 0, 
    "permlevel": 0, 
    "print": 0, 
    "read": 1, 
diff --git a/erpnext/setup/doctype/company/company.py b/erpnext/setup/doctype/company/company.py
index 00538cd..7f506d5 100644
--- a/erpnext/setup/doctype/company/company.py
+++ b/erpnext/setup/doctype/company/company.py
@@ -30,6 +30,7 @@
 		self.validate_abbr()
 		self.validate_default_accounts()
 		self.validate_currency()
+		self.validate_coa_input()
 
 	def validate_abbr(self):
 		if not self.abbr:
@@ -113,16 +114,25 @@
 					warehouse.insert()
 
 	def create_default_accounts(self):
-		if not self.chart_of_accounts:
-			self.chart_of_accounts = "Standard"
-
 		from erpnext.accounts.doctype.account.chart_of_accounts.chart_of_accounts import create_charts
-		create_charts(self.chart_of_accounts, self.name)
+		create_charts(self.name, self.chart_of_accounts, self.existing_company)
 
 		frappe.db.set(self, "default_receivable_account", frappe.db.get_value("Account",
 			{"company": self.name, "account_type": "Receivable", "is_group": 0}))
 		frappe.db.set(self, "default_payable_account", frappe.db.get_value("Account",
 			{"company": self.name, "account_type": "Payable", "is_group": 0}))
+			
+	def validate_coa_input(self):
+		if self.create_chart_of_accounts_based_on == "Existing Company":
+			self.chart_of_accounts = None
+			if not self.existing_company:
+				frappe.throw(_("Please select Existing Company for creating Chart of Accounts"))
+
+		else:
+			self.existing_company = None
+			self.create_chart_of_accounts_based_on = "Standard Template"
+			if not self.chart_of_accounts:
+				self.chart_of_accounts = "Standard"
 
 	def set_default_accounts(self):
 		self._set_default_account("default_cash_account", "Cash")
diff --git a/erpnext/setup/doctype/company/test_company.py b/erpnext/setup/doctype/company/test_company.py
index afcc3b1..52836a6 100644
--- a/erpnext/setup/doctype/company/test_company.py
+++ b/erpnext/setup/doctype/company/test_company.py
@@ -7,8 +7,40 @@
 import frappe
 import unittest
 
-class TestCompany(unittest.TestCase):
-	pass
-
-
 test_records = frappe.get_test_records('Company')
+
+class TestCompany(unittest.TestCase):
+	def test_coa_based_on_existing_company(self):
+		make_company()
+		
+		expected_results = {
+			"Debtors - CFEC": {
+				"account_type": "Receivable",
+				"is_group": 0,
+				"root_type": "Asset",
+				"parent_account": "Accounts Receivable - CFEC",
+			},
+			"_Test Cash - CFEC": {
+				"account_type": "Cash",
+				"is_group": 0,
+				"root_type": "Asset",
+				"parent_account": "Cash In Hand - CFEC"
+			}
+		}
+		
+		for account, acc_property in expected_results.items():
+			acc = frappe.get_doc("Account", account)
+			for prop, val in acc_property.items():
+				self.assertEqual(acc.get(prop), val)
+		
+		
+def make_company():
+	company = frappe.new_doc("Company")
+	company.company_name = "COA from Existing Company"
+	company.abbr = "CFEC"
+	company.default_currency = "INR"
+	company.create_chart_of_accounts_based_on = "Existing Company"
+	company.existing_company = "_Test Company"
+	company.save()
+
+
diff --git a/erpnext/setup/doctype/naming_series/naming_series.py b/erpnext/setup/doctype/naming_series/naming_series.py
index 60a1270..67646f6 100644
--- a/erpnext/setup/doctype/naming_series/naming_series.py
+++ b/erpnext/setup/doctype/naming_series/naming_series.py
@@ -14,7 +14,8 @@
 class NamingSeries(Document):
 	def get_transactions(self, arg=None):
 		doctypes = list(set(frappe.db.sql_list("""select parent
-				from `tabDocField` where fieldname='naming_series'""")
+				from `tabDocField` df where fieldname='naming_series' and 
+				exists(select * from `tabDocPerm` dp, `tabRole` role where dp.role = role.name and dp.parent = df.parent and not role.disabled)""")
 			+ frappe.db.sql_list("""select dt from `tabCustom Field`
 				where fieldname='naming_series'""")))
 
diff --git a/erpnext/setup/setup_wizard/setup_wizard.py b/erpnext/setup/setup_wizard/setup_wizard.py
index 646aef1..395ea51 100644
--- a/erpnext/setup/setup_wizard/setup_wizard.py
+++ b/erpnext/setup/setup_wizard/setup_wizard.py
@@ -88,6 +88,7 @@
 			'abbr':args.get('company_abbr'),
 			'default_currency':args.get('currency'),
 			'country': args.get('country'),
+			'create_chart_of_accounts_based_on': 'Standard Template',
 			'chart_of_accounts': args.get(('chart_of_accounts')),
 			'domain': args.get('domain')
 		}).insert()
diff --git a/erpnext/stock/doctype/bin/bin.json b/erpnext/stock/doctype/bin/bin.json
index 9fd8a04..79ad4cd 100644
--- a/erpnext/stock/doctype/bin/bin.json
+++ b/erpnext/stock/doctype/bin/bin.json
@@ -434,7 +434,7 @@
  "issingle": 0, 
  "istable": 0, 
  "max_attachments": 0, 
- "modified": "2016-11-07 05:30:44.856343", 
+ "modified": "2016-11-27 16:31:55.929378", 
  "modified_by": "Administrator", 
  "module": "Stock", 
  "name": "Bin", 
@@ -467,6 +467,27 @@
    "cancel": 0, 
    "create": 0, 
    "delete": 0, 
+   "email": 0, 
+   "export": 0, 
+   "if_owner": 0, 
+   "import": 0, 
+   "is_custom": 0, 
+   "permlevel": 0, 
+   "print": 0, 
+   "read": 1, 
+   "report": 0, 
+   "role": "Item 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, 
diff --git a/erpnext/stock/doctype/delivery_note/delivery_note.js b/erpnext/stock/doctype/delivery_note/delivery_note.js
index 8f3792c..204e98a 100644
--- a/erpnext/stock/doctype/delivery_note/delivery_note.js
+++ b/erpnext/stock/doctype/delivery_note/delivery_note.js
@@ -8,20 +8,6 @@
 
 frappe.ui.form.on("Delivery Note", {
 	setup: function(frm) {
-		var qa_no = frappe.meta.get_docfield("Delivery Note Item", "qa_no");
-		qa_no.get_route_options_for_new_doc = function(field) {
-			if(frm.is_new()) return;
-			var doc = field.doc;
-			return {
-				"inspection_type": "Outgoing",
-				"delivery_note_no": frm.doc.name,
-				"item_code": doc.item_code,
-				"description": doc.description,
-				"item_serial_no": doc.serial_no ? doc.serial_no.split("\n")[0] : null,
-				"batch_no": doc.batch_no
-			}
-		}
-
 		frm.set_indicator_formatter('item_code',
 			function(doc) {
 				return (doc.docstatus==1 || doc.qty<=doc.actual_qty) ? "green" : "orange"
@@ -36,16 +22,6 @@
 			}
 		})
 
-		frm.set_query("qa_no", "items", function(doc, cdt, cdn) {
-			var d = locals[cdt][cdn];
-			return {
-				filters: {
-					docstatus: 1,
-					inspection_type: "Outgoing",
-					item_code: d.item_code
-				}
-			}
-		})
 	}
 });
 
diff --git a/erpnext/stock/doctype/delivery_note/delivery_note.py b/erpnext/stock/doctype/delivery_note/delivery_note.py
index 54c40fa..5e31ac3 100644
--- a/erpnext/stock/doctype/delivery_note/delivery_note.py
+++ b/erpnext/stock/doctype/delivery_note/delivery_note.py
@@ -103,7 +103,6 @@
 		self.validate_warehouse()
 		self.validate_uom_is_integer("stock_uom", "qty")
 		self.validate_with_previous_doc()
-		self.validate_inspection()
 
 		from erpnext.stock.doctype.packed_item.packed_item import make_packing_list
 		make_packing_list(self)
@@ -112,13 +111,6 @@
 
 		if not self.installation_status: self.installation_status = 'Not Installed'
 
-	def validate_inspection(self):
-		for d in self.get('items'):		 #Enter inspection date for all items that require inspection
-			if frappe.db.get_value("Item", d.item_code, "inspection_required_before_delivery") and not d.qa_no:
-				frappe.msgprint(_("Quality Inspection required for Item {0}").format(d.item_code))
-				if self.docstatus==1:
-					raise frappe.ValidationError
-
 	def validate_with_previous_doc(self):
 		for fn in (("Sales Order", "against_sales_order", "so_detail"),
 				("Sales Invoice", "against_sales_invoice", "si_detail")):
diff --git a/erpnext/stock/doctype/delivery_note/delivery_note_dashboard.py b/erpnext/stock/doctype/delivery_note/delivery_note_dashboard.py
index adbfa4d..c296d8c 100644
--- a/erpnext/stock/doctype/delivery_note/delivery_note_dashboard.py
+++ b/erpnext/stock/doctype/delivery_note/delivery_note_dashboard.py
@@ -2,10 +2,10 @@
 
 def get_data():
 	return {
-		'fieldname': 'delivery_note_no',
+		'fieldname': 'delivery_note',
 		'non_standard_fieldnames': {
-			'Sales Invoice': 'delivery_note',
-			'Packing Slip': 'delivery_note',
+			'Stock Entry': 'delivery_note_no',
+			'Quality Inspection': 'reference_name'
 		},
 		'internal_links': {
 			'Sales Order': ['items', 'against_sales_order'],
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 69f195f..1cb0fcd 100644
--- a/erpnext/stock/doctype/delivery_note_item/delivery_note_item.json
+++ b/erpnext/stock/doctype/delivery_note_item/delivery_note_item.json
@@ -1126,7 +1126,8 @@
    "bold": 0, 
    "collapsible": 0, 
    "columns": 0, 
-   "fieldname": "qa_no", 
+   "depends_on": "eval:!doc.__islocal", 
+   "fieldname": "quality_inspection", 
    "fieldtype": "Link", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
@@ -1490,7 +1491,7 @@
    "in_standard_filter": 0, 
    "label": "Against Sales Order", 
    "length": 0, 
-   "no_copy": 0, 
+   "no_copy": 1, 
    "options": "Sales Order", 
    "permlevel": 0, 
    "print_hide": 1, 
@@ -1518,7 +1519,7 @@
    "in_standard_filter": 0, 
    "label": "Against Sales Invoice", 
    "length": 0, 
-   "no_copy": 0, 
+   "no_copy": 1, 
    "options": "Sales Invoice", 
    "permlevel": 0, 
    "print_hide": 1, 
@@ -1690,7 +1691,7 @@
  "issingle": 0, 
  "istable": 1, 
  "max_attachments": 0, 
- "modified": "2016-11-03 13:25:38.928043", 
+ "modified": "2016-11-23 12:33:37.728117", 
  "modified_by": "Administrator", 
  "module": "Stock", 
  "name": "Delivery Note Item", 
diff --git a/erpnext/stock/doctype/item/item.json b/erpnext/stock/doctype/item/item.json
index 4c0dda8..6e103d4 100644
--- a/erpnext/stock/doctype/item/item.json
+++ b/erpnext/stock/doctype/item/item.json
@@ -2009,7 +2009,7 @@
    "collapsible": 0, 
    "columns": 0, 
    "default": "", 
-   "fieldname": "inspection_required", 
+   "fieldname": "inspection_required_before_purchase", 
    "fieldtype": "Check", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
@@ -2067,7 +2067,7 @@
    "bold": 0, 
    "collapsible": 0, 
    "columns": 0, 
-   "depends_on": "eval:(doc.inspection_required || doc.inspection_required_before_delivery)", 
+   "depends_on": "eval:(doc.inspection_required_before_purchase || doc.inspection_required_before_delivery)", 
    "description": "Will also apply to variants", 
    "fieldname": "quality_parameters", 
    "fieldtype": "Table", 
@@ -2683,7 +2683,7 @@
  "issingle": 0, 
  "istable": 0, 
  "max_attachments": 1, 
- "modified": "2016-11-07 06:20:15.118045", 
+ "modified": "2016-11-18 02:19:54.507883", 
  "modified_by": "Administrator", 
  "module": "Stock", 
  "name": "Item", 
diff --git a/erpnext/stock/doctype/item/item.py b/erpnext/stock/doctype/item/item.py
index ced6a64..3d248d1 100644
--- a/erpnext/stock/doctype/item/item.py
+++ b/erpnext/stock/doctype/item/item.py
@@ -141,7 +141,7 @@
 
 	def make_route(self):
 		if not self.route:
-			return frappe.db.get_value('Item Group', self.item_group, 'route') + '/' + self.scrub(self.item_name)
+			return cstr(frappe.db.get_value('Item Group', self.item_group, 'route')) + '/' + self.scrub(self.item_name)
 
 	def get_parents(self, context):
 		item_group, route = frappe.db.get_value('Item Group', self.item_group, ['name', 'route'])
diff --git a/erpnext/stock/doctype/material_request/material_request.py b/erpnext/stock/doctype/material_request/material_request.py
index 06df636..4fb5f5d 100644
--- a/erpnext/stock/doctype/material_request/material_request.py
+++ b/erpnext/stock/doctype/material_request/material_request.py
@@ -372,6 +372,7 @@
 	mr= frappe.get_doc("Material Request", material_request)
 	errors =[]
 	production_orders = []
+	default_wip_warehouse = frappe.db.get_single_value("Manufacturing Settings", "default_wip_warehouse")
 	for d in mr.items:
 		if (d.qty - d.ordered_qty) >0:
 			if frappe.db.get_value("BOM", {"item": d.item_code, "is_default": 1}):
@@ -379,6 +380,7 @@
 				prod_order.production_item = d.item_code
 				prod_order.qty = d.qty - d.ordered_qty
 				prod_order.fg_warehouse = d.warehouse
+				prod_order.wip_warehouse = default_wip_warehouse
 				prod_order.description = d.description
 				prod_order.stock_uom = d.uom
 				prod_order.expected_delivery_date = d.schedule_date
diff --git a/erpnext/stock/doctype/packed_item/packed_item.py b/erpnext/stock/doctype/packed_item/packed_item.py
index 2078eeb..09affe0 100644
--- a/erpnext/stock/doctype/packed_item/packed_item.py
+++ b/erpnext/stock/doctype/packed_item/packed_item.py
@@ -16,7 +16,7 @@
 def get_product_bundle_items(item_code):
 	return frappe.db.sql("""select t1.item_code, t1.qty, t1.uom, t1.description
 		from `tabProduct Bundle Item` t1, `tabProduct Bundle` t2
-		where t2.new_item_code=%s and t1.parent = t2.name""", item_code, as_dict=1)
+		where t2.new_item_code=%s and t1.parent = t2.name order by t1.idx""", item_code, as_dict=1)
 
 def get_packing_item_details(item):
 	return frappe.db.sql("""select item_name, description, stock_uom from `tabItem`
diff --git a/erpnext/stock/doctype/purchase_receipt/purchase_receipt.js b/erpnext/stock/doctype/purchase_receipt/purchase_receipt.js
index 0225af3..457a7c2 100644
--- a/erpnext/stock/doctype/purchase_receipt/purchase_receipt.js
+++ b/erpnext/stock/doctype/purchase_receipt/purchase_receipt.js
@@ -7,20 +7,6 @@
 
 frappe.ui.form.on("Purchase Receipt", {
 	onload: function(frm) {
-		var qa_no = frappe.meta.get_docfield("Purchase Receipt Item", "qa_no");
-		qa_no.get_route_options_for_new_doc = function(field) {
-			if(frm.is_new()) return;
-			var doc = field.doc;
-			return {
-				"inspection_type": "Incoming",
-				"purchase_receipt_no": frm.doc.name,
-				"item_code": doc.item_code,
-				"description": doc.description,
-				"item_serial_no": doc.serial_no ? doc.serial_no.split("\n")[0] : null,
-				"batch_no": doc.batch_no
-			}
-		}
-
 		$.each(["warehouse", "rejected_warehouse"], function(i, field) {
 			frm.set_query(field, "items", function() {
 				return {
@@ -39,18 +25,8 @@
 					["Warehouse", "is_group", "=", 0]
 				]
 			}
-		})
-
-		frm.set_query("qa_no", "items", function(doc, cdt, cdn) {
-			var d = locals[cdt][cdn];
-			return {
-				filters: {
-					docstatus: 1,
-					inspection_type: "Incoming",
-					item_code: d.item_code
-				}
-			}
-		})
+		});
+		
 	}
 });
 
@@ -200,14 +176,6 @@
 	}
 }
 
-cur_frm.fields_dict.items.grid.get_field("qa_no").get_query = function(doc) {
-	return {
-		filters: {
-			'docstatus': 1
-		}
-	}
-}
-
 cur_frm.fields_dict['items'].grid.get_field('bom').get_query = function(doc, cdt, cdn) {
 	var d = locals[cdt][cdn]
 	return {
diff --git a/erpnext/stock/doctype/purchase_receipt/purchase_receipt.py b/erpnext/stock/doctype/purchase_receipt/purchase_receipt.py
index 86fb88b..4bcde6a 100644
--- a/erpnext/stock/doctype/purchase_receipt/purchase_receipt.py
+++ b/erpnext/stock/doctype/purchase_receipt/purchase_receipt.py
@@ -52,7 +52,6 @@
 			self.set_status()
 		self.po_required()
 		self.validate_with_previous_doc()
-		self.validate_inspection()
 		self.validate_uom_is_integer("uom", ["qty", "received_qty"])
 		self.validate_uom_is_integer("stock_uom", "stock_qty")
 
@@ -97,13 +96,6 @@
 			["qty", "warehouse"])
 		return po_qty, po_warehouse
 
-	def validate_inspection(self):
-		for d in self.get('items'):		 #Enter inspection date for all items that require inspection
-			if frappe.db.get_value("Item", d.item_code, "inspection_required") and not d.qa_no:
-				frappe.msgprint(_("Quality Inspection required for Item {0}").format(d.item_code))
-				if self.docstatus==1:
-					raise frappe.ValidationError
-
 	# Check for Closed status
 	def check_for_closed_status(self, pc_obj):
 		check_list =[]
diff --git a/erpnext/stock/doctype/purchase_receipt/purchase_receipt_dashboard.py b/erpnext/stock/doctype/purchase_receipt/purchase_receipt_dashboard.py
index 7059c91..9722d87 100644
--- a/erpnext/stock/doctype/purchase_receipt/purchase_receipt_dashboard.py
+++ b/erpnext/stock/doctype/purchase_receipt/purchase_receipt_dashboard.py
@@ -10,7 +10,7 @@
 		'internal_links': {
 			'Purchase Order': ['items', 'purchase_order'],
 			'Project': ['items', 'project'],
-			'Quality Inspection': ['items', 'qa_no'],
+			'Quality Inspection': ['items', 'quality_inspection'],
 		},
 		'transactions': [
 			{
diff --git a/erpnext/stock/doctype/purchase_receipt_item/purchase_receipt_item.json b/erpnext/stock/doctype/purchase_receipt_item/purchase_receipt_item.json
index f6e1e3f..d8449f1 100755
--- a/erpnext/stock/doctype/purchase_receipt_item/purchase_receipt_item.json
+++ b/erpnext/stock/doctype/purchase_receipt_item/purchase_receipt_item.json
@@ -23,6 +23,7 @@
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "in_standard_filter": 0, 
    "label": "Barcode", 
    "length": 0, 
    "no_copy": 0, 
@@ -31,6 +32,7 @@
    "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, 
@@ -49,6 +51,7 @@
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "in_standard_filter": 0, 
    "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
@@ -56,6 +59,7 @@
    "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, 
@@ -74,6 +78,7 @@
    "ignore_xss_filter": 0, 
    "in_filter": 1, 
    "in_list_view": 1, 
+   "in_standard_filter": 0, 
    "label": "Item Code", 
    "length": 0, 
    "no_copy": 0, 
@@ -85,6 +90,7 @@
    "print_hide_if_no_value": 0, 
    "print_width": "100px", 
    "read_only": 0, 
+   "remember_last_selected_value": 0, 
    "report_hide": 0, 
    "reqd": 1, 
    "search_index": 1, 
@@ -104,6 +110,7 @@
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "in_standard_filter": 0, 
    "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
@@ -111,6 +118,7 @@
    "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, 
@@ -129,6 +137,7 @@
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "in_standard_filter": 0, 
    "label": "Item Name", 
    "length": 0, 
    "no_copy": 0, 
@@ -138,6 +147,7 @@
    "print_hide": 1, 
    "print_hide_if_no_value": 0, 
    "read_only": 0, 
+   "remember_last_selected_value": 0, 
    "report_hide": 0, 
    "reqd": 1, 
    "search_index": 0, 
@@ -156,6 +166,7 @@
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "in_standard_filter": 0, 
    "label": "Description", 
    "length": 0, 
    "no_copy": 0, 
@@ -164,6 +175,7 @@
    "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, 
@@ -182,6 +194,7 @@
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "in_standard_filter": 0, 
    "label": "Description", 
    "length": 0, 
    "no_copy": 0, 
@@ -192,6 +205,7 @@
    "print_hide_if_no_value": 0, 
    "print_width": "300px", 
    "read_only": 0, 
+   "remember_last_selected_value": 0, 
    "report_hide": 0, 
    "reqd": 1, 
    "search_index": 0, 
@@ -211,12 +225,14 @@
    "ignore_xss_filter": 0, 
    "in_filter": 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, 
@@ -235,6 +251,7 @@
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "in_standard_filter": 0, 
    "label": "Image", 
    "length": 0, 
    "no_copy": 0, 
@@ -243,6 +260,7 @@
    "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, 
@@ -261,6 +279,7 @@
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "in_standard_filter": 0, 
    "label": "Image View", 
    "length": 0, 
    "no_copy": 0, 
@@ -270,6 +289,7 @@
    "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, 
@@ -288,6 +308,7 @@
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "in_standard_filter": 0, 
    "label": "Received and Accepted", 
    "length": 0, 
    "no_copy": 0, 
@@ -295,6 +316,7 @@
    "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, 
@@ -313,6 +335,7 @@
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "in_standard_filter": 0, 
    "label": "Recd Quantity", 
    "length": 0, 
    "no_copy": 0, 
@@ -323,6 +346,7 @@
    "print_hide_if_no_value": 0, 
    "print_width": "100px", 
    "read_only": 0, 
+   "remember_last_selected_value": 0, 
    "report_hide": 0, 
    "reqd": 1, 
    "search_index": 0, 
@@ -342,6 +366,7 @@
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 1, 
+   "in_standard_filter": 0, 
    "label": "Accepted Quantity", 
    "length": 0, 
    "no_copy": 0, 
@@ -352,6 +377,7 @@
    "print_hide_if_no_value": 0, 
    "print_width": "100px", 
    "read_only": 0, 
+   "remember_last_selected_value": 0, 
    "report_hide": 0, 
    "reqd": 0, 
    "search_index": 0, 
@@ -371,6 +397,7 @@
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "in_standard_filter": 0, 
    "label": "Rejected Quantity", 
    "length": 0, 
    "no_copy": 0, 
@@ -381,6 +408,7 @@
    "print_hide_if_no_value": 0, 
    "print_width": "100px", 
    "read_only": 0, 
+   "remember_last_selected_value": 0, 
    "report_hide": 0, 
    "reqd": 0, 
    "search_index": 0, 
@@ -400,12 +428,14 @@
    "ignore_xss_filter": 0, 
    "in_filter": 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, 
@@ -424,6 +454,7 @@
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "in_standard_filter": 0, 
    "label": "UOM", 
    "length": 0, 
    "no_copy": 0, 
@@ -435,6 +466,7 @@
    "print_hide_if_no_value": 0, 
    "print_width": "100px", 
    "read_only": 0, 
+   "remember_last_selected_value": 0, 
    "report_hide": 0, 
    "reqd": 1, 
    "search_index": 0, 
@@ -454,6 +486,7 @@
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "in_standard_filter": 0, 
    "label": "Stock UOM", 
    "length": 0, 
    "no_copy": 0, 
@@ -465,6 +498,7 @@
    "print_hide_if_no_value": 0, 
    "print_width": "100px", 
    "read_only": 1, 
+   "remember_last_selected_value": 0, 
    "report_hide": 0, 
    "reqd": 1, 
    "search_index": 0, 
@@ -484,6 +518,7 @@
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "in_standard_filter": 0, 
    "label": "Conversion Factor", 
    "length": 0, 
    "no_copy": 0, 
@@ -494,6 +529,7 @@
    "print_hide_if_no_value": 0, 
    "print_width": "100px", 
    "read_only": 0, 
+   "remember_last_selected_value": 0, 
    "report_hide": 0, 
    "reqd": 1, 
    "search_index": 0, 
@@ -513,6 +549,7 @@
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "in_standard_filter": 0, 
    "label": "Rate and Amount", 
    "length": 0, 
    "no_copy": 0, 
@@ -520,6 +557,7 @@
    "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, 
@@ -538,6 +576,7 @@
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "in_standard_filter": 0, 
    "label": "Price List Rate", 
    "length": 0, 
    "no_copy": 0, 
@@ -546,6 +585,7 @@
    "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, 
@@ -565,6 +605,7 @@
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "in_standard_filter": 0, 
    "label": "Discount on Price List Rate (%)", 
    "length": 0, 
    "no_copy": 0, 
@@ -572,6 +613,7 @@
    "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, 
@@ -590,12 +632,14 @@
    "ignore_xss_filter": 0, 
    "in_filter": 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, 
@@ -614,6 +658,7 @@
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "in_standard_filter": 0, 
    "label": "Price List Rate (Company Currency)", 
    "length": 0, 
    "no_copy": 0, 
@@ -622,6 +667,7 @@
    "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, 
@@ -640,12 +686,14 @@
    "ignore_xss_filter": 0, 
    "in_filter": 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, 
@@ -664,6 +712,7 @@
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 1, 
+   "in_standard_filter": 0, 
    "label": "Rate", 
    "length": 0, 
    "no_copy": 0, 
@@ -675,6 +724,7 @@
    "print_hide_if_no_value": 0, 
    "print_width": "100px", 
    "read_only": 0, 
+   "remember_last_selected_value": 0, 
    "report_hide": 0, 
    "reqd": 0, 
    "search_index": 0, 
@@ -694,6 +744,7 @@
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 1, 
+   "in_standard_filter": 0, 
    "label": "Amount", 
    "length": 0, 
    "no_copy": 0, 
@@ -704,6 +755,7 @@
    "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, 
@@ -722,12 +774,14 @@
    "ignore_xss_filter": 0, 
    "in_filter": 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, 
@@ -746,6 +800,7 @@
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "in_standard_filter": 0, 
    "label": "Rate (Company Currency)", 
    "length": 0, 
    "no_copy": 0, 
@@ -757,6 +812,7 @@
    "print_hide_if_no_value": 0, 
    "print_width": "100px", 
    "read_only": 1, 
+   "remember_last_selected_value": 0, 
    "report_hide": 0, 
    "reqd": 1, 
    "search_index": 0, 
@@ -776,6 +832,7 @@
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "in_standard_filter": 0, 
    "label": "Amount (Company Currency)", 
    "length": 0, 
    "no_copy": 0, 
@@ -787,6 +844,7 @@
    "print_hide_if_no_value": 0, 
    "print_width": "100px", 
    "read_only": 1, 
+   "remember_last_selected_value": 0, 
    "report_hide": 0, 
    "reqd": 0, 
    "search_index": 0, 
@@ -806,6 +864,7 @@
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "in_standard_filter": 0, 
    "label": "Pricing Rule", 
    "length": 0, 
    "no_copy": 0, 
@@ -814,6 +873,7 @@
    "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, 
@@ -832,6 +892,7 @@
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "in_standard_filter": 0, 
    "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
@@ -839,6 +900,7 @@
    "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, 
@@ -857,6 +919,7 @@
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "in_standard_filter": 0, 
    "label": "Net Rate", 
    "length": 0, 
    "no_copy": 0, 
@@ -866,6 +929,7 @@
    "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, 
@@ -884,6 +948,7 @@
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 1, 
+   "in_standard_filter": 0, 
    "label": "Net Amount", 
    "length": 0, 
    "no_copy": 0, 
@@ -893,6 +958,7 @@
    "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, 
@@ -911,6 +977,7 @@
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "in_standard_filter": 0, 
    "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
@@ -918,6 +985,7 @@
    "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, 
@@ -936,6 +1004,7 @@
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "in_standard_filter": 0, 
    "label": "Net Rate (Company Currency)", 
    "length": 0, 
    "no_copy": 0, 
@@ -945,6 +1014,7 @@
    "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, 
@@ -963,6 +1033,7 @@
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "in_standard_filter": 0, 
    "label": "Net Amount (Company Currency)", 
    "length": 0, 
    "no_copy": 0, 
@@ -972,6 +1043,7 @@
    "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, 
@@ -990,6 +1062,7 @@
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "in_standard_filter": 0, 
    "label": "Warehouse and Reference", 
    "length": 0, 
    "no_copy": 0, 
@@ -997,6 +1070,7 @@
    "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, 
@@ -1015,6 +1089,7 @@
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 1, 
+   "in_standard_filter": 0, 
    "label": "Accepted Warehouse", 
    "length": 0, 
    "no_copy": 0, 
@@ -1026,6 +1101,7 @@
    "print_hide_if_no_value": 0, 
    "print_width": "100px", 
    "read_only": 0, 
+   "remember_last_selected_value": 0, 
    "report_hide": 0, 
    "reqd": 0, 
    "search_index": 0, 
@@ -1045,6 +1121,7 @@
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "in_standard_filter": 0, 
    "label": "Rejected Warehouse", 
    "length": 0, 
    "no_copy": 1, 
@@ -1056,6 +1133,7 @@
    "print_hide_if_no_value": 0, 
    "print_width": "100px", 
    "read_only": 0, 
+   "remember_last_selected_value": 0, 
    "report_hide": 0, 
    "reqd": 0, 
    "search_index": 0, 
@@ -1068,13 +1146,15 @@
    "bold": 0, 
    "collapsible": 0, 
    "columns": 0, 
-   "fieldname": "qa_no", 
+   "depends_on": "eval:!doc.__islocal", 
+   "fieldname": "quality_inspection", 
    "fieldtype": "Link", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "in_standard_filter": 0, 
    "label": "Quality Inspection", 
    "length": 0, 
    "no_copy": 1, 
@@ -1085,6 +1165,7 @@
    "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, 
@@ -1103,6 +1184,7 @@
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "in_standard_filter": 0, 
    "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
@@ -1110,6 +1192,7 @@
    "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, 
@@ -1128,6 +1211,7 @@
    "ignore_xss_filter": 0, 
    "in_filter": 1, 
    "in_list_view": 0, 
+   "in_standard_filter": 0, 
    "label": "Purchase Order", 
    "length": 0, 
    "no_copy": 1, 
@@ -1139,6 +1223,7 @@
    "print_hide_if_no_value": 0, 
    "print_width": "150px", 
    "read_only": 1, 
+   "remember_last_selected_value": 0, 
    "report_hide": 0, 
    "reqd": 0, 
    "search_index": 1, 
@@ -1158,6 +1243,7 @@
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "in_standard_filter": 0, 
    "label": "Required By", 
    "length": 0, 
    "no_copy": 0, 
@@ -1167,6 +1253,7 @@
    "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, 
@@ -1185,6 +1272,7 @@
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "in_standard_filter": 0, 
    "label": "Qty as per Stock UOM", 
    "length": 0, 
    "no_copy": 0, 
@@ -1195,6 +1283,7 @@
    "print_hide_if_no_value": 0, 
    "print_width": "100px", 
    "read_only": 1, 
+   "remember_last_selected_value": 0, 
    "report_hide": 0, 
    "reqd": 0, 
    "search_index": 0, 
@@ -1214,6 +1303,7 @@
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "in_standard_filter": 0, 
    "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
@@ -1221,6 +1311,7 @@
    "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, 
@@ -1239,6 +1330,7 @@
    "ignore_xss_filter": 0, 
    "in_filter": 1, 
    "in_list_view": 1, 
+   "in_standard_filter": 0, 
    "label": "Serial No", 
    "length": 0, 
    "no_copy": 1, 
@@ -1248,6 +1340,7 @@
    "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, 
@@ -1266,6 +1359,7 @@
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 1, 
+   "in_standard_filter": 0, 
    "label": "Batch No", 
    "length": 0, 
    "no_copy": 0, 
@@ -1276,6 +1370,7 @@
    "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, 
@@ -1294,6 +1389,7 @@
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "in_standard_filter": 0, 
    "label": "", 
    "length": 0, 
    "no_copy": 0, 
@@ -1302,6 +1398,7 @@
    "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, 
@@ -1320,6 +1417,7 @@
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "in_standard_filter": 0, 
    "label": "Rejected Serial No", 
    "length": 0, 
    "no_copy": 1, 
@@ -1327,6 +1425,7 @@
    "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, 
@@ -1345,6 +1444,7 @@
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "in_standard_filter": 0, 
    "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
@@ -1352,6 +1452,7 @@
    "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, 
@@ -1370,6 +1471,7 @@
    "ignore_xss_filter": 0, 
    "in_filter": 1, 
    "in_list_view": 0, 
+   "in_standard_filter": 0, 
    "label": "Project", 
    "length": 0, 
    "no_copy": 0, 
@@ -1378,6 +1480,7 @@
    "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, 
@@ -1398,6 +1501,7 @@
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "in_standard_filter": 0, 
    "label": "Cost Center", 
    "length": 0, 
    "no_copy": 0, 
@@ -1406,6 +1510,7 @@
    "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, 
@@ -1424,6 +1529,7 @@
    "ignore_xss_filter": 0, 
    "in_filter": 1, 
    "in_list_view": 0, 
+   "in_standard_filter": 0, 
    "label": "Purchase Order Item", 
    "length": 0, 
    "no_copy": 1, 
@@ -1434,6 +1540,7 @@
    "print_hide_if_no_value": 0, 
    "print_width": "150px", 
    "read_only": 1, 
+   "remember_last_selected_value": 0, 
    "report_hide": 0, 
    "reqd": 0, 
    "search_index": 1, 
@@ -1453,12 +1560,14 @@
    "ignore_xss_filter": 0, 
    "in_filter": 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, 
@@ -1477,6 +1586,7 @@
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "in_standard_filter": 0, 
    "label": "BOM", 
    "length": 0, 
    "no_copy": 1, 
@@ -1486,6 +1596,7 @@
    "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, 
@@ -1504,6 +1615,7 @@
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "in_standard_filter": 0, 
    "label": "Billed Amt", 
    "length": 0, 
    "no_copy": 1, 
@@ -1512,6 +1624,7 @@
    "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, 
@@ -1530,6 +1643,7 @@
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "in_standard_filter": 0, 
    "label": "Landed Cost Voucher Amount", 
    "length": 0, 
    "no_copy": 1, 
@@ -1537,6 +1651,7 @@
    "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, 
@@ -1555,6 +1670,7 @@
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "in_standard_filter": 0, 
    "label": "Brand", 
    "length": 0, 
    "no_copy": 0, 
@@ -1565,6 +1681,7 @@
    "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, 
@@ -1584,6 +1701,7 @@
    "ignore_xss_filter": 0, 
    "in_filter": 1, 
    "in_list_view": 0, 
+   "in_standard_filter": 0, 
    "label": "Item Group", 
    "length": 0, 
    "no_copy": 0, 
@@ -1594,6 +1712,7 @@
    "print_hide": 1, 
    "print_hide_if_no_value": 0, 
    "read_only": 1, 
+   "remember_last_selected_value": 0, 
    "report_hide": 0, 
    "reqd": 0, 
    "search_index": 1, 
@@ -1612,6 +1731,7 @@
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "in_standard_filter": 0, 
    "label": "Raw Materials Supplied Cost", 
    "length": 0, 
    "no_copy": 1, 
@@ -1623,6 +1743,7 @@
    "print_hide_if_no_value": 0, 
    "print_width": "150px", 
    "read_only": 1, 
+   "remember_last_selected_value": 0, 
    "report_hide": 0, 
    "reqd": 0, 
    "search_index": 0, 
@@ -1642,6 +1763,7 @@
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "in_standard_filter": 0, 
    "label": "Item Tax Amount", 
    "length": 0, 
    "no_copy": 1, 
@@ -1653,6 +1775,7 @@
    "print_hide_if_no_value": 0, 
    "print_width": "150px", 
    "read_only": 1, 
+   "remember_last_selected_value": 0, 
    "report_hide": 0, 
    "reqd": 0, 
    "search_index": 0, 
@@ -1672,6 +1795,7 @@
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "in_standard_filter": 0, 
    "label": "Valuation Rate", 
    "length": 0, 
    "no_copy": 1, 
@@ -1683,6 +1807,7 @@
    "print_hide_if_no_value": 0, 
    "print_width": "80px", 
    "read_only": 1, 
+   "remember_last_selected_value": 0, 
    "report_hide": 0, 
    "reqd": 0, 
    "search_index": 0, 
@@ -1703,6 +1828,7 @@
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "in_standard_filter": 0, 
    "label": "Item Tax Rate", 
    "length": 0, 
    "no_copy": 0, 
@@ -1712,6 +1838,7 @@
    "print_hide": 1, 
    "print_hide_if_no_value": 0, 
    "read_only": 1, 
+   "remember_last_selected_value": 0, 
    "report_hide": 1, 
    "reqd": 0, 
    "search_index": 0, 
@@ -1730,6 +1857,7 @@
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "in_standard_filter": 0, 
    "label": "Page Break", 
    "length": 0, 
    "no_copy": 0, 
@@ -1739,6 +1867,7 @@
    "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, 
@@ -1756,7 +1885,7 @@
  "issingle": 0, 
  "istable": 1, 
  "max_attachments": 0, 
- "modified": "2016-08-26 04:44:03.973239", 
+ "modified": "2016-11-16 16:04:21.778869", 
  "modified_by": "Administrator", 
  "module": "Stock", 
  "name": "Purchase Receipt Item", 
diff --git a/erpnext/buying/doctype/quality_inspection/README.md b/erpnext/stock/doctype/quality_inspection/README.md
similarity index 100%
rename from erpnext/buying/doctype/quality_inspection/README.md
rename to erpnext/stock/doctype/quality_inspection/README.md
diff --git a/erpnext/buying/doctype/quality_inspection/__init__.py b/erpnext/stock/doctype/quality_inspection/__init__.py
similarity index 100%
rename from erpnext/buying/doctype/quality_inspection/__init__.py
rename to erpnext/stock/doctype/quality_inspection/__init__.py
diff --git a/erpnext/stock/doctype/quality_inspection/quality_inspection.js b/erpnext/stock/doctype/quality_inspection/quality_inspection.js
new file mode 100644
index 0000000..5d7b6b4
--- /dev/null
+++ b/erpnext/stock/doctype/quality_inspection/quality_inspection.js
@@ -0,0 +1,40 @@
+// Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
+// License: GNU General Public License v3. See license.txt
+
+cur_frm.cscript.refresh = cur_frm.cscript.inspection_type;
+
+// item code based on GRN/DN
+cur_frm.fields_dict['item_code'].get_query = function(doc, cdt, cdn) {
+	if (doc.reference_type && doc.reference_name) {
+		return {
+			query: "erpnext.stock.doctype.quality_inspection.quality_inspection.item_query",
+			filters: {
+				"from": doc.reference_type,
+				"parent": doc.reference_name
+			}
+		}
+	}
+}
+
+// Serial No based on item_code
+cur_frm.fields_dict['item_serial_no'].get_query = function(doc, cdt, cdn) {
+	var filters = {};
+	if (doc.item_code) {
+		filters = {
+			'item_code': doc.item_code
+		}
+	}
+	return { filters: filters }
+}
+
+cur_frm.set_query("batch_no", function(doc) {
+	return {
+		filters: {
+			"item": doc.item_code
+		}
+	}
+})
+
+cur_frm.add_fetch('item_code', 'item_name', 'item_name');
+cur_frm.add_fetch('item_code', 'description', 'description');
+
diff --git a/erpnext/buying/doctype/quality_inspection/quality_inspection.json b/erpnext/stock/doctype/quality_inspection/quality_inspection.json
similarity index 96%
rename from erpnext/buying/doctype/quality_inspection/quality_inspection.json
rename to erpnext/stock/doctype/quality_inspection/quality_inspection.json
index 3affe34..76e82f8 100644
--- a/erpnext/buying/doctype/quality_inspection/quality_inspection.json
+++ b/erpnext/stock/doctype/quality_inspection/quality_inspection.json
@@ -131,28 +131,27 @@
    "bold": 0, 
    "collapsible": 0, 
    "columns": 0, 
-   "fieldname": "purchase_receipt_no", 
-   "fieldtype": "Link", 
+   "fieldname": "reference_type", 
+   "fieldtype": "Select", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
    "ignore_xss_filter": 0, 
-   "in_filter": 1, 
+   "in_filter": 0, 
    "in_list_view": 0, 
    "in_standard_filter": 0, 
-   "label": "Purchase Receipt No", 
+   "label": "Reference Type", 
    "length": 0, 
    "no_copy": 0, 
-   "oldfieldname": "purchase_receipt_no", 
-   "oldfieldtype": "Link", 
-   "options": "Purchase Receipt", 
+   "options": "\nPurchase Receipt\nPurchase Invoice\nDelivery Note\nSales Invoice", 
    "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, 
+   "search_index": 0, 
    "set_only_once": 0, 
    "unique": 0
   }, 
@@ -161,20 +160,21 @@
    "bold": 0, 
    "collapsible": 0, 
    "columns": 0, 
-   "fieldname": "delivery_note_no", 
-   "fieldtype": "Link", 
+   "depends_on": "", 
+   "fieldname": "reference_name", 
+   "fieldtype": "Dynamic Link", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
    "ignore_xss_filter": 0, 
    "in_filter": 1, 
-   "in_list_view": 0, 
+   "in_list_view": 1, 
    "in_standard_filter": 0, 
-   "label": "Delivery Note No", 
+   "label": "Reference Name", 
    "length": 0, 
    "no_copy": 0, 
-   "oldfieldname": "delivery_note_no", 
+   "oldfieldname": "purchase_receipt_no", 
    "oldfieldtype": "Link", 
-   "options": "Delivery Note", 
+   "options": "reference_type", 
    "permlevel": 0, 
    "print_hide": 0, 
    "print_hide_if_no_value": 0, 
@@ -182,7 +182,7 @@
    "remember_last_selected_value": 0, 
    "report_hide": 0, 
    "reqd": 0, 
-   "search_index": 1, 
+   "search_index": 0, 
    "set_only_once": 0, 
    "unique": 0
   }, 
@@ -690,9 +690,9 @@
  "issingle": 0, 
  "istable": 0, 
  "max_attachments": 0, 
- "modified": "2016-11-07 05:27:52.422491", 
+ "modified": "2016-11-16 04:26:57.853527", 
  "modified_by": "Administrator", 
- "module": "Buying", 
+ "module": "Stock", 
  "name": "Quality Inspection", 
  "owner": "Administrator", 
  "permissions": [
@@ -721,7 +721,7 @@
  "quick_entry": 0, 
  "read_only": 0, 
  "read_only_onload": 0, 
- "search_fields": "item_code, report_date, purchase_receipt_no, delivery_note_no", 
+ "search_fields": "item_code, report_date, reference_name", 
  "sort_order": "ASC", 
  "track_seen": 0
 }
\ No newline at end of file
diff --git a/erpnext/buying/doctype/quality_inspection/quality_inspection.py b/erpnext/stock/doctype/quality_inspection/quality_inspection.py
similarity index 73%
rename from erpnext/buying/doctype/quality_inspection/quality_inspection.py
rename to erpnext/stock/doctype/quality_inspection/quality_inspection.py
index d1d9518..3ba3056 100644
--- a/erpnext/buying/doctype/quality_inspection/quality_inspection.py
+++ b/erpnext/stock/doctype/quality_inspection/quality_inspection.py
@@ -24,19 +24,20 @@
 			child.status = 'Accepted'
 
 	def on_submit(self):
-		if self.purchase_receipt_no:
-			frappe.db.sql("""update `tabPurchase Receipt Item` t1, `tabPurchase Receipt` t2
-				set t1.qa_no = %s, t2.modified = %s
-				where t1.parent = %s and t1.item_code = %s and t1.parent = t2.name""",
-				(self.name, self.modified, self.purchase_receipt_no,
-					self.item_code))
-
+		if self.reference_type and self.reference_name:
+			frappe.db.sql("""update `tab{doctype} Item` t1, `tab{doctype}` t2
+				set t1.quality_inspection = %s, t2.modified = %s
+				where t1.parent = %s and t1.item_code = %s and t1.parent = t2.name"""
+				.format(doctype=self.reference_type),
+				(self.name, self.modified, self.reference_name, self.item_code))
+				
 	def on_cancel(self):
-		if self.purchase_receipt_no:
-			frappe.db.sql("""update `tabPurchase Receipt Item` t1, `tabPurchase Receipt` t2
-				set t1.qa_no = '', t2.modified = %s
-				where t1.parent = %s and t1.item_code = %s and t1.parent = t2.name""",
-				(self.modified, self.purchase_receipt_no, self.item_code))
+		if self.reference_type and self.reference_name:
+			frappe.db.sql("""update `tab{doctype} Item` t1, `tab{doctype}` t2
+				set t1.quality_inspection = null, t2.modified = %s
+				where t1.parent = %s and t1.item_code = %s and t1.parent = t2.name"""
+				.format(doctype=self.reference_type),
+				(self.modified, self.reference_name, self.item_code))
 
 def item_query(doctype, txt, searchfield, start, page_len, filters):
 	if filters.get("from"):
diff --git a/erpnext/buying/doctype/quality_inspection/test_quality_inspection.py b/erpnext/stock/doctype/quality_inspection/test_quality_inspection.py
similarity index 100%
rename from erpnext/buying/doctype/quality_inspection/test_quality_inspection.py
rename to erpnext/stock/doctype/quality_inspection/test_quality_inspection.py
diff --git a/erpnext/buying/doctype/quality_inspection_reading/README.md b/erpnext/stock/doctype/quality_inspection_reading/README.md
similarity index 100%
rename from erpnext/buying/doctype/quality_inspection_reading/README.md
rename to erpnext/stock/doctype/quality_inspection_reading/README.md
diff --git a/erpnext/buying/doctype/quality_inspection_reading/__init__.py b/erpnext/stock/doctype/quality_inspection_reading/__init__.py
similarity index 100%
rename from erpnext/buying/doctype/quality_inspection_reading/__init__.py
rename to erpnext/stock/doctype/quality_inspection_reading/__init__.py
diff --git a/erpnext/buying/doctype/quality_inspection_reading/quality_inspection_reading.json b/erpnext/stock/doctype/quality_inspection_reading/quality_inspection_reading.json
similarity index 87%
rename from erpnext/buying/doctype/quality_inspection_reading/quality_inspection_reading.json
rename to erpnext/stock/doctype/quality_inspection_reading/quality_inspection_reading.json
index 099c768..a3b43e9 100644
--- a/erpnext/buying/doctype/quality_inspection_reading/quality_inspection_reading.json
+++ b/erpnext/stock/doctype/quality_inspection_reading/quality_inspection_reading.json
@@ -14,6 +14,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "specification", 
    "fieldtype": "Data", 
    "hidden": 0, 
@@ -21,6 +22,7 @@
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 1, 
+   "in_standard_filter": 0, 
    "label": "Parameter", 
    "length": 0, 
    "no_copy": 0, 
@@ -30,6 +32,7 @@
    "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, 
@@ -40,6 +43,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "value", 
    "fieldtype": "Data", 
    "hidden": 0, 
@@ -47,6 +51,7 @@
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 1, 
+   "in_standard_filter": 0, 
    "label": "Acceptance Criteria", 
    "length": 0, 
    "no_copy": 0, 
@@ -56,6 +61,7 @@
    "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, 
@@ -66,6 +72,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "reading_1", 
    "fieldtype": "Data", 
    "hidden": 0, 
@@ -73,6 +80,7 @@
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 1, 
+   "in_standard_filter": 0, 
    "label": "Reading 1", 
    "length": 0, 
    "no_copy": 0, 
@@ -82,6 +90,7 @@
    "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, 
@@ -92,6 +101,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "reading_2", 
    "fieldtype": "Data", 
    "hidden": 0, 
@@ -99,6 +109,7 @@
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 1, 
+   "in_standard_filter": 0, 
    "label": "Reading 2", 
    "length": 0, 
    "no_copy": 0, 
@@ -108,6 +119,7 @@
    "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, 
@@ -118,6 +130,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "reading_3", 
    "fieldtype": "Data", 
    "hidden": 0, 
@@ -125,6 +138,7 @@
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 1, 
+   "in_standard_filter": 0, 
    "label": "Reading 3", 
    "length": 0, 
    "no_copy": 0, 
@@ -134,6 +148,7 @@
    "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, 
@@ -144,6 +159,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "reading_4", 
    "fieldtype": "Data", 
    "hidden": 0, 
@@ -151,6 +167,7 @@
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 1, 
+   "in_standard_filter": 0, 
    "label": "Reading 4", 
    "length": 0, 
    "no_copy": 0, 
@@ -160,6 +177,7 @@
    "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, 
@@ -170,6 +188,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "reading_5", 
    "fieldtype": "Data", 
    "hidden": 0, 
@@ -177,6 +196,7 @@
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "in_standard_filter": 0, 
    "label": "Reading 5", 
    "length": 0, 
    "no_copy": 0, 
@@ -186,6 +206,7 @@
    "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, 
@@ -196,6 +217,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "reading_6", 
    "fieldtype": "Data", 
    "hidden": 0, 
@@ -203,6 +225,7 @@
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "in_standard_filter": 0, 
    "label": "Reading 6", 
    "length": 0, 
    "no_copy": 0, 
@@ -212,6 +235,7 @@
    "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, 
@@ -222,6 +246,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "reading_7", 
    "fieldtype": "Data", 
    "hidden": 0, 
@@ -229,6 +254,7 @@
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "in_standard_filter": 0, 
    "label": "Reading 7", 
    "length": 0, 
    "no_copy": 0, 
@@ -238,6 +264,7 @@
    "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, 
@@ -248,6 +275,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "reading_8", 
    "fieldtype": "Data", 
    "hidden": 0, 
@@ -255,6 +283,7 @@
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "in_standard_filter": 0, 
    "label": "Reading 8", 
    "length": 0, 
    "no_copy": 0, 
@@ -264,6 +293,7 @@
    "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, 
@@ -274,6 +304,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "reading_9", 
    "fieldtype": "Data", 
    "hidden": 0, 
@@ -281,6 +312,7 @@
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "in_standard_filter": 0, 
    "label": "Reading 9", 
    "length": 0, 
    "no_copy": 0, 
@@ -290,6 +322,7 @@
    "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, 
@@ -300,6 +333,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "reading_10", 
    "fieldtype": "Data", 
    "hidden": 0, 
@@ -307,6 +341,7 @@
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "in_standard_filter": 0, 
    "label": "Reading 10", 
    "length": 0, 
    "no_copy": 0, 
@@ -316,6 +351,7 @@
    "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, 
@@ -326,6 +362,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "default": "Accepted", 
    "fieldname": "status", 
    "fieldtype": "Select", 
@@ -334,6 +371,7 @@
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "in_standard_filter": 0, 
    "label": "Status", 
    "length": 0, 
    "no_copy": 0, 
@@ -344,6 +382,7 @@
    "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, 
@@ -361,9 +400,9 @@
  "issingle": 0, 
  "istable": 1, 
  "max_attachments": 0, 
- "modified": "2016-07-11 03:28:06.296900", 
+ "modified": "2016-11-16 03:55:50.046712", 
  "modified_by": "Administrator", 
- "module": "Buying", 
+ "module": "Stock", 
  "name": "Quality Inspection Reading", 
  "owner": "Administrator", 
  "permissions": [], 
diff --git a/erpnext/buying/doctype/quality_inspection_reading/quality_inspection_reading.py b/erpnext/stock/doctype/quality_inspection_reading/quality_inspection_reading.py
similarity index 100%
rename from erpnext/buying/doctype/quality_inspection_reading/quality_inspection_reading.py
rename to erpnext/stock/doctype/quality_inspection_reading/quality_inspection_reading.py
diff --git a/erpnext/stock/doctype/stock_entry_detail/stock_entry_detail.json b/erpnext/stock/doctype/stock_entry_detail/stock_entry_detail.json
index 2e31ba4..ed1843e 100644
--- a/erpnext/stock/doctype/stock_entry_detail/stock_entry_detail.json
+++ b/erpnext/stock/doctype/stock_entry_detail/stock_entry_detail.json
@@ -31,6 +31,7 @@
    "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, 
@@ -56,6 +57,7 @@
    "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, 
@@ -76,7 +78,7 @@
    "in_list_view": 1, 
    "label": "Source Warehouse", 
    "length": 0, 
-   "no_copy": 1, 
+   "no_copy": 0, 
    "oldfieldname": "s_warehouse", 
    "oldfieldtype": "Link", 
    "options": "Warehouse", 
@@ -84,6 +86,7 @@
    "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, 
@@ -108,6 +111,7 @@
    "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, 
@@ -128,7 +132,7 @@
    "in_list_view": 1, 
    "label": "Target Warehouse", 
    "length": 0, 
-   "no_copy": 1, 
+   "no_copy": 0, 
    "oldfieldname": "t_warehouse", 
    "oldfieldtype": "Link", 
    "options": "Warehouse", 
@@ -136,6 +140,7 @@
    "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, 
@@ -160,6 +165,7 @@
    "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, 
@@ -188,6 +194,7 @@
    "print_hide": 0, 
    "print_hide_if_no_value": 0, 
    "read_only": 0, 
+   "remember_last_selected_value": 0, 
    "report_hide": 0, 
    "reqd": 1, 
    "search_index": 1, 
@@ -212,6 +219,7 @@
    "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, 
@@ -237,6 +245,7 @@
    "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, 
@@ -263,6 +272,7 @@
    "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, 
@@ -291,6 +301,7 @@
    "print_hide_if_no_value": 0, 
    "print_width": "300px", 
    "read_only": 0, 
+   "remember_last_selected_value": 0, 
    "report_hide": 0, 
    "reqd": 0, 
    "search_index": 0, 
@@ -317,6 +328,7 @@
    "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, 
@@ -343,6 +355,7 @@
    "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, 
@@ -370,6 +383,7 @@
    "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, 
@@ -395,6 +409,7 @@
    "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, 
@@ -422,6 +437,7 @@
    "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, 
@@ -450,6 +466,7 @@
    "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, 
@@ -477,6 +494,7 @@
    "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, 
@@ -504,6 +522,7 @@
    "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, 
@@ -532,6 +551,7 @@
    "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, 
@@ -559,6 +579,7 @@
    "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, 
@@ -583,6 +604,7 @@
    "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, 
@@ -611,6 +633,7 @@
    "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, 
@@ -638,6 +661,7 @@
    "print_hide": 1, 
    "print_hide_if_no_value": 0, 
    "read_only": 1, 
+   "remember_last_selected_value": 0, 
    "report_hide": 0, 
    "reqd": 1, 
    "search_index": 0, 
@@ -666,6 +690,7 @@
    "print_hide": 1, 
    "print_hide_if_no_value": 0, 
    "read_only": 1, 
+   "remember_last_selected_value": 0, 
    "report_hide": 0, 
    "reqd": 1, 
    "search_index": 0, 
@@ -693,6 +718,7 @@
    "print_hide": 1, 
    "print_hide_if_no_value": 0, 
    "read_only": 1, 
+   "remember_last_selected_value": 0, 
    "report_hide": 0, 
    "reqd": 1, 
    "search_index": 0, 
@@ -718,6 +744,7 @@
    "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, 
@@ -745,6 +772,7 @@
    "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, 
@@ -769,6 +797,7 @@
    "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, 
@@ -797,6 +826,7 @@
    "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, 
@@ -822,6 +852,7 @@
    "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, 
@@ -849,6 +880,7 @@
    "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, 
@@ -873,6 +905,7 @@
    "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, 
@@ -901,6 +934,7 @@
    "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, 
@@ -926,6 +960,7 @@
    "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, 
@@ -953,6 +988,7 @@
    "print_hide": 1, 
    "print_hide_if_no_value": 0, 
    "read_only": 1, 
+   "remember_last_selected_value": 0, 
    "report_hide": 0, 
    "reqd": 0, 
    "search_index": 1, 
@@ -980,6 +1016,7 @@
    "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, 
@@ -1004,6 +1041,7 @@
    "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, 
@@ -1031,6 +1069,7 @@
    "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, 
@@ -1057,6 +1096,7 @@
    "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, 
@@ -1074,7 +1114,7 @@
  "issingle": 0, 
  "istable": 1, 
  "max_attachments": 0, 
- "modified": "2016-11-04 23:37:17.764323", 
+ "modified": "2016-11-27 15:19:26.597414", 
  "modified_by": "Administrator", 
  "module": "Stock", 
  "name": "Stock Entry Detail", 
diff --git a/erpnext/stock/doctype/stock_ledger_entry/stock_ledger_entry.json b/erpnext/stock/doctype/stock_ledger_entry/stock_ledger_entry.json
index 32beb1a..d27f629 100644
--- a/erpnext/stock/doctype/stock_ledger_entry/stock_ledger_entry.json
+++ b/erpnext/stock/doctype/stock_ledger_entry/stock_ledger_entry.json
@@ -3,16 +3,20 @@
  "allow_import": 0, 
  "allow_rename": 0, 
  "autoname": "SLE/.########", 
+ "beta": 0, 
  "creation": "2013-01-29 19:25:42", 
  "custom": 0, 
  "docstatus": 0, 
  "doctype": "DocType", 
  "document_type": "Other", 
+ "editable_grid": 0, 
+ "engine": "InnoDB", 
  "fields": [
   {
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "item_code", 
    "fieldtype": "Link", 
    "hidden": 0, 
@@ -31,6 +35,7 @@
    "print_hide_if_no_value": 0, 
    "print_width": "100px", 
    "read_only": 1, 
+   "remember_last_selected_value": 0, 
    "report_hide": 0, 
    "reqd": 0, 
    "search_index": 1, 
@@ -42,6 +47,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "serial_no", 
    "fieldtype": "Text", 
    "hidden": 0, 
@@ -57,6 +63,7 @@
    "print_hide_if_no_value": 0, 
    "print_width": "100px", 
    "read_only": 1, 
+   "remember_last_selected_value": 0, 
    "report_hide": 0, 
    "reqd": 0, 
    "search_index": 0, 
@@ -68,6 +75,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "batch_no", 
    "fieldtype": "Data", 
    "hidden": 0, 
@@ -84,6 +92,7 @@
    "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, 
@@ -94,6 +103,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "warehouse", 
    "fieldtype": "Link", 
    "hidden": 0, 
@@ -112,6 +122,7 @@
    "print_hide_if_no_value": 0, 
    "print_width": "100px", 
    "read_only": 1, 
+   "remember_last_selected_value": 0, 
    "report_hide": 0, 
    "reqd": 0, 
    "search_index": 1, 
@@ -123,6 +134,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "posting_date", 
    "fieldtype": "Date", 
    "hidden": 0, 
@@ -140,6 +152,7 @@
    "print_hide_if_no_value": 0, 
    "print_width": "100px", 
    "read_only": 1, 
+   "remember_last_selected_value": 0, 
    "report_hide": 0, 
    "reqd": 0, 
    "search_index": 1, 
@@ -151,6 +164,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "posting_time", 
    "fieldtype": "Time", 
    "hidden": 0, 
@@ -168,6 +182,7 @@
    "print_hide_if_no_value": 0, 
    "print_width": "100px", 
    "read_only": 1, 
+   "remember_last_selected_value": 0, 
    "report_hide": 0, 
    "reqd": 0, 
    "search_index": 0, 
@@ -179,6 +194,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "voucher_type", 
    "fieldtype": "Link", 
    "hidden": 0, 
@@ -197,6 +213,7 @@
    "print_hide_if_no_value": 0, 
    "print_width": "150px", 
    "read_only": 1, 
+   "remember_last_selected_value": 0, 
    "report_hide": 0, 
    "reqd": 0, 
    "search_index": 0, 
@@ -208,6 +225,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "voucher_no", 
    "fieldtype": "Dynamic Link", 
    "hidden": 0, 
@@ -226,6 +244,7 @@
    "print_hide_if_no_value": 0, 
    "print_width": "150px", 
    "read_only": 1, 
+   "remember_last_selected_value": 0, 
    "report_hide": 0, 
    "reqd": 0, 
    "search_index": 0, 
@@ -237,6 +256,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "voucher_detail_no", 
    "fieldtype": "Data", 
    "hidden": 0, 
@@ -254,6 +274,7 @@
    "print_hide_if_no_value": 0, 
    "print_width": "150px", 
    "read_only": 1, 
+   "remember_last_selected_value": 0, 
    "report_hide": 0, 
    "reqd": 0, 
    "search_index": 0, 
@@ -265,6 +286,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "actual_qty", 
    "fieldtype": "Float", 
    "hidden": 0, 
@@ -282,6 +304,7 @@
    "print_hide_if_no_value": 0, 
    "print_width": "150px", 
    "read_only": 1, 
+   "remember_last_selected_value": 0, 
    "report_hide": 0, 
    "reqd": 0, 
    "search_index": 0, 
@@ -293,6 +316,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "incoming_rate", 
    "fieldtype": "Currency", 
    "hidden": 0, 
@@ -310,6 +334,7 @@
    "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, 
@@ -320,6 +345,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "outgoing_rate", 
    "fieldtype": "Currency", 
    "hidden": 0, 
@@ -336,6 +362,7 @@
    "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, 
@@ -346,6 +373,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "stock_uom", 
    "fieldtype": "Link", 
    "hidden": 0, 
@@ -364,6 +392,7 @@
    "print_hide_if_no_value": 0, 
    "print_width": "150px", 
    "read_only": 1, 
+   "remember_last_selected_value": 0, 
    "report_hide": 0, 
    "reqd": 0, 
    "search_index": 0, 
@@ -375,6 +404,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "qty_after_transaction", 
    "fieldtype": "Float", 
    "hidden": 0, 
@@ -392,6 +422,7 @@
    "print_hide_if_no_value": 0, 
    "print_width": "150px", 
    "read_only": 1, 
+   "remember_last_selected_value": 0, 
    "report_hide": 0, 
    "reqd": 0, 
    "search_index": 0, 
@@ -403,6 +434,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "valuation_rate", 
    "fieldtype": "Currency", 
    "hidden": 0, 
@@ -421,6 +453,7 @@
    "print_hide_if_no_value": 0, 
    "print_width": "150px", 
    "read_only": 1, 
+   "remember_last_selected_value": 0, 
    "report_hide": 0, 
    "reqd": 0, 
    "search_index": 0, 
@@ -432,6 +465,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "stock_value", 
    "fieldtype": "Currency", 
    "hidden": 0, 
@@ -449,6 +483,7 @@
    "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, 
@@ -459,6 +494,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "stock_value_difference", 
    "fieldtype": "Currency", 
    "hidden": 0, 
@@ -474,6 +510,7 @@
    "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, 
@@ -484,6 +521,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "stock_queue", 
    "fieldtype": "Text", 
    "hidden": 1, 
@@ -500,6 +538,7 @@
    "print_hide": 1, 
    "print_hide_if_no_value": 0, 
    "read_only": 1, 
+   "remember_last_selected_value": 0, 
    "report_hide": 1, 
    "reqd": 0, 
    "search_index": 0, 
@@ -510,6 +549,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "project", 
    "fieldtype": "Link", 
    "hidden": 0, 
@@ -525,6 +565,7 @@
    "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, 
@@ -535,6 +576,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "company", 
    "fieldtype": "Link", 
    "hidden": 0, 
@@ -553,6 +595,7 @@
    "print_hide_if_no_value": 0, 
    "print_width": "150px", 
    "read_only": 1, 
+   "remember_last_selected_value": 0, 
    "report_hide": 0, 
    "reqd": 0, 
    "search_index": 0, 
@@ -564,6 +607,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "fiscal_year", 
    "fieldtype": "Data", 
    "hidden": 0, 
@@ -581,6 +625,7 @@
    "print_hide_if_no_value": 0, 
    "print_width": "150px", 
    "read_only": 1, 
+   "remember_last_selected_value": 0, 
    "report_hide": 0, 
    "reqd": 0, 
    "search_index": 0, 
@@ -592,6 +637,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "is_cancelled", 
    "fieldtype": "Select", 
    "hidden": 1, 
@@ -607,6 +653,7 @@
    "print_hide": 0, 
    "print_hide_if_no_value": 0, 
    "read_only": 0, 
+   "remember_last_selected_value": 0, 
    "report_hide": 1, 
    "reqd": 0, 
    "search_index": 0, 
@@ -618,13 +665,14 @@
  "hide_toolbar": 1, 
  "icon": "icon-list", 
  "idx": 1, 
+ "image_view": 0, 
  "in_create": 1, 
  "in_dialog": 0, 
  "is_submittable": 0, 
  "issingle": 0, 
  "istable": 0, 
  "max_attachments": 0, 
- "modified": "2016-03-29 13:26:08.241138", 
+ "modified": "2016-11-27 16:31:36.294708", 
  "modified_by": "Administrator", 
  "module": "Stock", 
  "name": "Stock Ledger Entry", 
@@ -640,6 +688,7 @@
    "export": 1, 
    "if_owner": 0, 
    "import": 0, 
+   "is_custom": 0, 
    "permlevel": 0, 
    "print": 1, 
    "read": 1, 
@@ -657,9 +706,31 @@
    "create": 0, 
    "delete": 0, 
    "email": 0, 
+   "export": 0, 
+   "if_owner": 0, 
+   "import": 0, 
+   "is_custom": 0, 
+   "permlevel": 0, 
+   "print": 0, 
+   "read": 1, 
+   "report": 0, 
+   "role": "Item Manager", 
+   "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": 1, 
    "if_owner": 0, 
    "import": 0, 
+   "is_custom": 0, 
    "permlevel": 0, 
    "print": 0, 
    "read": 1, 
@@ -671,6 +742,7 @@
    "write": 0
   }
  ], 
+ "quick_entry": 0, 
  "read_only": 0, 
  "read_only_onload": 0, 
  "sort_field": "modified", 
diff --git a/erpnext/support/page/support_analytics/support_analytics.js b/erpnext/support/page/support_analytics/support_analytics.js
index 79a7fd6..01b7b48 100644
--- a/erpnext/support/page/support_analytics/support_analytics.js
+++ b/erpnext/support/page/support_analytics/support_analytics.js
@@ -27,11 +27,11 @@
 	},
 
 	filters: [
-		{fieldtype:"Select", label: __("Fiscal Year"), link:"Fiscal Year",
+		{fieldname: "fiscal_year", fieldtype:"Select", label: __("Fiscal Year"), link:"Fiscal Year",
 			default_value: __("Select Fiscal Year") + "..."},
-		{fieldtype:"Date", label: __("From Date")},
-		{fieldtype:"Date", label: __("To Date")},
-		{fieldtype:"Select", label: __("Range"),
+		{fieldname: "from_date", fieldtype:"Date", label: __("From Date")},
+		{fieldname: "to_date", fieldtype:"Date", label: __("To Date")},
+		{fieldname: "range", fieldtype:"Select", label: __("Range"),
 			options:["Daily", "Weekly", "Monthly", "Quarterly", "Yearly"], default_value: "Monthly"}
 	],
 	
diff --git a/erpnext/utilities/transaction_base.py b/erpnext/utilities/transaction_base.py
index 051334c..3cc79ef 100644
--- a/erpnext/utilities/transaction_base.py
+++ b/erpnext/utilities/transaction_base.py
@@ -125,20 +125,6 @@
 			ret = None
 		
 		return ret
-	
-	def delink_advance_entries(self, linked_doc_name):
-		total_allocated_amount = 0
-		for adv in self.advances:
-			consider_for_total_advance = True
-			if adv.reference_name == linked_doc_name:
-				frappe.db.sql("""delete from `tab{0} Advance`
-					where name = %s""".format(self.doctype), adv.name)
-				consider_for_total_advance = False
-
-			if consider_for_total_advance:
-				total_allocated_amount += flt(adv.allocated_amount, adv.precision("allocated_amount"))
-
-		frappe.db.set_value(self.doctype, self.name, "total_advance", total_allocated_amount, update_modified=False)
 
 def delete_events(ref_type, ref_name):
 	frappe.delete_doc("Event", frappe.db.sql_list("""select name from `tabEvent`