Merge pull request #9710 from rohitwaghchaure/sales_invoice_dn_link_revert

Revert sales invoice dn link issue
diff --git a/erpnext/__init__.py b/erpnext/__init__.py
index 5ba4160..a8a8055 100644
--- a/erpnext/__init__.py
+++ b/erpnext/__init__.py
@@ -2,7 +2,7 @@
 from __future__ import unicode_literals
 import frappe
 
-__version__ = '8.3.3'
+__version__ = '8.3.5'
 
 def get_default_company(user=None):
 	'''Get default company for user'''
diff --git a/erpnext/accounts/doctype/budget/budget.py b/erpnext/accounts/doctype/budget/budget.py
index a6348f1..f99d0bb 100644
--- a/erpnext/accounts/doctype/budget/budget.py
+++ b/erpnext/accounts/doctype/budget/budget.py
@@ -83,7 +83,7 @@
 
 			budget_records = frappe.db.sql("""
 				select
-					b.{budget_against_field}, ba.budget_amount, b.monthly_distribution,
+					b.{budget_against_field} as budget_against, ba.budget_amount, b.monthly_distribution,
 					b.action_if_annual_budget_exceeded, 
 					b.action_if_accumulated_monthly_budget_exceeded
 				from 
@@ -111,15 +111,15 @@
 				args["month_end_date"] = get_last_day(args.posting_date)
 
 				compare_expense_with_budget(args, budget_amount, 
-					_("Accumulated Monthly"), monthly_action)
+					_("Accumulated Monthly"), monthly_action, budget.budget_against)
 
 			if yearly_action in ("Stop", "Warn") and monthly_action != "Stop" \
 				and yearly_action != monthly_action:
 				compare_expense_with_budget(args, flt(budget.budget_amount), 
-						_("Annual"), yearly_action)
+						_("Annual"), yearly_action, budget.budget_against)
 
 
-def compare_expense_with_budget(args, budget_amount, action_for, action):
+def compare_expense_with_budget(args, budget_amount, action_for, action, budget_against):
 	actual_expense = get_actual_expense(args)
 	if actual_expense > budget_amount:
 		diff = actual_expense - budget_amount
@@ -127,7 +127,7 @@
 
 		msg = _("{0} Budget for Account {1} against {2} {3} is {4}. It will exceed by {5}").format(
 				_(action_for), frappe.bold(args.account), args.budget_against_field, 
-				frappe.bold(args.budget_against), 
+				frappe.bold(budget_against),
 				frappe.bold(fmt_money(budget_amount, currency=currency)), 
 				frappe.bold(fmt_money(diff, currency=currency)))
 
diff --git a/erpnext/accounts/doctype/budget/test_budget.py b/erpnext/accounts/doctype/budget/test_budget.py
index 15895dc..f6849ba 100644
--- a/erpnext/accounts/doctype/budget/test_budget.py
+++ b/erpnext/accounts/doctype/budget/test_budget.py
@@ -140,6 +140,33 @@
 		budget.load_from_db()
 		budget.cancel()
 
+	def test_monthly_budget_against_parent_group_cost_center(self):
+		cost_center = "_Test Cost Center 3 - _TC"
+
+		if not frappe.db.exists("Cost Center", cost_center):
+			frappe.get_doc({
+				'doctype': 'Cost Center',
+				'cost_center_name': '_Test Cost Center 3',
+				'parent_cost_center': "_Test Company - _TC",
+				'company': '_Test Company',
+				'is_group': 0
+			}).insert(ignore_permissions=True)
+
+		budget = make_budget("Cost Center", cost_center)
+		frappe.db.set_value("Budget", budget.name, "action_if_accumulated_monthly_budget_exceeded", "Stop")
+
+		jv = make_journal_entry("_Test Account Cost for Goods Sold - _TC",
+			"_Test Bank - _TC", 40000, cost_center)
+
+		self.assertRaises(BudgetError, jv.submit)
+
+		budget.load_from_db()
+		budget.cancel()
+		jv.cancel()
+
+		frappe.delete_doc('Journal Entry', jv.name)
+		frappe.delete_doc('Cost Center', cost_center)
+
 def set_total_expense_zero(posting_date, budget_against_field=None, budget_against_CC=None):
 	if budget_against_field == "Project":
 		budget_against = "_Test Project"
@@ -167,7 +194,8 @@
 	if budget_against == "Project":
 		budget_list = frappe.get_all("Budget", fields=["name"], filters = {"name": ("like", "_Test Project/_Test Fiscal Year 2013%")})
 	else:
-		budget_list = frappe.get_all("Budget", fields=["name"], filters = {"name": ("like", "_Test Cost Center - _TC/_Test Fiscal Year 2013%")})
+		cost_center_name = "{0}%".format(cost_center or "_Test Cost Center - _TC/_Test Fiscal Year 2013")
+		budget_list = frappe.get_all("Budget", fields=["name"], filters = {"name": ("like", cost_center_name)})
 	for d in budget_list:
 		frappe.db.sql("delete from `tabBudget` where name = %(name)s", d)
 		frappe.db.sql("delete from `tabBudget Account` where parent = %(name)s", d)
diff --git a/erpnext/accounts/doctype/payment_entry/payment_entry.js b/erpnext/accounts/doctype/payment_entry/payment_entry.js
index 5bfd4d9..63832fa 100644
--- a/erpnext/accounts/doctype/payment_entry/payment_entry.js
+++ b/erpnext/accounts/doctype/payment_entry/payment_entry.js
@@ -291,37 +291,39 @@
 
 	set_account_currency_and_balance: function(frm, account, currency_field,
 			balance_field, callback_function) {
-		frappe.call({
-			method: "erpnext.accounts.doctype.payment_entry.payment_entry.get_account_details",
-			args: {
-				"account": account,
-				"date": frm.doc.posting_date
-			},
-			callback: function(r, rt) {
-				if(r.message) {
-					frm.set_value(currency_field, r.message['account_currency']);
-					frm.set_value(balance_field, r.message['account_balance']);
+		if (frm.doc.posting_date) {
+			frappe.call({
+				method: "erpnext.accounts.doctype.payment_entry.payment_entry.get_account_details",
+				args: {
+					"account": account,
+					"date": frm.doc.posting_date
+				},
+				callback: function(r, rt) {
+					if(r.message) {
+						frm.set_value(currency_field, r.message['account_currency']);
+						frm.set_value(balance_field, r.message['account_balance']);
 
-					if(frm.doc.payment_type=="Receive" && currency_field=="paid_to_account_currency") {
-						frm.toggle_reqd(["reference_no", "reference_date"],
-							(r.message['account_type'] == "Bank" ? 1 : 0));
-						if(!frm.doc.received_amount && frm.doc.paid_amount)
-							frm.events.paid_amount(frm);
-					} else if(frm.doc.payment_type=="Pay" && currency_field=="paid_from_account_currency") {
-						frm.toggle_reqd(["reference_no", "reference_date"],
-							(r.message['account_type'] == "Bank" ? 1 : 0));
+						if(frm.doc.payment_type=="Receive" && currency_field=="paid_to_account_currency") {
+							frm.toggle_reqd(["reference_no", "reference_date"],
+								(r.message['account_type'] == "Bank" ? 1 : 0));
+							if(!frm.doc.received_amount && frm.doc.paid_amount)
+								frm.events.paid_amount(frm);
+						} else if(frm.doc.payment_type=="Pay" && currency_field=="paid_from_account_currency") {
+							frm.toggle_reqd(["reference_no", "reference_date"],
+								(r.message['account_type'] == "Bank" ? 1 : 0));
 
-						if(!frm.doc.paid_amount && frm.doc.received_amount)
-							frm.events.received_amount(frm);
+							if(!frm.doc.paid_amount && frm.doc.received_amount)
+								frm.events.received_amount(frm);
+						}
+
+						if(callback_function) callback_function(frm);
+
+						frm.events.hide_unhide_fields(frm);
+						frm.events.set_dynamic_labels(frm);
 					}
-
-					if(callback_function) callback_function(frm);
-
-					frm.events.hide_unhide_fields(frm);
-					frm.events.set_dynamic_labels(frm);
 				}
-			}
-		});
+			});			
+		}
 	},
 
 	paid_from_account_currency: function(frm) {
diff --git a/erpnext/docs/assets/img/setup/sms-setting2.jpg b/erpnext/docs/assets/img/setup/sms-settings2.jpg
similarity index 100%
rename from erpnext/docs/assets/img/setup/sms-setting2.jpg
rename to erpnext/docs/assets/img/setup/sms-settings2.jpg
Binary files differ
diff --git a/erpnext/hooks.py b/erpnext/hooks.py
index ec93f62..0966485 100644
--- a/erpnext/hooks.py
+++ b/erpnext/hooks.py
@@ -80,6 +80,13 @@
 			"parents": [{"title": _("Supplier Quotation"), "name": "quotations"}]
 		}
 	},
+	{"from_route": "/quotes", "to_route": "Quotation"},
+	{"from_route": "/quotes/<path:name>", "to_route": "order",
+		"defaults": {
+			"doctype": "Quotation",
+			"parents": [{"title": _("Quotes"), "name": "quotes"}]
+		}
+	},
 	{"from_route": "/shipments", "to_route": "Delivery Note"},
 	{"from_route": "/shipments/<path:name>", "to_route": "order",
 		"defaults": {
@@ -110,6 +117,7 @@
 	{"title": _("Projects"), "route": "/project", "reference_doctype": "Project"},
 	{"title": _("Request for Quotations"), "route": "/rfq", "reference_doctype": "Request for Quotation", "role": "Supplier"},
 	{"title": _("Supplier Quotation"), "route": "/quotations", "reference_doctype": "Supplier Quotation", "role": "Supplier"},
+	{"title": _("Quotes"), "route": "/quotes", "reference_doctype": "Quotation", "role":"Customer"},
 	{"title": _("Orders"), "route": "/orders", "reference_doctype": "Sales Order", "role":"Customer"},
 	{"title": _("Invoices"), "route": "/invoices", "reference_doctype": "Sales Invoice", "role":"Customer"},
 	{"title": _("Shipments"), "route": "/shipments", "reference_doctype": "Delivery Note", "role":"Customer"},
diff --git a/erpnext/manufacturing/doctype/production_order/production_order.js b/erpnext/manufacturing/doctype/production_order/production_order.js
index a988112..f6d9eaf 100644
--- a/erpnext/manufacturing/doctype/production_order/production_order.js
+++ b/erpnext/manufacturing/doctype/production_order/production_order.js
@@ -265,7 +265,7 @@
 					erpnext.production_order.stop_production_order(frm, "Resumed");
 				}, __("Status"));
 			}
-			
+
 			if(!frm.doc.skip_transfer){
 				if ((flt(doc.material_transferred_for_manufacturing) < flt(doc.qty))
 					&& frm.doc.status != 'Stopped') {
@@ -274,7 +274,7 @@
 						erpnext.production_order.make_se(frm, 'Material Transfer for Manufacture');
 					});
 					start_btn.addClass('btn-primary');
-					}
+				}
 			}
 
 			if(!frm.doc.skip_transfer){
@@ -293,8 +293,9 @@
 			} else {
 				if ((flt(doc.produced_qty) < flt(doc.qty)) && frm.doc.status != 'Stopped') {
 					frm.has_finish_btn = true;
-					var finish_btn = frm.add_custom_button(__('Finish'),
-						cur_frm.cscript['Update Finished Goods']);
+					var finish_btn = frm.add_custom_button(__('Finish'), function() {
+						erpnext.production_order.make_se(frm, 'Manufacture');
+					});
 					finish_btn.addClass('btn-primary');
 				}
 			}
diff --git a/erpnext/manufacturing/doctype/production_order/production_order.json b/erpnext/manufacturing/doctype/production_order/production_order.json
index ee033c4..e56e5a1 100644
--- a/erpnext/manufacturing/doctype/production_order/production_order.json
+++ b/erpnext/manufacturing/doctype/production_order/production_order.json
@@ -1358,7 +1358,7 @@
  "issingle": 0, 
  "istable": 0, 
  "max_attachments": 0, 
- "modified": "2017-06-13 14:29:00.457874", 
+ "modified": "2017-07-10 14:29:00.457874", 
  "modified_by": "Administrator", 
  "module": "Manufacturing", 
  "name": "Production Order", 
diff --git a/erpnext/manufacturing/doctype/production_order_item/production_order_item.json b/erpnext/manufacturing/doctype/production_order_item/production_order_item.json
index 06a7876..00e3adf 100644
--- a/erpnext/manufacturing/doctype/production_order_item/production_order_item.json
+++ b/erpnext/manufacturing/doctype/production_order_item/production_order_item.json
@@ -353,7 +353,7 @@
  "issingle": 0, 
  "istable": 1, 
  "max_attachments": 0, 
- "modified": "2017-05-15 17:37:20.212361", 
+ "modified": "2017-07-10 17:37:20.212361", 
  "modified_by": "Administrator", 
  "module": "Manufacturing", 
  "name": "Production Order Item", 
diff --git a/erpnext/patches/v8_0/merge_student_batch_and_student_group.py b/erpnext/patches/v8_0/merge_student_batch_and_student_group.py
index 7cfdf60..c5654eb 100644
--- a/erpnext/patches/v8_0/merge_student_batch_and_student_group.py
+++ b/erpnext/patches/v8_0/merge_student_batch_and_student_group.py
@@ -9,8 +9,8 @@
 
 def execute():
 	# for converting student batch into student group
-	for doctype in ["Student Group", "Student Group Student", "Student Group Instructor", "Student Attendance"]:
-		frappe.reload_doc("schools", "doctype", doctype)
+	for doctype in ["Student Group", "Student Group Student", "Student Group Instructor", "Student Attendance", "Student"]:
+		frappe.reload_doc("schools", "doctype", frappe.scrub(doctype))
 
 	if frappe.db.table_exists("Student Batch"):
 		student_batches = frappe.db.sql('''select name as student_group_name, student_batch_name as batch,
diff --git a/erpnext/patches/v8_1/setup_gst_india.py b/erpnext/patches/v8_1/setup_gst_india.py
index ce27d37..5660693 100644
--- a/erpnext/patches/v8_1/setup_gst_india.py
+++ b/erpnext/patches/v8_1/setup_gst_india.py
@@ -5,6 +5,7 @@
 	frappe.reload_doc('regional', 'doctype', 'gst_settings')
 	frappe.reload_doc('regional', 'doctype', 'gst_hsn_code')
 	frappe.reload_doc('stock', 'doctype', 'item')
+	frappe.reload_doc("stock", "doctype", "customs_tariff_number")
 
 	for report_name in ('GST Sales Register', 'GST Purchase Register',
 		'GST Itemised Sales Register', 'GST Itemised Purchase Register'):
diff --git a/erpnext/regional/india/utils.py b/erpnext/regional/india/utils.py
index 62de7a9..84e5f3e 100644
--- a/erpnext/regional/india/utils.py
+++ b/erpnext/regional/india/utils.py
@@ -19,6 +19,6 @@
 
 		if doc.gst_state:
 			doc.gst_state_number = state_numbers[doc.gst_state]
-			if doc.gst_state_number != doc.gstin[:2]:
+			if doc.gstin != "NA" and doc.gst_state_number != doc.gstin[:2]:
 				frappe.throw(_("First 2 digits of GSTIN should match with State number {0}")
-					.format(doc.gst_state_number))
\ No newline at end of file
+					.format(doc.gst_state_number))
diff --git a/erpnext/schools/doctype/student_attendance_tool/student_attendance_tool.js b/erpnext/schools/doctype/student_attendance_tool/student_attendance_tool.js
index 93c83f3..c5ff917 100644
--- a/erpnext/schools/doctype/student_attendance_tool/student_attendance_tool.js
+++ b/erpnext/schools/doctype/student_attendance_tool/student_attendance_tool.js
@@ -135,22 +135,24 @@
 				frappe.confirm(__("Do you want to update attendance?<br>Present: {0}\
 					<br>Absent: {1}", [students_present.length, students_absent.length]),
 					function() {	//ifyes
-						frappe.call({
-							method: "erpnext.schools.api.mark_attendance",
-							freeze: true,
-							freeze_message: "Marking attendance",
-							args: {
-								"students_present": students_present,
-								"students_absent": students_absent,
-								"student_group": frm.doc.student_group,
-								"course_schedule": frm.doc.course_schedule,
-								"date": frm.doc.date
-							},
-							callback: function(r) {
-								$(me.wrapper.find(".btn-mark-att")).attr("disabled", false);
-								frm.trigger("student_group");
-							}
-						});
+						if(!frappe.request.ajax_count) {
+							frappe.call({
+								method: "erpnext.schools.api.mark_attendance",
+								freeze: true,
+								freeze_message: "Marking attendance",
+								args: {
+									"students_present": students_present,
+									"students_absent": students_absent,
+									"student_group": frm.doc.student_group,
+									"course_schedule": frm.doc.course_schedule,
+									"date": frm.doc.date
+								},
+								callback: function(r) {
+									$(me.wrapper.find(".btn-mark-att")).attr("disabled", false);
+									frm.trigger("student_group");
+								}
+							});
+						}
 					},
 					function() {	//ifno
 						$(me.wrapper.find(".btn-mark-att")).attr("disabled", false);
diff --git a/erpnext/schools/doctype/student_log/student_log.json b/erpnext/schools/doctype/student_log/student_log.json
index 43ac134..6c9d4b0 100644
--- a/erpnext/schools/doctype/student_log/student_log.json
+++ b/erpnext/schools/doctype/student_log/student_log.json
@@ -1,5 +1,6 @@
 {
  "allow_copy": 0, 
+ "allow_guest_to_view": 0, 
  "allow_import": 0, 
  "allow_rename": 0, 
  "autoname": "SLog.####", 
@@ -13,6 +14,7 @@
  "engine": "InnoDB", 
  "fields": [
   {
+   "allow_bulk_edit": 0, 
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
@@ -43,64 +45,7 @@
    "unique": 0
   }, 
   {
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "columns": 0, 
-   "fieldname": "type", 
-   "fieldtype": "Select", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "ignore_xss_filter": 0, 
-   "in_filter": 0, 
-   "in_global_search": 0, 
-   "in_list_view": 1, 
-   "in_standard_filter": 1, 
-   "label": "Type", 
-   "length": 0, 
-   "no_copy": 0, 
-   "options": "General\nAcademic\nMedical\nAchievement", 
-   "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_global_search": 0, 
-   "in_list_view": 0, 
-   "in_standard_filter": 0, 
-   "length": 0, 
-   "no_copy": 0, 
-   "permlevel": 0, 
-   "precision": "", 
-   "print_hide": 0, 
-   "print_hide_if_no_value": 0, 
-   "read_only": 0, 
-   "remember_last_selected_value": 0, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
-   "unique": 0
-  }, 
-  {
+   "allow_bulk_edit": 0, 
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
@@ -131,6 +76,38 @@
    "unique": 0
   }, 
   {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "type", 
+   "fieldtype": "Select", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 1, 
+   "in_standard_filter": 1, 
+   "label": "Type", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "General\nAcademic\nMedical\nAchievement", 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
@@ -160,6 +137,160 @@
    "unique": 0
   }, 
   {
+   "allow_bulk_edit": 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_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "academic_year", 
+   "fieldtype": "Link", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "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_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "academic_term", 
+   "fieldtype": "Link", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Academic Term", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "Academic Term", 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "program", 
+   "fieldtype": "Link", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "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_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "student_batch", 
+   "fieldtype": "Link", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Student Batch", 
+   "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_bulk_edit": 0, 
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
@@ -188,6 +319,7 @@
    "unique": 0
   }, 
   {
+   "allow_bulk_edit": 0, 
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
@@ -217,17 +349,17 @@
    "unique": 0
   }
  ], 
+ "has_web_view": 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": "2017-02-17 17:18:19.596892", 
+ "modified": "2017-07-06 12:42:05.777673", 
  "modified_by": "Administrator", 
  "module": "Schools", 
  "name": "Student Log", 
diff --git a/erpnext/selling/doctype/quotation/quotation.py b/erpnext/selling/doctype/quotation/quotation.py
index b102e1d..a4d4bf9 100644
--- a/erpnext/selling/doctype/quotation/quotation.py
+++ b/erpnext/selling/doctype/quotation/quotation.py
@@ -86,6 +86,17 @@
 			print_lst.append(lst1)
 		return print_lst
 
+def get_list_context(context=None):
+	from erpnext.controllers.website_list_for_contact import get_list_context
+	list_context = get_list_context(context)
+	list_context.update({
+		'show_sidebar': True,
+		'show_search': True,
+		'no_breadcrumbs': True,
+		'title': _('Quotes'),
+	})
+
+	return list_context
 
 @frappe.whitelist()
 def make_sales_order(source_name, target_doc=None):
diff --git a/erpnext/setup/doctype/item_group/item_group.py b/erpnext/setup/doctype/item_group/item_group.py
index adff615..8d027b3 100644
--- a/erpnext/setup/doctype/item_group/item_group.py
+++ b/erpnext/setup/doctype/item_group/item_group.py
@@ -69,7 +69,7 @@
 		context.update({
 			"items": get_product_list_for_group(product_group = self.name, start=start,
 				limit=context.page_length + 1, search=frappe.form_dict.get("search")),
-			"parent_groups": get_parent_item_groups(self.name),
+			"parents": get_parent_item_groups(self.parent_item_group),
 			"title": self.name,
 			"products_as_list": cint(frappe.db.get_single_value('Website Settings', 'products_as_list'))
 		})
@@ -136,7 +136,8 @@
 
 def get_parent_item_groups(item_group_name):
 	item_group = frappe.get_doc("Item Group", item_group_name)
-	return frappe.db.sql("""select name, route from `tabItem Group`
+	return 	[{"name": frappe._("Home"),"route":"/"}]+\
+		frappe.db.sql("""select name, route from `tabItem Group`
 		where lft <= %s and rgt >= %s
 		and show_in_website=1
 		order by lft asc""", (item_group.lft, item_group.rgt), as_dict=True)
@@ -146,6 +147,7 @@
 		item_group = doc.name
 
 	for d in get_parent_item_groups(item_group):
-		d = frappe.get_doc("Item Group", d.name)
-		if d.route:
-			clear_cache(d.route)
+		if frappe.db.exists("Item Group", d.get("name")):
+			d = frappe.get_doc("Item Group", d.get("name"))
+			if d.route:
+				clear_cache(d.route)
diff --git a/erpnext/stock/doctype/item/item.py b/erpnext/stock/doctype/item/item.py
index 9328194..2c6aab5 100644
--- a/erpnext/stock/doctype/item/item.py
+++ b/erpnext/stock/doctype/item/item.py
@@ -146,10 +146,6 @@
 			return cstr(frappe.db.get_value('Item Group', self.item_group,
 				'route')) + '/' + self.scrub(self.item_name + '-' + random_string(5))
 
-	def get_parents(self, context):
-		item_group, route = frappe.db.get_value('Item Group', self.item_group, ['name', 'route'])
-		context.parents = [{'name': route, 'label': item_group}]
-
 	def validate_website_image(self):
 		"""Validate if the website image is a public file"""
 		auto_set_website_image = False
@@ -242,15 +238,12 @@
 		context.show_search=True
 		context.search_link = '/product_search'
 
-		context.parent_groups = get_parent_item_groups(self.item_group) + \
-			[{"name": self.name}]
+		context.parents = get_parent_item_groups(self.item_group)
 
 		self.set_variant_context(context)
 		self.set_attribute_context(context)
 		self.set_disabled_attributes(context)
 
-		self.get_parents(context)
-
 		return context
 
 	def set_variant_context(self, context):
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 5f1e944..aca77a5 100755
--- a/erpnext/stock/doctype/purchase_receipt_item/purchase_receipt_item.json
+++ b/erpnext/stock/doctype/purchase_receipt_item/purchase_receipt_item.json
@@ -1597,7 +1597,7 @@
    "collapsible": 0,
    "columns": 0,
    "default": ":Company",
-   "depends_on": "eval:cint(sys_defaults.auto_accounting_for_stock)",
+   "depends_on": "eval:cint(erpnext.is_perpetual_inventory_enabled(parent.company))",
    "fieldname": "cost_center",
    "fieldtype": "Link",
    "hidden": 0,
@@ -2044,7 +2044,7 @@
  "issingle": 0,
  "istable": 1,
  "max_attachments": 0,
- "modified": "2017-06-16 17:23:01.404744",
+ "modified": "2017-07-10 06:31:31.457497",
  "modified_by": "Administrator",
  "module": "Stock",
  "name": "Purchase Receipt Item",
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 ec14aab..6afb54e 100644
--- a/erpnext/stock/doctype/stock_entry_detail/stock_entry_detail.json
+++ b/erpnext/stock/doctype/stock_entry_detail/stock_entry_detail.json
@@ -960,7 +960,7 @@
    "bold": 0,
    "collapsible": 0,
    "columns": 0,
-   "depends_on": "eval:cint(frappe.sys_defaults.auto_accounting_for_stock)",
+   "depends_on": "eval:cint(erpnext.is_perpetual_inventory_enabled(parent.company))",
    "fieldname": "expense_account",
    "fieldtype": "Link",
    "hidden": 0,
@@ -1020,7 +1020,7 @@
    "collapsible": 0,
    "columns": 0,
    "default": ":Company",
-   "depends_on": "eval:cint(frappe.sys_defaults.auto_accounting_for_stock)",
+   "depends_on": "eval:cint(erpnext.is_perpetual_inventory_enabled(parent.company))",
    "fieldname": "cost_center",
    "fieldtype": "Link",
    "hidden": 0,
@@ -1266,7 +1266,7 @@
  "issingle": 0,
  "istable": 1,
  "max_attachments": 0,
- "modified": "2017-06-16 17:32:56.989049",
+ "modified": "2017-07-10 06:29:22.805345",
  "modified_by": "Administrator",
  "module": "Stock",
  "name": "Stock Entry Detail",