Patch to delete previous report
diff --git a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js
index 444c3b5..c655626 100644
--- a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js
+++ b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js
@@ -47,7 +47,7 @@
 
 		if(doc.docstatus===0) {
 			cur_frm.add_custom_button(__('Purchase Order'), function() {
-				frappe.model.map_current_doc({
+				erpnext.utils.map_current_doc({
 					method: "erpnext.buying.doctype.purchase_order.purchase_order.make_purchase_invoice",
 					source_doctype: "Purchase Order",
 					get_query_filters: {
@@ -61,7 +61,7 @@
 			}, __("Get items from"));
 
 			cur_frm.add_custom_button(__('Purchase Receipt'), function() {
-				frappe.model.map_current_doc({
+				erpnext.utils.map_current_doc({
 					method: "erpnext.stock.doctype.purchase_receipt.purchase_receipt.make_purchase_invoice",
 					source_doctype: "Purchase Receipt",
 					get_query_filters: {
diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.js b/erpnext/accounts/doctype/sales_invoice/sales_invoice.js
index 1d48df0..64379a1 100644
--- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.js
+++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.js
@@ -101,7 +101,7 @@
 	sales_order_btn: function() {
 		this.$sales_order_btn = cur_frm.add_custom_button(__('Sales Order'),
 			function() {
-				frappe.model.map_current_doc({
+				erpnext.utils.map_current_doc({
 					method: "erpnext.selling.doctype.sales_order.sales_order.make_sales_invoice",
 					source_doctype: "Sales Order",
 					get_query_filters: {
@@ -118,7 +118,7 @@
 	delivery_note_btn: function() {
 		this.$delivery_note_btn = cur_frm.add_custom_button(__('Delivery Note'),
 			function() {
-				frappe.model.map_current_doc({
+				erpnext.utils.map_current_doc({
 					method: "erpnext.stock.doctype.delivery_note.delivery_note.make_sales_invoice",
 					source_doctype: "Delivery Note",
 					get_query: function() {
diff --git a/erpnext/accounts/report/bank_clearance_summary/bank_clearance_summary.py b/erpnext/accounts/report/bank_clearance_summary/bank_clearance_summary.py
index 07ab969..d9bac3c 100644
--- a/erpnext/accounts/report/bank_clearance_summary/bank_clearance_summary.py
+++ b/erpnext/accounts/report/bank_clearance_summary/bank_clearance_summary.py
@@ -8,43 +8,43 @@
 
 def execute(filters=None):
 	if not filters: filters = {}
-	
+
 	columns = get_columns()
 	data = get_entries(filters)
-	
+
 	return columns, data
-	
+
 def get_columns():
 	return [
-		_("Payment Document") + ":Link/DocType:130", 
-		_("Payment Entry") + ":Dynamic Link/"+_("Payment Document")+":110", 
-		_("Posting Date") + ":Date:100", 
+		_("Payment Document") + ":Link/DocType:130",
+		_("Payment Entry") + ":Dynamic Link/"+_("Payment Document")+":110",
+		_("Posting Date") + ":Date:100",
 		_("Cheque/Reference No") + "::120",
-		_("Clearance Date") + ":Date:100", 
-		_("Against Account") + ":Link/Account:170", 
+		_("Clearance Date") + ":Date:100",
+		_("Against Account") + ":Link/Account:170",
 		_("Amount") + ":Currency:120"
 	]
 
 def get_conditions(filters):
 	conditions = ""
-		
+
 	if filters.get("from_date"): conditions += " and posting_date>=%(from_date)s"
 	if filters.get("to_date"): conditions += " and posting_date<=%(to_date)s"
-	
+
 	return conditions
-	
+
 def get_entries(filters):
 	conditions = get_conditions(filters)
-	journal_entries =  frappe.db.sql("""select "Journal Entry", jv.name, jv.posting_date, 
+	journal_entries =  frappe.db.sql("""select "Journal Entry", jv.name, jv.posting_date,
 		jv.cheque_no, jv.clearance_date, jvd.against_account, (jvd.debit - jvd.credit)
-		from `tabJournal Entry Account` jvd, `tabJournal Entry` jv 
+		from `tabJournal Entry Account` jvd, `tabJournal Entry` jv
 		where jvd.parent = jv.name and jv.docstatus=1 and jvd.account = %(account)s {0}
 		order by posting_date DESC, jv.name DESC""".format(conditions), filters, as_list=1)
-		
-	payment_entries =  frappe.db.sql("""select "Payment Entry", name, posting_date, 
+
+	payment_entries =  frappe.db.sql("""select "Payment Entry", name, posting_date,
 		reference_no, clearance_date, party, if(paid_from=%(account)s, paid_amount, received_amount)
 		from `tabPayment Entry`
 		where docstatus=1 and (paid_from = %(account)s or paid_to = %(account)s) {0}
-		order by posting_date DESC, name DESC""".format(conditions), filters, as_list=1, debug=1)
-		
+		order by posting_date DESC, name DESC""".format(conditions), filters, as_list=1)
+
 	return sorted(journal_entries + payment_entries, key=lambda k: k[2] or getdate(nowdate()))
\ No newline at end of file
diff --git a/erpnext/accounts/report/profit_and_loss_statement/profit_and_loss_statement.js b/erpnext/accounts/report/profit_and_loss_statement/profit_and_loss_statement.js
index 91ec9d9..0f7a6b6 100644
--- a/erpnext/accounts/report/profit_and_loss_statement/profit_and_loss_statement.js
+++ b/erpnext/accounts/report/profit_and_loss_statement/profit_and_loss_statement.js
@@ -2,7 +2,8 @@
 // License: GNU General Public License v3. See license.txt
 
 frappe.require("assets/erpnext/js/financial_statements.js", function() {
-	frappe.query_reports["Profit and Loss Statement"] = $.extend({}, erpnext.financial_statements);
+	frappe.query_reports["Profit and Loss Statement"] = $.extend({},
+		erpnext.financial_statements);
 
 	frappe.query_reports["Profit and Loss Statement"]["filters"].push({
 		"fieldname": "accumulated_values",
diff --git a/erpnext/buying/doctype/purchase_order/purchase_order.js b/erpnext/buying/doctype/purchase_order/purchase_order.js
index 9624967..15356fd 100644
--- a/erpnext/buying/doctype/purchase_order/purchase_order.js
+++ b/erpnext/buying/doctype/purchase_order/purchase_order.js
@@ -87,7 +87,7 @@
 	},
 
 	get_items_from_open_material_requests: function() {
-		frappe.model.map_current_doc({
+		erpnext.utils.map_current_doc({
 			method: "erpnext.stock.doctype.material_request.material_request.make_purchase_order_based_on_supplier",
 			source_name: this.frm.doc.supplier,
 			get_query_filters: {
@@ -150,7 +150,7 @@
 	add_from_mappers: function() {
 		cur_frm.add_custom_button(__('Material Request'),
 			function() {
-				frappe.model.map_current_doc({
+				erpnext.utils.map_current_doc({
 					method: "erpnext.stock.doctype.material_request.material_request.make_purchase_order",
 					source_doctype: "Material Request",
 					get_query_filters: {
@@ -165,7 +165,7 @@
 
 		cur_frm.add_custom_button(__('Supplier Quotation'),
 			function() {
-				frappe.model.map_current_doc({
+				erpnext.utils.map_current_doc({
 					method: "erpnext.buying.doctype.supplier_quotation.supplier_quotation.make_purchase_order",
 					source_doctype: "Supplier Quotation",
 					get_query_filters: {
diff --git a/erpnext/buying/doctype/request_for_quotation/request_for_quotation.js b/erpnext/buying/doctype/request_for_quotation/request_for_quotation.js
index 9a81467..ce1c088 100644
--- a/erpnext/buying/doctype/request_for_quotation/request_for_quotation.js
+++ b/erpnext/buying/doctype/request_for_quotation/request_for_quotation.js
@@ -135,7 +135,7 @@
 		if (this.frm.doc.docstatus===0) {
 			cur_frm.add_custom_button(__('Material Request'),
 				function() {
-					frappe.model.map_current_doc({
+					erpnext.utils.map_current_doc({
 						method: "erpnext.stock.doctype.material_request.material_request.make_request_for_quotation",
 						source_doctype: "Material Request",
 						get_query_filters: {
diff --git a/erpnext/buying/doctype/supplier_quotation/supplier_quotation.js b/erpnext/buying/doctype/supplier_quotation/supplier_quotation.js
index b3030f7..1859cf5 100644
--- a/erpnext/buying/doctype/supplier_quotation/supplier_quotation.js
+++ b/erpnext/buying/doctype/supplier_quotation/supplier_quotation.js
@@ -15,7 +15,7 @@
 		else if (this.frm.doc.docstatus===0) {
 			cur_frm.add_custom_button(__('Material Request'),
 				function() {
-					frappe.model.map_current_doc({
+					erpnext.utils.map_current_doc({
 						method: "erpnext.stock.doctype.material_request.material_request.make_supplier_quotation",
 						source_doctype: "Material Request",
 						get_query_filters: {
diff --git a/erpnext/controllers/item_variant.py b/erpnext/controllers/item_variant.py
index 41b8b88..3ff3d88 100644
--- a/erpnext/controllers/item_variant.py
+++ b/erpnext/controllers/item_variant.py
@@ -28,16 +28,14 @@
 
 	return find_variant(template, args, variant)
 
-def validate_item_variant_attributes(item, args):
-	attribute_values = {}
-	for t in frappe.get_all("Item Attribute Value", fields=["parent", "attribute_value"],
-		filters={"parent": ["in", args.keys()]}):
+def validate_item_variant_attributes(item, args=None):
+	if not args:
+		args = {d.attribute.lower():d.attribute_value for d in item.attributes}
 
-		(attribute_values.setdefault(t.parent.lower(), [])).append(t.attribute_value)
+	attribute_values = get_attribute_values()
 
-	numeric_attributes = frappe._dict((t.attribute.lower(), t) for t in \
-		frappe.db.sql("""select attribute, from_range, to_range, increment from `tabItem Variant Attribute`
-		where parent = %s and numeric_values=1""", (item), as_dict=1))
+	numeric_attributes = frappe._dict({d.attribute.lower(): d for d
+		in item.attributes if d.numeric_values==1})
 
 	for attribute, value in args.items():
 		if attribute.lower() in numeric_attributes:
@@ -56,7 +54,7 @@
 			#avoid precision error by rounding the remainder
 			remainder = flt((flt(value) - from_range) % increment, precision)
 
-			is_incremental = remainder==0 or remainder==0 or remainder==increment
+			is_incremental = remainder==0 or remainder==increment
 
 			if not (is_in_range and is_incremental):
 				frappe.throw(_("Value for Attribute {0} must be within the range of {1} to {2} in the increments of {3}")\
@@ -66,6 +64,16 @@
 			frappe.throw(_("Value {0} for Attribute {1} does not exist in the list of valid Item Attribute Values").format(
 				value, attribute), InvalidItemAttributeValueError)
 
+def get_attribute_values():
+	if not frappe.flags.attribute_values:
+		attribute_values = {}
+		for t in frappe.get_all("Item Attribute Value", fields=["parent", "attribute_value"]):
+			(attribute_values.setdefault(t.parent.lower(), [])).append(t.attribute_value)
+
+		frappe.flags.attribute_values = attribute_values
+
+	return frappe.flags.attribute_values
+
 def find_variant(template, args, variant_item_code=None):
 	conditions = ["""(iv_attribute.attribute="{0}" and iv_attribute.attribute_value="{1}")"""\
 		.format(frappe.db.escape(key), frappe.db.escape(cstr(value))) for key, value in args.items()]
diff --git a/erpnext/crm/doctype/opportunity/opportunity.js b/erpnext/crm/doctype/opportunity/opportunity.js
index 9144692..21a7429 100644
--- a/erpnext/crm/doctype/opportunity/opportunity.js
+++ b/erpnext/crm/doctype/opportunity/opportunity.js
@@ -128,7 +128,7 @@
 
 cur_frm.cscript.lead = function(doc, cdt, cdn) {
 	cur_frm.toggle_display("contact_info", doc.customer || doc.lead);
-	frappe.model.map_current_doc({
+	erpnext.utils.map_current_doc({
 		method: "erpnext.crm.doctype.lead.lead.make_opportunity",
 		source_name: cur_frm.doc.lead,
 		frm: cur_frm
diff --git a/erpnext/demo/demo.py b/erpnext/demo/demo.py
index 9b9d898..6642e7b 100644
--- a/erpnext/demo/demo.py
+++ b/erpnext/demo/demo.py
@@ -4,7 +4,7 @@
 import erpnext
 import frappe.utils
 from erpnext.demo.setup_data import setup_data
-from erpnext.demo.user import hr, sales, purchase, manufacturing, stock
+from erpnext.demo.user import hr, sales, purchase, manufacturing, stock, accounts
 
 """
 Make a demo
@@ -68,8 +68,7 @@
 		purchase.work()
 		manufacturing.work()
 		stock.work()
-		# run_stock()
-		# run_accounts()
+		accounts.work()
 		# run_projects()
 		# run_messages()
 
diff --git a/erpnext/demo/setup_data.py b/erpnext/demo/setup_data.py
index 1033f7d..6f1fb0a 100644
--- a/erpnext/demo/setup_data.py
+++ b/erpnext/demo/setup_data.py
@@ -330,6 +330,6 @@
 
 	if not frappe.db.get_global('demo_accounts_user'):
 		user = frappe.get_doc('User', 'LeonAbdulov@example.com')
-		user.add_roles('Accounts User', 'Accounts Manager')
+		user.add_roles('Accounts User', 'Accounts Manager', 'Sales User', 'Purchase User')
 		frappe.db.set_global('demo_accounts_user', user.name)
 
diff --git a/erpnext/demo/user/accounts.py b/erpnext/demo/user/accounts.py
index 4a514ef..d3df627 100644
--- a/erpnext/demo/user/accounts.py
+++ b/erpnext/demo/user/accounts.py
@@ -15,8 +15,7 @@
 	if random.random() < 0.5:
 		from erpnext.selling.doctype.sales_order.sales_order import make_sales_invoice
 		report = "Ordered Items to be Billed"
-		for so in list(set([r[0] for r in
-			query_report.run(report)["result"]
+		for so in list(set([r[0] for r in query_report.run(report)["result"]
 				if r[0]!="Total"]))[:random.randint(1, 5)]:
 			si = frappe.get_doc(make_sales_invoice(so))
 			si.posting_date = frappe.flags.current_date
diff --git a/erpnext/demo/user/purchase.py b/erpnext/demo/user/purchase.py
index ff40e74..6f06f26 100644
--- a/erpnext/demo/user/purchase.py
+++ b/erpnext/demo/user/purchase.py
@@ -131,10 +131,13 @@
 	po.is_subcontracted = "Yes"
 	po.supplier = get_random("Supplier")
 
+	item_code = get_random("Item", {"is_sub_contracted_item": 1})
+	moq = frappe.db.get_value('Item', item_code, 'min_order_qty')
+
 	po.append("items", {
-		"item_code": get_random("Item", {"is_sub_contracted_item": 1}),
+		"item_code": item_code,
 		"schedule_date": frappe.utils.add_days(frappe.flags.current_date, 7),
-		"qty": 20
+		"qty": moq
 	})
 	po.set_missing_values()
 	try:
diff --git a/erpnext/docs/license.html b/erpnext/docs/license.html
index b0310f6..6aa4e64 100644
--- a/erpnext/docs/license.html
+++ b/erpnext/docs/license.html
@@ -13,7 +13,7 @@
 
 <p>Version 3, 29 June 2007</p>
 
-<p>http://www.gnu.org/copyleft/gpl.html</p>
+<p><a href="http://www.gnu.org/copyleft/gpl.html" rel="nofollow">http://www.gnu.org/copyleft/gpl.html</a></p>
 
 <p>TERMS AND CONDITIONS
 0. Definitions.</p>
diff --git a/erpnext/docs/user/manual/de/Beispiel/Beispiel.md b/erpnext/docs/user/manual/de/Beispiel/index.md
similarity index 100%
rename from erpnext/docs/user/manual/de/Beispiel/Beispiel.md
rename to erpnext/docs/user/manual/de/Beispiel/index.md
diff --git a/erpnext/hr/doctype/appraisal/appraisal.js b/erpnext/hr/doctype/appraisal/appraisal.js
index 4cfcd7e..728e5c2 100644
--- a/erpnext/hr/doctype/appraisal/appraisal.js
+++ b/erpnext/hr/doctype/appraisal/appraisal.js
@@ -24,7 +24,7 @@
 }
 
 cur_frm.cscript.kra_template = function(doc, dt, dn) {
-	frappe.model.map_current_doc({
+	erpnext.utils.map_current_doc({
 		method: "erpnext.hr.doctype.appraisal.appraisal.fetch_appraisal_template",
 		source_name: cur_frm.doc.kra_template,
 		frm: cur_frm
diff --git a/erpnext/hr/doctype/salary_structure/salary_structure.js b/erpnext/hr/doctype/salary_structure/salary_structure.js
index 10b7544..fab7ac4 100755
--- a/erpnext/hr/doctype/salary_structure/salary_structure.js
+++ b/erpnext/hr/doctype/salary_structure/salary_structure.js
@@ -32,8 +32,8 @@
 	},
 
 	toggle_fields: function(frm) {
-		frm.toggle_display('time_sheet_earning_detail', frm.doc.salary_slip_based_on_timesheet);
-		frm.toggle_reqd('salary_component', frm.doc.salary_slip_based_on_timesheet);
+		frm.toggle_display(['salary_component', 'hour_rate'], frm.doc.salary_slip_based_on_timesheet);
+		frm.toggle_reqd(['salary_component', 'hour_rate'], frm.doc.salary_slip_based_on_timesheet);
 	}
 })
 
diff --git a/erpnext/hr/doctype/salary_structure/salary_structure.json b/erpnext/hr/doctype/salary_structure/salary_structure.json
index 08b0355..4cdc67b 100644
--- a/erpnext/hr/doctype/salary_structure/salary_structure.json
+++ b/erpnext/hr/doctype/salary_structure/salary_structure.json
@@ -8,6 +8,7 @@
  "docstatus": 0, 
  "doctype": "DocType", 
  "document_type": "Document", 
+ "editable_grid": 0, 
  "fields": [
   {
    "allow_on_submit": 0, 
@@ -353,6 +354,31 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "fieldname": "time_sheet_earning_detail", 
+   "fieldtype": "Section Break", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "label": "", 
+   "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, 
    "depends_on": "", 
    "fieldname": "salary_slip_based_on_timesheet", 
    "fieldtype": "Check", 
@@ -379,14 +405,13 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
-   "fieldname": "time_sheet_earning_detail", 
-   "fieldtype": "Section Break", 
+   "fieldname": "column_break_17", 
+   "fieldtype": "Column Break", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
-   "label": "", 
    "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
@@ -432,30 +457,6 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
-   "fieldname": "column_break_17", 
-   "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, 
    "depends_on": "", 
    "fieldname": "hour_rate", 
    "fieldtype": "Currency", 
@@ -779,7 +780,7 @@
  "issingle": 0, 
  "istable": 0, 
  "max_attachments": 0, 
- "modified": "2016-07-02 18:04:06.529332", 
+ "modified": "2016-07-13 23:56:01.550518", 
  "modified_by": "Administrator", 
  "module": "HR", 
  "name": "Salary Structure", 
diff --git a/erpnext/maintenance/doctype/maintenance_schedule/maintenance_schedule.js b/erpnext/maintenance/doctype/maintenance_schedule/maintenance_schedule.js
index cf0ee51..bcf1ae6 100644
--- a/erpnext/maintenance/doctype/maintenance_schedule/maintenance_schedule.js
+++ b/erpnext/maintenance/doctype/maintenance_schedule/maintenance_schedule.js
@@ -20,7 +20,7 @@
 		if (this.frm.doc.docstatus === 0) {
 			this.frm.add_custom_button(__('Sales Order'),
 				function() {
-					frappe.model.map_current_doc({
+					erpnext.utils.map_current_doc({
 						method: "erpnext.selling.doctype.sales_order.sales_order.make_maintenance_schedule",
 						source_doctype: "Sales Order",
 						get_query_filters: {
diff --git a/erpnext/maintenance/doctype/maintenance_visit/maintenance_visit.js b/erpnext/maintenance/doctype/maintenance_visit/maintenance_visit.js
index 5615886..38c20da 100644
--- a/erpnext/maintenance/doctype/maintenance_visit/maintenance_visit.js
+++ b/erpnext/maintenance/doctype/maintenance_visit/maintenance_visit.js
@@ -19,7 +19,7 @@
 		if (this.frm.doc.docstatus===0) {
 			cur_frm.add_custom_button(__('Maintenance Schedule'),
 				function() {
-					frappe.model.map_current_doc({
+					erpnext.utils.map_current_doc({
 						method: "erpnext.maintenance.doctype.maintenance_schedule.maintenance_schedule.make_maintenance_visit",
 						source_doctype: "Maintenance Schedule",
 						get_query_filters: {
@@ -31,7 +31,7 @@
 				}, __("Get items from"));
 			cur_frm.add_custom_button(__('Warranty Claim'),
 				function() {
-					frappe.model.map_current_doc({
+					erpnext.utils.map_current_doc({
 						method: "erpnext.support.doctype.warranty_claim.warranty_claim.make_maintenance_visit",
 						source_doctype: "Warranty Claim",
 						get_query_filters: {
@@ -43,7 +43,7 @@
 				}, __("Get items from"));
 			cur_frm.add_custom_button(__('Sales Order'),
 				function() {
-					frappe.model.map_current_doc({
+					erpnext.utils.map_current_doc({
 						method: "erpnext.selling.doctype.sales_order.sales_order.make_maintenance_visit",
 						source_doctype: "Sales Order",
 						get_query_filters: {
diff --git a/erpnext/patches.txt b/erpnext/patches.txt
index 3518f0f..45fa3f3 100644
--- a/erpnext/patches.txt
+++ b/erpnext/patches.txt
@@ -293,4 +293,5 @@
 execute:frappe.delete_doc_if_exists("Report", "Customers Not Buying Since Long Time")
 erpnext.patches.v7_0.make_is_group_fieldtype_as_check
 execute:frappe.reload_doc('projects', 'doctype', 'timesheet', force=True)
-execute:frappe.delete_doc_if_exists("Report", "Employee Holiday Attendance")
\ No newline at end of file
+execute:frappe.delete_doc_if_exists("Report", "Employee Holiday Attendance")
+
diff --git a/erpnext/patches/v7_0/convert_timelog_to_timesheet.py b/erpnext/patches/v7_0/convert_timelog_to_timesheet.py
index 3f5cca1..cb16466 100644
--- a/erpnext/patches/v7_0/convert_timelog_to_timesheet.py
+++ b/erpnext/patches/v7_0/convert_timelog_to_timesheet.py
@@ -3,8 +3,7 @@
 from erpnext.manufacturing.doctype.production_order.production_order import make_timesheet, add_timesheet_detail
 
 def execute():
-	if "note" not in frappe.db.get_table_columns("timesheet"):
-		frappe.reload_doc('projects', 'doctype', 'timesheet')
+	frappe.reload_doc('projects', 'doctype', 'timesheet')
 
 	for data in frappe.get_all('Time Log', fields=["*"],
 		filters = [["docstatus", "<", "2"]]):
diff --git a/erpnext/patches/v7_0/make_is_group_fieldtype_as_check.py b/erpnext/patches/v7_0/make_is_group_fieldtype_as_check.py
new file mode 100644
index 0000000..ba82e86
--- /dev/null
+++ b/erpnext/patches/v7_0/make_is_group_fieldtype_as_check.py
@@ -0,0 +1,18 @@
+from __future__ import unicode_literals
+import frappe
+
+def execute():
+	for doctype in ["Sales Person", "Customer Group", "Item Group", "Territory"]:
+		
+		# convert to 1 or 0
+		frappe.db.sql("update `tab{doctype}` set is_group = if(is_group='Yes',1,0) "
+			.format(doctype=doctype))
+
+		frappe.db.commit()
+
+		# alter fields to int
+				
+		frappe.db.sql("alter table `tab{doctype}` change is_group is_group int(1) default '0'"
+			.format(doctype=doctype))
+
+		frappe.reload_doctype(doctype)
diff --git a/erpnext/patches/v7_0/rename_time_sheet_doctype.py b/erpnext/patches/v7_0/rename_time_sheet_doctype.py
index dc2fada..a008045 100644
--- a/erpnext/patches/v7_0/rename_time_sheet_doctype.py
+++ b/erpnext/patches/v7_0/rename_time_sheet_doctype.py
@@ -1,7 +1,7 @@
 import frappe
 
 def execute():
-	if frappe.db.table_exists("Time Sheet"):
+	if frappe.db.table_exists("Time Sheet") and not frappe.db.table_exists("Timesheet"):
 		frappe.rename_doc("DocType", "Time Sheet", "Timesheet")
 		frappe.rename_doc("DocType", "Time Sheet Detail", "Timesheet Detail")
 		
diff --git a/erpnext/projects/doctype/timesheet/test_timesheet.py b/erpnext/projects/doctype/timesheet/test_timesheet.py
index 281414b..300933a 100644
--- a/erpnext/projects/doctype/timesheet/test_timesheet.py
+++ b/erpnext/projects/doctype/timesheet/test_timesheet.py
@@ -86,28 +86,30 @@
 
 	return salary_structure
 
-def make_timesheet(employee, simulate=False, billable = 0):
-	update_activity_type("_Test Activity Type")
+def make_timesheet(employee, simulate=False, billable = 0, activity_type="_Test Activity Type", project=None, task=None):
+	update_activity_type(activity_type)
 	timesheet = frappe.new_doc("Timesheet")
 	timesheet.employee = employee
 	timesheet_detail = timesheet.append('time_logs', {})
 	timesheet_detail.billable = billable
-	timesheet_detail.activity_type = "_Test Activity Type"
+	timesheet_detail.activity_type = activity_type
 	timesheet_detail.from_time = now_datetime()
 	timesheet_detail.hours = 2
 	timesheet_detail.to_time = timesheet_detail.from_time + datetime.timedelta(hours= timesheet_detail.hours)
+	timesheet_detail.project = project
+	timesheet_detail.task = task
 
 	for data in timesheet.get('time_logs'):
 		if simulate:
 			while True:
 				try:
-					timesheet.save()
+					timesheet.save(ignore_permissions=True)
 					break
 				except OverlapError:
 					data.from_time = data.from_time + datetime.timedelta(minutes=10)
 					data.to_time = data.from_time + datetime.timedelta(hours= data.hours)
 		else:
-			timesheet.save()
+			timesheet.save(ignore_permissions=True)
 
 	timesheet.submit()
 
diff --git a/erpnext/projects/doctype/timesheet/timesheet.js b/erpnext/projects/doctype/timesheet/timesheet.js
index dfd7abe..4d16295 100644
--- a/erpnext/projects/doctype/timesheet/timesheet.js
+++ b/erpnext/projects/doctype/timesheet/timesheet.js
@@ -1,5 +1,6 @@
 // Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
 // License: GNU General Public License v3. See license.txt
+cur_frm.add_fetch('employee', 'employee_name', 'employee_name');
 
 frappe.ui.form.on("Timesheet", {
 	setup: function(frm) {
diff --git a/erpnext/projects/doctype/timesheet/timesheet.json b/erpnext/projects/doctype/timesheet/timesheet.json
index ac6093e..a15522b 100644
--- a/erpnext/projects/doctype/timesheet/timesheet.json
+++ b/erpnext/projects/doctype/timesheet/timesheet.json
@@ -225,8 +225,9 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "depends_on": "employee", 
    "fieldname": "employee_name", 
-   "fieldtype": "Read Only", 
+   "fieldtype": "Data", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
    "ignore_xss_filter": 0, 
@@ -235,12 +236,12 @@
    "label": "Employee Name", 
    "length": 0, 
    "no_copy": 0, 
-   "options": "employee.employee_name", 
+   "options": "", 
    "permlevel": 0, 
    "precision": "", 
    "print_hide": 1, 
    "print_hide_if_no_value": 0, 
-   "read_only": 0, 
+   "read_only": 1, 
    "report_hide": 0, 
    "reqd": 0, 
    "search_index": 0, 
@@ -636,7 +637,7 @@
  "issingle": 0, 
  "istable": 0, 
  "max_attachments": 0, 
- "modified": "2016-07-13 01:18:57.918882", 
+ "modified": "2016-07-13 23:44:05.086570", 
  "modified_by": "Administrator", 
  "module": "Projects", 
  "name": "Timesheet", 
@@ -661,6 +662,66 @@
    "share": 1, 
    "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, 
+   "permlevel": 0, 
+   "print": 1, 
+   "read": 1, 
+   "report": 1, 
+   "role": "HR User", 
+   "set_user_permissions": 0, 
+   "share": 1, 
+   "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, 
+   "permlevel": 0, 
+   "print": 1, 
+   "read": 1, 
+   "report": 1, 
+   "role": "Manufacturing User", 
+   "set_user_permissions": 0, 
+   "share": 1, 
+   "submit": 1, 
+   "write": 1
+  }, 
+  {
+   "amend": 0, 
+   "apply_user_permissions": 0, 
+   "cancel": 0, 
+   "create": 1, 
+   "delete": 0, 
+   "email": 0, 
+   "export": 0, 
+   "if_owner": 0, 
+   "import": 0, 
+   "permlevel": 0, 
+   "print": 0, 
+   "read": 1, 
+   "report": 0, 
+   "role": "Employee", 
+   "set_user_permissions": 0, 
+   "share": 0, 
+   "submit": 0, 
+   "write": 1
   }
  ], 
  "quick_entry": 0, 
diff --git a/erpnext/projects/doctype/timesheet/timesheet.py b/erpnext/projects/doctype/timesheet/timesheet.py
index 24a3796..686f7c2 100644
--- a/erpnext/projects/doctype/timesheet/timesheet.py
+++ b/erpnext/projects/doctype/timesheet/timesheet.py
@@ -141,31 +141,34 @@
 
 	def validate_overlap(self, data):
 		if self.production_order:
-			self.validate_overlap_for("workstation", data)
+			self.validate_overlap_for("workstation", data, data.workstation)
 		else:
-			self.validate_overlap_for("user", data)
-			self.validate_overlap_for("employee", data)
+			self.validate_overlap_for("user", data, self.user)
+			self.validate_overlap_for("employee", data, self.employee)
 
-	def validate_overlap_for(self, fieldname, args):
-		existing = self.get_overlap_for(fieldname, args)
+	def validate_overlap_for(self, fieldname, args, value):
+		if not value: return
+
+		existing = self.get_overlap_for(fieldname, args, value)
 		if existing:
 			frappe.throw(_("Row {0}: From Time and To Time overlap with existing from and to time").format(args.idx),
 				OverlapError)
 
-	def get_overlap_for(self, fieldname, args):
-		if not args.get(fieldname):
-			return
+	def get_overlap_for(self, fieldname, args, value):
+		cond = "ts.`{0}`".format(fieldname)
+		if fieldname == 'workstation':
+			cond = "tsd.`{0}`".format(fieldname)
 
 		existing = frappe.db.sql("""select ts.name as name, tsd.from_time as from_time, tsd.to_time as to_time from 
-			`tabTimesheet Detail` tsd, `tabTimesheet` ts where tsd.`{0}`=%(val)s and tsd.parent = ts.name and
+			`tabTimesheet Detail` tsd, `tabTimesheet` ts where {0}=%(val)s and tsd.parent = ts.name and
 			(
 				(%(from_time)s > tsd.from_time and %(from_time)s < tsd.to_time) or
 				(%(to_time)s > tsd.from_time and %(to_time)s < tsd.to_time) or
 				(%(from_time)s <= tsd.from_time and %(to_time)s >= tsd.to_time))
 			and tsd.name!=%(name)s
-			and ts.docstatus < 2""".format(fieldname),
+			and ts.docstatus < 2""".format(cond),
 			{
-				"val": args.get(fieldname),
+				"val": value,
 				"from_time": args.from_time,
 				"to_time": args.to_time,
 				"name": args.name or "No Name"
@@ -184,7 +187,7 @@
 		if self.time_logs:
 			for data in self.time_logs:
 				if data.idx == index:
-					overlapping = self.get_overlap_for("workstation", data)
+					overlapping = self.get_overlap_for("workstation", data, data.workstation)
 					if not overlapping:
 						frappe.throw(_("Logical error: Must find overlapping"))
 					
diff --git a/erpnext/public/js/queries.js b/erpnext/public/js/queries.js
index c1f09a5..7c4bf0f 100644
--- a/erpnext/public/js/queries.js
+++ b/erpnext/public/js/queries.js
@@ -62,7 +62,7 @@
 	},
 
 	not_a_group_filter: function() {
-		return { filters: { is_group: "No" } };
+		return { filters: { is_group: 0 } };
 	},
 
 	employee: function() {
diff --git a/erpnext/public/js/utils.js b/erpnext/public/js/utils.js
index ea28fd5..d347227 100644
--- a/erpnext/public/js/utils.js
+++ b/erpnext/public/js/utils.js
@@ -120,6 +120,65 @@
 	}
 });
 
+erpnext.utils.map_current_doc = function(opts) {
+	if(opts.get_query_filters) {
+		opts.get_query = function() {
+			return {filters: opts.get_query_filters};
+		}
+	}
+	var _map = function() {
+		// remove first item row if empty
+		if($.isArray(cur_frm.doc.items)) {
+			if(!cur_frm.doc.items[0].item_code) {
+				cur_frm.doc.items = cur_frm.doc.items.splice(1);
+			}
+		}
+
+		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.
+			type: "POST",
+			method: opts.method,
+			args: {
+				"source_name": opts.source_name,
+				"target_doc": cur_frm.doc
+			},
+			callback: function(r) {
+				if(!r.exc) {
+					var doc = frappe.model.sync(r.message);
+					cur_frm.refresh();
+				}
+			}
+		});
+	}
+	if(opts.source_doctype) {
+		var d = new frappe.ui.Dialog({
+			title: __("Get From ") + __(opts.source_doctype),
+			fields: [
+				{
+					fieldtype: "Link",
+					label: __(opts.source_doctype),
+					fieldname: opts.source_doctype,
+					options: opts.source_doctype,
+					get_query: opts.get_query,
+					reqd:1
+				},
+			]
+		});
+		d.set_primary_action(__('Get Items'), function() {
+			var values = d.get_values();
+			if(!values)
+				return;
+			opts.source_name = values[opts.source_doctype];
+			d.hide();
+			_map();
+		})
+		d.show();
+	} else if(opts.source_name) {
+		_map();
+	}
+}
+
 // add description on posting time
 $(document).on('app_ready', function() {
 	if(!frappe.datetime.is_timezone_same()) {
diff --git a/erpnext/selling/doctype/customer/customer.js b/erpnext/selling/doctype/customer/customer.js
index b5234f1..5b41ad8 100644
--- a/erpnext/selling/doctype/customer/customer.js
+++ b/erpnext/selling/doctype/customer/customer.js
@@ -46,7 +46,7 @@
 
 cur_frm.fields_dict['customer_group'].get_query = function(doc, dt, dn) {
 	return{
-		filters:{'is_group': 'No'}
+		filters:{'is_group': 0}
 	}
 }
 
diff --git a/erpnext/selling/doctype/installation_note/installation_note.js b/erpnext/selling/doctype/installation_note/installation_note.js
index 09deea2..5b99691 100644
--- a/erpnext/selling/doctype/installation_note/installation_note.js
+++ b/erpnext/selling/doctype/installation_note/installation_note.js
@@ -49,7 +49,7 @@
 		if (this.frm.doc.docstatus===0) {
 			cur_frm.add_custom_button(__('From Delivery Note'),
 				function() {
-					frappe.model.map_current_doc({
+					erpnext.utils.map_current_doc({
 						method: "erpnext.stock.doctype.delivery_note.delivery_note.make_installation_note",
 						source_doctype: "Delivery Note",
 						get_query_filters: {
diff --git a/erpnext/selling/doctype/quotation/quotation.js b/erpnext/selling/doctype/quotation/quotation.js
index f61f0e9..d111c14 100644
--- a/erpnext/selling/doctype/quotation/quotation.js
+++ b/erpnext/selling/doctype/quotation/quotation.js
@@ -29,7 +29,7 @@
 		if (this.frm.doc.docstatus===0) {
 			cur_frm.add_custom_button(__('Opportunity'),
 				function() {
-					frappe.model.map_current_doc({
+					erpnext.utils.map_current_doc({
 						method: "erpnext.crm.doctype.opportunity.opportunity.make_quotation",
 						source_doctype: "Opportunity",
 						get_query_filters: {
diff --git a/erpnext/selling/doctype/sales_order/sales_order.js b/erpnext/selling/doctype/sales_order/sales_order.js
index d8ed591..f1eeccc 100644
--- a/erpnext/selling/doctype/sales_order/sales_order.js
+++ b/erpnext/selling/doctype/sales_order/sales_order.js
@@ -97,7 +97,7 @@
 		if (this.frm.doc.docstatus===0) {
 			cur_frm.add_custom_button(__('Quotation'),
 				function() {
-					frappe.model.map_current_doc({
+					erpnext.utils.map_current_doc({
 						method: "erpnext.selling.doctype.quotation.quotation.make_sales_order",
 						source_doctype: "Quotation",
 						get_query_filters: {
diff --git a/erpnext/setup/doctype/customer_group/customer_group.js b/erpnext/setup/doctype/customer_group/customer_group.js
index 654abd9..c199a8e 100644
--- a/erpnext/setup/doctype/customer_group/customer_group.js
+++ b/erpnext/setup/doctype/customer_group/customer_group.js
@@ -20,7 +20,7 @@
 cur_frm.fields_dict['parent_customer_group'].get_query = function(doc,cdt,cdn) {
 	return {
 		filters: {
-			'is_group': "Yes"
+			'is_group': 1
 		}
 	}
 }
diff --git a/erpnext/setup/doctype/customer_group/customer_group.json b/erpnext/setup/doctype/customer_group/customer_group.json
index 34d13bd..38bb558 100644
--- a/erpnext/setup/doctype/customer_group/customer_group.json
+++ b/erpnext/setup/doctype/customer_group/customer_group.json
@@ -3,11 +3,13 @@
  "allow_import": 1, 
  "allow_rename": 1, 
  "autoname": "field:customer_group_name", 
+ "beta": 0, 
  "creation": "2013-01-10 16:34:23", 
  "custom": 0, 
  "docstatus": 0, 
  "doctype": "DocType", 
  "document_type": "Setup", 
+ "editable_grid": 0, 
  "fields": [
   {
    "allow_on_submit": 0, 
@@ -17,6 +19,7 @@
    "fieldtype": "Data", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Customer Group Name", 
@@ -26,6 +29,7 @@
    "oldfieldtype": "Data", 
    "permlevel": 0, 
    "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
    "read_only": 0, 
    "report_hide": 0, 
    "reqd": 1, 
@@ -42,6 +46,7 @@
    "fieldtype": "Link", 
    "hidden": 0, 
    "ignore_user_permissions": 1, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Parent Customer Group", 
@@ -52,6 +57,7 @@
    "options": "Customer Group", 
    "permlevel": 0, 
    "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
    "read_only": 0, 
    "report_hide": 0, 
    "reqd": 0, 
@@ -65,19 +71,21 @@
    "collapsible": 0, 
    "description": "Only leaf nodes are allowed in transaction", 
    "fieldname": "is_group", 
-   "fieldtype": "Select", 
+   "fieldtype": "Check", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 1, 
-   "label": "Has Child Node", 
+   "label": "Is Group", 
    "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "is_group", 
    "oldfieldtype": "Select", 
-   "options": "\nYes\nNo", 
+   "options": "", 
    "permlevel": 0, 
    "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
    "read_only": 0, 
    "report_hide": 0, 
    "reqd": 1, 
@@ -93,12 +101,14 @@
    "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, 
    "report_hide": 0, 
    "reqd": 0, 
@@ -114,6 +124,7 @@
    "fieldtype": "Link", 
    "hidden": 0, 
    "ignore_user_permissions": 1, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Default Price List", 
@@ -122,6 +133,7 @@
    "options": "Price List", 
    "permlevel": 0, 
    "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
    "read_only": 0, 
    "report_hide": 0, 
    "reqd": 0, 
@@ -137,6 +149,7 @@
    "fieldtype": "Select", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Credit Days Based On", 
@@ -146,6 +159,7 @@
    "permlevel": 0, 
    "precision": "", 
    "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
    "read_only": 0, 
    "report_hide": 0, 
    "reqd": 0, 
@@ -162,6 +176,7 @@
    "fieldtype": "Int", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Credit Days", 
@@ -169,6 +184,7 @@
    "no_copy": 0, 
    "permlevel": 1, 
    "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
    "read_only": 0, 
    "report_hide": 0, 
    "reqd": 0, 
@@ -184,6 +200,7 @@
    "fieldtype": "Currency", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Credit Limit", 
@@ -191,6 +208,7 @@
    "no_copy": 0, 
    "permlevel": 1, 
    "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
    "read_only": 0, 
    "report_hide": 0, 
    "reqd": 0, 
@@ -206,6 +224,7 @@
    "fieldtype": "Int", 
    "hidden": 1, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "lft", 
@@ -215,6 +234,7 @@
    "oldfieldtype": "Int", 
    "permlevel": 0, 
    "print_hide": 1, 
+   "print_hide_if_no_value": 0, 
    "read_only": 0, 
    "report_hide": 1, 
    "reqd": 0, 
@@ -230,6 +250,7 @@
    "fieldtype": "Int", 
    "hidden": 1, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "rgt", 
@@ -239,6 +260,7 @@
    "oldfieldtype": "Int", 
    "permlevel": 0, 
    "print_hide": 1, 
+   "print_hide_if_no_value": 0, 
    "read_only": 0, 
    "report_hide": 1, 
    "reqd": 0, 
@@ -255,6 +277,7 @@
    "fieldtype": "Link", 
    "hidden": 1, 
    "ignore_user_permissions": 1, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "old_parent", 
@@ -265,6 +288,7 @@
    "options": "Customer Group", 
    "permlevel": 0, 
    "print_hide": 1, 
+   "print_hide_if_no_value": 0, 
    "read_only": 0, 
    "report_hide": 1, 
    "reqd": 0, 
@@ -280,6 +304,7 @@
    "fieldtype": "Section Break", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Default Receivable Account", 
@@ -287,6 +312,7 @@
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
    "read_only": 0, 
    "report_hide": 0, 
    "reqd": 0, 
@@ -304,6 +330,7 @@
    "fieldtype": "Table", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Accounts", 
@@ -312,6 +339,7 @@
    "options": "Party Account", 
    "permlevel": 0, 
    "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
    "read_only": 0, 
    "report_hide": 0, 
    "reqd": 0, 
@@ -324,13 +352,14 @@
  "hide_toolbar": 0, 
  "icon": "icon-sitemap", 
  "idx": 1, 
+ "image_view": 0, 
  "in_create": 0, 
  "in_dialog": 0, 
  "is_submittable": 0, 
  "issingle": 0, 
  "istable": 0, 
  "max_attachments": 0, 
- "modified": "2015-11-16 06:29:44.374615", 
+ "modified": "2016-07-14 12:43:08.949307", 
  "modified_by": "Administrator", 
  "module": "Setup", 
  "name": "Customer Group", 
@@ -457,7 +486,10 @@
    "write": 0
   }
  ], 
+ "quick_entry": 0, 
  "read_only": 0, 
  "read_only_onload": 0, 
- "search_fields": "parent_customer_group"
+ "search_fields": "parent_customer_group", 
+ "sort_order": "DESC", 
+ "track_seen": 0
 }
\ No newline at end of file
diff --git a/erpnext/setup/doctype/customer_group/test_records.json b/erpnext/setup/doctype/customer_group/test_records.json
index cc3f87e..4c472b8 100644
--- a/erpnext/setup/doctype/customer_group/test_records.json
+++ b/erpnext/setup/doctype/customer_group/test_records.json
@@ -2,13 +2,13 @@
  {
   "customer_group_name": "_Test Customer Group",
   "doctype": "Customer Group",
-  "is_group": "No",
+  "is_group": 0,
   "parent_customer_group": "All Customer Groups"
  },
  {
   "customer_group_name": "_Test Customer Group 1",
   "doctype": "Customer Group",
-  "is_group": "No",
+  "is_group": 0,
   "parent_customer_group": "All Customer Groups"
  }
 ]
diff --git a/erpnext/setup/doctype/item_group/item_group.js b/erpnext/setup/doctype/item_group/item_group.js
index d6adebc..46d4034 100644
--- a/erpnext/setup/doctype/item_group/item_group.js
+++ b/erpnext/setup/doctype/item_group/item_group.js
@@ -9,7 +9,7 @@
 		frm.fields_dict['parent_item_group'].get_query = function(doc,cdt,cdn) {
 			return{
 				filters:[
-					['Item Group', 'is_group', '=', 'Yes'],
+					['Item Group', 'is_group', '=', 1],
 					['Item Group', 'name', '!=', doc.item_group_name]
 				]
 			}
diff --git a/erpnext/setup/doctype/item_group/item_group.json b/erpnext/setup/doctype/item_group/item_group.json
index 37d8c81..63e9b17 100644
--- a/erpnext/setup/doctype/item_group/item_group.json
+++ b/erpnext/setup/doctype/item_group/item_group.json
@@ -10,6 +10,7 @@
  "docstatus": 0, 
  "doctype": "DocType", 
  "document_type": "Setup", 
+ "editable_grid": 0, 
  "fields": [
   {
    "allow_on_submit": 0, 
@@ -95,18 +96,18 @@
    "collapsible": 0, 
    "description": "Only leaf nodes are allowed in transaction", 
    "fieldname": "is_group", 
-   "fieldtype": "Select", 
+   "fieldtype": "Check", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 1, 
-   "label": "Has Child Node", 
+   "label": "Is Group", 
    "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "is_group", 
    "oldfieldtype": "Select", 
-   "options": "\nYes\nNo", 
+   "options": "", 
    "permlevel": 0, 
    "print_hide": 0, 
    "print_hide_if_no_value": 0, 
@@ -461,7 +462,7 @@
  "issingle": 0, 
  "istable": 0, 
  "max_attachments": 3, 
- "modified": "2016-06-23 14:44:46.228923", 
+ "modified": "2016-07-14 12:41:09.269478", 
  "modified_by": "Administrator", 
  "module": "Setup", 
  "name": "Item Group", 
diff --git a/erpnext/setup/doctype/item_group/test_records.json b/erpnext/setup/doctype/item_group/test_records.json
index 60336f0..74f4641 100644
--- a/erpnext/setup/doctype/item_group/test_records.json
+++ b/erpnext/setup/doctype/item_group/test_records.json
@@ -1,68 +1,68 @@
 [
  {
   "doctype": "Item Group", 
-  "is_group": "No", 
+  "is_group": 0, 
   "item_group_name": "_Test Item Group", 
   "parent_item_group": "All Item Groups",
   "default_cost_center": "_Test Cost Center 2 - _TC"
  }, 
  {
   "doctype": "Item Group", 
-  "is_group": "No", 
+  "is_group": 0, 
   "item_group_name": "_Test Item Group Desktops", 
   "parent_item_group": "All Item Groups"
  }, 
  {
   "doctype": "Item Group", 
-  "is_group": "Yes", 
+  "is_group": 1, 
   "item_group_name": "_Test Item Group A", 
   "parent_item_group": "All Item Groups"
  }, 
  {
   "doctype": "Item Group", 
-  "is_group": "Yes", 
+  "is_group": 1, 
   "item_group_name": "_Test Item Group B", 
   "parent_item_group": "All Item Groups"
  }, 
  {
   "doctype": "Item Group", 
-  "is_group": "Yes", 
+  "is_group": 1, 
   "item_group_name": "_Test Item Group B - 1", 
   "parent_item_group": "_Test Item Group B"
  }, 
  {
   "doctype": "Item Group", 
-  "is_group": "Yes", 
+  "is_group": 1, 
   "item_group_name": "_Test Item Group B - 2", 
   "parent_item_group": "_Test Item Group B"
  }, 
  {
   "doctype": "Item Group", 
-  "is_group": "No", 
+  "is_group": 0, 
   "item_group_name": "_Test Item Group B - 3", 
   "parent_item_group": "_Test Item Group B"
  }, 
  {
   "doctype": "Item Group", 
-  "is_group": "Yes", 
+  "is_group": 1, 
   "item_group_name": "_Test Item Group C", 
   "parent_item_group": "All Item Groups"
  }, 
  {
   "doctype": "Item Group", 
-  "is_group": "Yes", 
+  "is_group": 1, 
   "item_group_name": "_Test Item Group C - 1", 
   "parent_item_group": "_Test Item Group C"
  }, 
  {
   "doctype": "Item Group", 
-  "is_group": "Yes", 
+  "is_group": 1, 
   "item_group_name": "_Test Item Group C - 2", 
   "parent_item_group": "_Test Item Group C"
  }, 
  {
   "doctype": "Item Group", 
-  "is_group": "Yes", 
+  "is_group": 1, 
   "item_group_name": "_Test Item Group D", 
   "parent_item_group": "All Item Groups"
  }
diff --git a/erpnext/setup/doctype/sales_partner/sales_partner.js b/erpnext/setup/doctype/sales_partner/sales_partner.js
index 669cabf..cb66b7f 100644
--- a/erpnext/setup/doctype/sales_partner/sales_partner.js
+++ b/erpnext/setup/doctype/sales_partner/sales_partner.js
@@ -15,6 +15,6 @@
 
 cur_frm.fields_dict['targets'].grid.get_field("item_group").get_query = function(doc, dt, dn) {
   return{
-  	filters:{ 'is_group': "No" }
+  	filters:{ 'is_group': 0 }
   }
 }
diff --git a/erpnext/setup/doctype/sales_person/sales_person.js b/erpnext/setup/doctype/sales_person/sales_person.js
index 2ee3974..2388739 100644
--- a/erpnext/setup/doctype/sales_person/sales_person.js
+++ b/erpnext/setup/doctype/sales_person/sales_person.js
@@ -20,7 +20,7 @@
 cur_frm.fields_dict['parent_sales_person'].get_query = function(doc, cdt, cdn) {
 	return{
 		filters: [
-			['Sales Person', 'is_group', '=', 'Yes'],
+			['Sales Person', 'is_group', '=', 1],
 			['Sales Person', 'name', '!=', doc.sales_person_name]
 		]
 	}
diff --git a/erpnext/setup/doctype/sales_person/sales_person.json b/erpnext/setup/doctype/sales_person/sales_person.json
index e99d14f..b42adca 100644
--- a/erpnext/setup/doctype/sales_person/sales_person.json
+++ b/erpnext/setup/doctype/sales_person/sales_person.json
@@ -3,12 +3,14 @@
  "allow_import": 1, 
  "allow_rename": 1, 
  "autoname": "field:sales_person_name", 
+ "beta": 0, 
  "creation": "2013-01-10 16:34:24", 
  "custom": 0, 
  "description": "All Sales Transactions can be tagged against multiple **Sales Persons** so that you can set and monitor targets.", 
  "docstatus": 0, 
  "doctype": "DocType", 
  "document_type": "Setup", 
+ "editable_grid": 0, 
  "fields": [
   {
    "allow_on_submit": 0, 
@@ -18,6 +20,7 @@
    "fieldtype": "Section Break", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Name and Employee ID", 
@@ -42,6 +45,7 @@
    "fieldtype": "Data", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 1, 
    "in_list_view": 1, 
    "label": "Sales Person Name", 
@@ -68,6 +72,7 @@
    "fieldtype": "Link", 
    "hidden": 0, 
    "ignore_user_permissions": 1, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Parent Sales Person", 
@@ -91,17 +96,18 @@
    "bold": 0, 
    "collapsible": 0, 
    "fieldname": "is_group", 
-   "fieldtype": "Select", 
+   "fieldtype": "Check", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 1, 
-   "label": "Has Child Node", 
+   "label": "Is Group", 
    "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "is_group", 
    "oldfieldtype": "Select", 
-   "options": "\nYes\nNo", 
+   "options": "", 
    "permlevel": 0, 
    "print_hide": 0, 
    "print_hide_if_no_value": 0, 
@@ -120,6 +126,7 @@
    "fieldtype": "Column Break", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "length": 0, 
@@ -142,6 +149,7 @@
    "fieldtype": "Link", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Employee", 
@@ -166,6 +174,7 @@
    "fieldtype": "Int", 
    "hidden": 1, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 1, 
    "in_list_view": 0, 
    "label": "lft", 
@@ -191,6 +200,7 @@
    "fieldtype": "Int", 
    "hidden": 1, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 1, 
    "in_list_view": 0, 
    "label": "rgt", 
@@ -216,6 +226,7 @@
    "fieldtype": "Data", 
    "hidden": 1, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "old_parent", 
@@ -242,6 +253,7 @@
    "fieldtype": "Section Break", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Sales Person Targets", 
@@ -267,6 +279,7 @@
    "fieldtype": "Table", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Targets", 
@@ -294,6 +307,7 @@
    "fieldtype": "Link", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Target Distribution", 
@@ -317,13 +331,14 @@
  "hide_toolbar": 0, 
  "icon": "icon-user", 
  "idx": 1, 
+ "image_view": 0, 
  "in_create": 0, 
  "in_dialog": 0, 
  "is_submittable": 0, 
  "issingle": 0, 
  "istable": 0, 
  "max_attachments": 0, 
- "modified": "2016-01-06 02:36:22.551330", 
+ "modified": "2016-07-14 12:44:43.408367", 
  "modified_by": "Administrator", 
  "module": "Setup", 
  "name": "Sales Person", 
@@ -390,7 +405,10 @@
    "write": 1
   }
  ], 
+ "quick_entry": 0, 
  "read_only": 0, 
  "read_only_onload": 0, 
- "search_fields": "parent_sales_person"
+ "search_fields": "parent_sales_person", 
+ "sort_order": "ASC", 
+ "track_seen": 0
 }
\ No newline at end of file
diff --git a/erpnext/setup/doctype/sales_person/sales_person_tree.js b/erpnext/setup/doctype/sales_person/sales_person_tree.js
index fd2127d..077cf3b 100644
--- a/erpnext/setup/doctype/sales_person/sales_person_tree.js
+++ b/erpnext/setup/doctype/sales_person/sales_person_tree.js
@@ -5,7 +5,7 @@
 		{fieldtype:'Link', fieldname:'employee',
 			label:__('Employee'), options:'Employee',
 			description: __("Please enter Employee Id of this sales person")},
-		{fieldtype:'Select', fieldname:'is_group', label:__('Group Node'), options:'No\nYes',
+		{fieldtype:'Check', fieldname:'is_group', label:__('Group Node'),
 			description: __("Further nodes can be only created under 'Group' type nodes")}
 	],
 }
\ No newline at end of file
diff --git a/erpnext/setup/doctype/sales_person/test_records.json b/erpnext/setup/doctype/sales_person/test_records.json
index cd29d40..75d6cd3 100644
--- a/erpnext/setup/doctype/sales_person/test_records.json
+++ b/erpnext/setup/doctype/sales_person/test_records.json
@@ -2,21 +2,21 @@
  {
   "doctype": "Sales Person", 
   "employee": "_T-Employee-0001", 
-  "is_group": "No", 
+  "is_group": 0, 
   "parent_sales_person": "Sales Team", 
   "sales_person_name": "_Test Sales Person"
  }, 
  {
   "doctype": "Sales Person", 
   "employee": "_T-Employee-0002", 
-  "is_group": "No", 
+  "is_group": 0, 
   "parent_sales_person": "Sales Team", 
   "sales_person_name": "_Test Sales Person 1"
  }, 
  {
   "doctype": "Sales Person", 
   "employee": "_T-Employee-0003", 
-  "is_group": "No", 
+  "is_group": 0, 
   "parent_sales_person": "Sales Team", 
   "sales_person_name": "_Test Sales Person 2"
  }
diff --git a/erpnext/setup/doctype/territory/territory.js b/erpnext/setup/doctype/territory/territory.js
index 317278a..69f761a 100644
--- a/erpnext/setup/doctype/territory/territory.js
+++ b/erpnext/setup/doctype/territory/territory.js
@@ -20,7 +20,7 @@
 cur_frm.fields_dict['parent_territory'].get_query = function(doc,cdt,cdn) {
 	return{
 		filters:[
-			['Territory', 'is_group', '=', 'Yes'],
+			['Territory', 'is_group', '=', 1],
 			['Territory', 'name', '!=', doc.territory_name]
 		]
 	}
diff --git a/erpnext/setup/doctype/territory/territory.json b/erpnext/setup/doctype/territory/territory.json
index 4ce0fff..3f799ee 100644
--- a/erpnext/setup/doctype/territory/territory.json
+++ b/erpnext/setup/doctype/territory/territory.json
@@ -3,12 +3,14 @@
  "allow_import": 1, 
  "allow_rename": 1, 
  "autoname": "field:territory_name", 
+ "beta": 0, 
  "creation": "2013-01-10 16:34:24", 
  "custom": 0, 
  "description": "Classification of Customers by region", 
  "docstatus": 0, 
  "doctype": "DocType", 
  "document_type": "Setup", 
+ "editable_grid": 0, 
  "fields": [
   {
    "allow_on_submit": 0, 
@@ -18,6 +20,7 @@
    "fieldtype": "Data", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Territory Name", 
@@ -27,6 +30,7 @@
    "oldfieldtype": "Data", 
    "permlevel": 0, 
    "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
    "read_only": 0, 
    "report_hide": 0, 
    "reqd": 1, 
@@ -43,6 +47,7 @@
    "fieldtype": "Link", 
    "hidden": 0, 
    "ignore_user_permissions": 1, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Parent Territory", 
@@ -53,6 +58,7 @@
    "options": "Territory", 
    "permlevel": 0, 
    "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
    "read_only": 0, 
    "report_hide": 0, 
    "reqd": 0, 
@@ -66,19 +72,21 @@
    "collapsible": 0, 
    "description": "Only leaf nodes are allowed in transaction", 
    "fieldname": "is_group", 
-   "fieldtype": "Select", 
+   "fieldtype": "Check", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 1, 
-   "label": "Has Child Node", 
+   "label": "Is Group", 
    "length": 0, 
    "no_copy": 0, 
    "oldfieldname": "is_group", 
    "oldfieldtype": "Select", 
-   "options": "\nYes\nNo", 
+   "options": "", 
    "permlevel": 0, 
    "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
    "read_only": 0, 
    "report_hide": 0, 
    "reqd": 1, 
@@ -94,12 +102,14 @@
    "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, 
    "report_hide": 0, 
    "reqd": 0, 
@@ -116,6 +126,7 @@
    "fieldtype": "Link", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 1, 
    "in_list_view": 1, 
    "label": "Territory Manager", 
@@ -126,6 +137,7 @@
    "options": "Sales Person", 
    "permlevel": 0, 
    "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
    "read_only": 0, 
    "report_hide": 0, 
    "reqd": 0, 
@@ -141,6 +153,7 @@
    "fieldtype": "Int", 
    "hidden": 1, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 1, 
    "in_list_view": 0, 
    "label": "lft", 
@@ -150,6 +163,7 @@
    "oldfieldtype": "Int", 
    "permlevel": 0, 
    "print_hide": 1, 
+   "print_hide_if_no_value": 0, 
    "read_only": 0, 
    "report_hide": 0, 
    "reqd": 0, 
@@ -165,6 +179,7 @@
    "fieldtype": "Int", 
    "hidden": 1, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 1, 
    "in_list_view": 0, 
    "label": "rgt", 
@@ -174,6 +189,7 @@
    "oldfieldtype": "Int", 
    "permlevel": 0, 
    "print_hide": 1, 
+   "print_hide_if_no_value": 0, 
    "read_only": 0, 
    "report_hide": 0, 
    "reqd": 0, 
@@ -190,6 +206,7 @@
    "fieldtype": "Link", 
    "hidden": 1, 
    "ignore_user_permissions": 1, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "old_parent", 
@@ -200,6 +217,7 @@
    "options": "Territory", 
    "permlevel": 0, 
    "print_hide": 1, 
+   "print_hide_if_no_value": 0, 
    "read_only": 0, 
    "report_hide": 1, 
    "reqd": 0, 
@@ -216,6 +234,7 @@
    "fieldtype": "Section Break", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Territory Targets", 
@@ -224,6 +243,7 @@
    "oldfieldtype": "Section Break", 
    "permlevel": 0, 
    "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
    "read_only": 0, 
    "report_hide": 0, 
    "reqd": 0, 
@@ -239,6 +259,7 @@
    "fieldtype": "Table", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Targets", 
@@ -249,6 +270,7 @@
    "options": "Target Detail", 
    "permlevel": 0, 
    "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
    "read_only": 0, 
    "report_hide": 0, 
    "reqd": 0, 
@@ -265,6 +287,7 @@
    "fieldtype": "Link", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Target Distribution", 
@@ -275,6 +298,7 @@
    "options": "Monthly Distribution", 
    "permlevel": 0, 
    "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
    "read_only": 0, 
    "report_hide": 0, 
    "reqd": 0, 
@@ -287,13 +311,14 @@
  "hide_toolbar": 0, 
  "icon": "icon-map-marker", 
  "idx": 1, 
+ "image_view": 0, 
  "in_create": 0, 
  "in_dialog": 0, 
  "is_submittable": 0, 
  "issingle": 0, 
  "istable": 0, 
  "max_attachments": 0, 
- "modified": "2015-11-16 06:29:59.337250", 
+ "modified": "2016-07-14 12:43:36.619881", 
  "modified_by": "Administrator", 
  "module": "Setup", 
  "name": "Territory", 
@@ -401,7 +426,10 @@
    "write": 0
   }
  ], 
+ "quick_entry": 0, 
  "read_only": 0, 
  "read_only_onload": 0, 
- "search_fields": "parent_territory,territory_manager"
+ "search_fields": "parent_territory,territory_manager", 
+ "sort_order": "DESC", 
+ "track_seen": 0
 }
\ No newline at end of file
diff --git a/erpnext/setup/doctype/territory/test_records.json b/erpnext/setup/doctype/territory/test_records.json
index 2518619..6011a38 100644
--- a/erpnext/setup/doctype/territory/test_records.json
+++ b/erpnext/setup/doctype/territory/test_records.json
@@ -1,31 +1,31 @@
 [
  {
   "doctype": "Territory", 
-  "is_group": "No", 
+  "is_group": 0, 
   "parent_territory": "All Territories", 
   "territory_name": "_Test Territory"
  }, 
  {
   "doctype": "Territory", 
-  "is_group": "Yes", 
+  "is_group": 1, 
   "parent_territory": "All Territories", 
   "territory_name": "_Test Territory India"
  }, 
  {
   "doctype": "Territory", 
-  "is_group": "No", 
+  "is_group": 0, 
   "parent_territory": "_Test Territory India", 
   "territory_name": "_Test Territory Maharashtra"
  }, 
  {
   "doctype": "Territory", 
-  "is_group": "No", 
+  "is_group": 0, 
   "parent_territory": "All Territories", 
   "territory_name": "_Test Territory Rest Of The World"
  }, 
  {
   "doctype": "Territory", 
-  "is_group": "No", 
+  "is_group": 0, 
   "parent_territory": "All Territories", 
   "territory_name": "_Test Territory United States"
  }
diff --git a/erpnext/setup/setup_wizard/install_fixtures.py b/erpnext/setup/setup_wizard/install_fixtures.py
index 3ea2539..a0e52dd 100644
--- a/erpnext/setup/setup_wizard/install_fixtures.py
+++ b/erpnext/setup/setup_wizard/install_fixtures.py
@@ -15,17 +15,17 @@
 
 		# item group
 		{'doctype': 'Item Group', 'item_group_name': _('All Item Groups'),
-			'is_group': 'Yes', 'parent_item_group': ''},
+			'is_group': 1, 'parent_item_group': ''},
 		{'doctype': 'Item Group', 'item_group_name': _('Products'),
-			'is_group': 'No', 'parent_item_group': _('All Item Groups'), "show_in_website": 1 },
+			'is_group': 0, 'parent_item_group': _('All Item Groups'), "show_in_website": 1 },
 		{'doctype': 'Item Group', 'item_group_name': _('Raw Material'),
-			'is_group': 'No', 'parent_item_group': _('All Item Groups') },
+			'is_group': 0, 'parent_item_group': _('All Item Groups') },
 		{'doctype': 'Item Group', 'item_group_name': _('Services'),
-			'is_group': 'No', 'parent_item_group': _('All Item Groups') },
+			'is_group': 0, 'parent_item_group': _('All Item Groups') },
 		{'doctype': 'Item Group', 'item_group_name': _('Sub Assemblies'),
-			'is_group': 'No', 'parent_item_group': _('All Item Groups') },
+			'is_group': 0, 'parent_item_group': _('All Item Groups') },
 		{'doctype': 'Item Group', 'item_group_name': _('Consumable'),
-			'is_group': 'No', 'parent_item_group': _('All Item Groups') },
+			'is_group': 0, 'parent_item_group': _('All Item Groups') },
 
 		# deduction type
 		{'doctype': 'Deduction Type', 'name': _('Income Tax'), 'description': _('Income Tax'), 'deduction_name': _('Income Tax')},
@@ -95,14 +95,14 @@
 		{'doctype': 'Designation', 'designation_name': _('Researcher')},
 
 		# territory
-		{'doctype': 'Territory', 'territory_name': _('All Territories'), 'is_group': 'Yes', 'name': _('All Territories'), 'parent_territory': ''},
+		{'doctype': 'Territory', 'territory_name': _('All Territories'), 'is_group': 1, 'name': _('All Territories'), 'parent_territory': ''},
 
 		# customer group
-		{'doctype': 'Customer Group', 'customer_group_name': _('All Customer Groups'), 'is_group': 'Yes', 	'name': _('All Customer Groups'), 'parent_customer_group': ''},
-		{'doctype': 'Customer Group', 'customer_group_name': _('Individual'), 'is_group': 'No', 'parent_customer_group': _('All Customer Groups')},
-		{'doctype': 'Customer Group', 'customer_group_name': _('Commercial'), 'is_group': 'No', 'parent_customer_group': _('All Customer Groups')},
-		{'doctype': 'Customer Group', 'customer_group_name': _('Non Profit'), 'is_group': 'No', 'parent_customer_group': _('All Customer Groups')},
-		{'doctype': 'Customer Group', 'customer_group_name': _('Government'), 'is_group': 'No', 'parent_customer_group': _('All Customer Groups')},
+		{'doctype': 'Customer Group', 'customer_group_name': _('All Customer Groups'), 'is_group': 1, 	'name': _('All Customer Groups'), 'parent_customer_group': ''},
+		{'doctype': 'Customer Group', 'customer_group_name': _('Individual'), 'is_group': 0, 'parent_customer_group': _('All Customer Groups')},
+		{'doctype': 'Customer Group', 'customer_group_name': _('Commercial'), 'is_group': 0, 'parent_customer_group': _('All Customer Groups')},
+		{'doctype': 'Customer Group', 'customer_group_name': _('Non Profit'), 'is_group': 0, 'parent_customer_group': _('All Customer Groups')},
+		{'doctype': 'Customer Group', 'customer_group_name': _('Government'), 'is_group': 0, 'parent_customer_group': _('All Customer Groups')},
 
 		# supplier type
 		{'doctype': 'Supplier Type', 'supplier_type': _('Services')},
@@ -114,7 +114,7 @@
 		{'doctype': 'Supplier Type', 'supplier_type': _('Distributor')},
 
 		# Sales Person
-		{'doctype': 'Sales Person', 'sales_person_name': _('Sales Team'), 'is_group': "Yes", "parent_sales_person": ""},
+		{'doctype': 'Sales Person', 'sales_person_name': _('Sales Team'), 'is_group': 1, "parent_sales_person": ""},
 
 		# UOM
 		{'uom_name': _('Unit'), 'doctype': 'UOM', 'name': _('Unit'), "must_be_whole_number": 1},
diff --git a/erpnext/stock/__init__.py b/erpnext/stock/__init__.py
index 824786b..eb5c5d9 100644
--- a/erpnext/stock/__init__.py
+++ b/erpnext/stock/__init__.py
@@ -4,7 +4,7 @@
 	{"doctype":"Role", "role_name":"Item Manager", "name":"Item Manager"},
 	{"doctype":"Role", "role_name":"Stock User", "name":"Stock User"},
 	{"doctype":"Role", "role_name":"Quality Manager", "name":"Quality Manager"},
-	{"doctype":"Item Group", "item_group_name":"All Item Groups", "is_group":"Yes"},
+	{"doctype":"Item Group", "item_group_name":"All Item Groups", "is_group": 1},
 	{"doctype":"Item Group", "item_group_name":"Default", 
-		"parent_item_group":"All Item Groups", "is_group":"No"},
+		"parent_item_group":"All Item Groups", "is_group": 0},
 ]
diff --git a/erpnext/stock/doctype/delivery_note/delivery_note.js b/erpnext/stock/doctype/delivery_note/delivery_note.js
index c5fce7d..65658d6 100644
--- a/erpnext/stock/doctype/delivery_note/delivery_note.js
+++ b/erpnext/stock/doctype/delivery_note/delivery_note.js
@@ -5,6 +5,15 @@
 
 frappe.provide("erpnext.stock");
 frappe.provide("erpnext.stock.delivery_note");
+
+frappe.ui.form.on('Delivery Note', 'onload', function(frm) {
+	frm.set_indicator_formatter('item_code',
+		function(doc) {
+			return (doc.docstatus==1 || doc.qty<=doc.actual_qty) ? "green" : "orange"
+		})
+
+})
+
 erpnext.stock.DeliveryNoteController = erpnext.selling.SellingController.extend({
 	refresh: function(doc, dt, dn) {
 		this._super();
@@ -28,7 +37,7 @@
 			if (this.frm.doc.docstatus===0) {
 				cur_frm.add_custom_button(__('Sales Order'),
 					function() {
-						frappe.model.map_current_doc({
+						erpnext.utils.map_current_doc({
 							method: "erpnext.selling.doctype.sales_order.sales_order.make_delivery_note",
 							source_doctype: "Sales Order",
 							get_query_filters: {
diff --git a/erpnext/stock/doctype/item_attribute/item_attribute.py b/erpnext/stock/doctype/item_attribute/item_attribute.py
index 7bcb21a..7529ef6 100644
--- a/erpnext/stock/doctype/item_attribute/item_attribute.py
+++ b/erpnext/stock/doctype/item_attribute/item_attribute.py
@@ -6,7 +6,7 @@
 from frappe.model.document import Document
 from frappe import _
 
-from erpnext.controllers.item_variant import InvalidItemAttributeValueError
+from erpnext.controllers.item_variant import validate_item_variant_attributes, InvalidItemAttributeValueError
 
 
 class ItemAttributeIncrementError(frappe.ValidationError): pass
@@ -24,9 +24,9 @@
 
 	def validate_exising_items(self):
 		'''Validate that if there are existing items with attributes, they are valid'''
-		for item in frappe.db.sql('''select i.name from `tabItem Variant Attribute` iva, `tabItem` i
+		for item in frappe.db.sql('''select distinct i.name from `tabItem Variant Attribute` iva, `tabItem` i
 			where iva.attribute = %s and iva.parent = i.name and i.has_variants = 0''', self.name):
-			frappe.get_doc('Item', item[0]).validate_variant_attributes()
+			validate_item_variant_attributes(frappe.get_doc('Item', item[0]))
 
 	def validate_numeric(self):
 		if self.numeric_values:
diff --git a/erpnext/stock/doctype/material_request/material_request.js b/erpnext/stock/doctype/material_request/material_request.js
index 0a07582..bbd312d 100644
--- a/erpnext/stock/doctype/material_request/material_request.js
+++ b/erpnext/stock/doctype/material_request/material_request.js
@@ -87,7 +87,7 @@
 		if (this.frm.doc.docstatus===0) {
 			cur_frm.add_custom_button(__('Sales Order'),
 				function() {
-					frappe.model.map_current_doc({
+					erpnext.utils.map_current_doc({
 						method: "erpnext.selling.doctype.sales_order.sales_order.make_material_request",
 						source_doctype: "Sales Order",
 						get_query_filters: {
diff --git a/erpnext/stock/doctype/purchase_receipt/purchase_receipt.js b/erpnext/stock/doctype/purchase_receipt/purchase_receipt.js
index f622b63..792f269 100644
--- a/erpnext/stock/doctype/purchase_receipt/purchase_receipt.js
+++ b/erpnext/stock/doctype/purchase_receipt/purchase_receipt.js
@@ -52,7 +52,7 @@
 			if(this.frm.doc.docstatus==0) {
 				cur_frm.add_custom_button(__('Purchase Order'),
 					function() {
-						frappe.model.map_current_doc({
+						erpnext.utils.map_current_doc({
 							method: "erpnext.buying.doctype.purchase_order.purchase_order.make_purchase_receipt",
 							source_doctype: "Purchase Order",
 							get_query_filters: {
diff --git a/erpnext/stock/page/stock_balance/stock_balance.json b/erpnext/stock/page/stock_balance/stock_balance.json
index d908875..05039da 100644
--- a/erpnext/stock/page/stock_balance/stock_balance.json
+++ b/erpnext/stock/page/stock_balance/stock_balance.json
@@ -4,7 +4,7 @@
  "docstatus": 0, 
  "doctype": "Page", 
  "idx": 0, 
- "modified": "2016-04-21 05:04:30.228526", 
+ "modified": "2016-07-14 06:39:09.096256", 
  "modified_by": "Administrator", 
  "module": "Stock", 
  "name": "stock-balance", 
@@ -18,5 +18,5 @@
  "script": null, 
  "standard": "Yes", 
  "style": null, 
- "title": "Stock Balance"
+ "title": "Stock Summary"
 }
\ No newline at end of file
diff --git a/erpnext/stock/report/stock_balance/stock_balance.py b/erpnext/stock/report/stock_balance/stock_balance.py
index 696f2b0..2777d3d 100644
--- a/erpnext/stock/report/stock_balance/stock_balance.py
+++ b/erpnext/stock/report/stock_balance/stock_balance.py
@@ -8,7 +8,7 @@
 
 def execute(filters=None):
 	if not filters: filters = {}
-	
+
 	validate_filters(filters)
 
 	columns = get_columns()
@@ -83,7 +83,7 @@
 			company, voucher_type, qty_after_transaction, stock_value_difference
 		from `tabStock Ledger Entry` sle force index (posting_sort_index)
 		where docstatus < 2 %s order by posting_date, posting_time, name""" %
-		conditions, as_dict=1, debug=1)
+		conditions, as_dict=1)
 
 def get_item_warehouse_map(filters):
 	iwb_map = {}
@@ -147,4 +147,3 @@
 		sle_count = flt(frappe.db.sql("""select count(name) from `tabStock Ledger Entry`""")[0][0])
 		if sle_count > 500000:
 			frappe.throw(_("Please set filter based on Item or Warehouse"))
-	
\ No newline at end of file