Merge branch 'develop'
diff --git a/erpnext/__init__.py b/erpnext/__init__.py
index 292353d..e0ce4fb 100644
--- a/erpnext/__init__.py
+++ b/erpnext/__init__.py
@@ -2,7 +2,7 @@
 from __future__ import unicode_literals
 import frappe
 
-__version__ = '7.0.3'
+__version__ = '7.0.4'
 
 def get_default_company(user=None):
 	'''Get default company for user'''
diff --git a/erpnext/accounts/page/pos/pos.js b/erpnext/accounts/page/pos/pos.js
index cb57ff4..a89f40e 100644
--- a/erpnext/accounts/page/pos/pos.js
+++ b/erpnext/accounts/page/pos/pos.js
@@ -69,13 +69,13 @@
 		var me = this;
 		// navigator.onLine
 		this.connection_status = false;
-		this.page.set_indicator("Offline", "grey")
+		this.page.set_indicator(__("Offline"), "grey")
 		frappe.call({
 			method:"frappe.handler.ping",
 			callback: function(r){
 				if(r.message){
 					me.connection_status = true;
-					me.page.set_indicator("Online", "green")
+					me.page.set_indicator(__("Online"), "green")
 				}
 			}
 		})
@@ -278,7 +278,7 @@
 				"fieldtype": "Data",
 				"label": "Item",
 				"fieldname": "pos_item",
-				"placeholder": "Search Item"
+				"placeholder": __("Search Item")
 			},
 			parent: this.wrapper.find(".search-area"),
 			only_input: true,
diff --git a/erpnext/controllers/sales_and_purchase_return.py b/erpnext/controllers/sales_and_purchase_return.py
index 37b13c3..8d30247 100644
--- a/erpnext/controllers/sales_and_purchase_return.py
+++ b/erpnext/controllers/sales_and_purchase_return.py
@@ -167,9 +167,7 @@
 		target_doc.qty = -1* source_doc.qty
 		if doctype == "Purchase Receipt":
 			target_doc.received_qty = -1* source_doc.qty
-			target_doc.prevdoc_doctype = source_doc.prevdoc_doctype
-			target_doc.prevdoc_docname = source_doc.prevdoc_docname
-			target_doc.prevdoc_detail_docname = source_doc.prevdoc_detail_docname
+			target_doc.purchase_order = source_doc.purchase_order
 		elif doctype == "Purchase Invoice":
 			target_doc.received_qty = -1* source_doc.qty
 			target_doc.purchase_order = source_doc.purchase_order
diff --git a/erpnext/patches.txt b/erpnext/patches.txt
index 09ff777..3e31d5e 100644
--- a/erpnext/patches.txt
+++ b/erpnext/patches.txt
@@ -301,3 +301,5 @@
 erpnext.patches.v7_0.setup_account_table_for_expense_claim_type_if_exists
 erpnext.patches.v7_0.migrate_schools_to_erpnext
 erpnext.patches.v7_0.remove_administrator_role_in_doctypes
+erpnext.patches.v7_0.rename_fee_amount_to_fee_component
+erpnext.patches.v7_0.calculate_total_costing_amount
diff --git a/erpnext/patches/v7_0/calculate_total_costing_amount.py b/erpnext/patches/v7_0/calculate_total_costing_amount.py
new file mode 100644
index 0000000..f426904
--- /dev/null
+++ b/erpnext/patches/v7_0/calculate_total_costing_amount.py
@@ -0,0 +1,14 @@
+import frappe
+from frappe.utils import flt
+
+def execute():
+	frappe.reload_doc('projects', 'doctype', 'timesheet')
+
+	for data in frappe.get_all('Timesheet', fields=["name, total_costing_amount"],
+		filters = [["docstatus", "<", "2"]]):
+		if flt(data.total_costing_amount) == 0.0:
+			ts = frappe.get_doc('Timesheet', data.name)
+			ts.update_cost()
+			ts.calculate_total_amounts()
+			ts.flags.ignore_validate_update_after_submit = True
+			ts.save()
diff --git a/erpnext/patches/v7_0/rename_fee_amount_to_fee_component.py b/erpnext/patches/v7_0/rename_fee_amount_to_fee_component.py
new file mode 100644
index 0000000..662a260
--- /dev/null
+++ b/erpnext/patches/v7_0/rename_fee_amount_to_fee_component.py
@@ -0,0 +1,15 @@
+# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
+# License: GNU General Public License v3. See license.txt
+
+from __future__ import unicode_literals
+import frappe
+
+from frappe.model.utils.rename_field import rename_field
+
+def execute():
+	frappe.rename_doc("DocType", "Fee Amount", "Fee Component")
+	for dt in ("Fees", "Fee Structure"):
+		frappe.reload_doctype(dt)
+		rename_field(dt, "amount", "components")
+		
+	
\ No newline at end of file
diff --git a/erpnext/projects/doctype/timesheet/timesheet.js b/erpnext/projects/doctype/timesheet/timesheet.js
index f816def..f3dfefa 100644
--- a/erpnext/projects/doctype/timesheet/timesheet.js
+++ b/erpnext/projects/doctype/timesheet/timesheet.js
@@ -5,11 +5,11 @@
 frappe.ui.form.on("Timesheet", {
 	setup: function(frm) {
 		frm.get_field('time_logs').grid.editable_fields = [
-			{fieldname: 'billable', columns: 2},
+			{fieldname: 'billable', columns: 1},
 			{fieldname: 'activity_type', columns: 2},
-			{fieldname: 'from_time', columns: 2},
-			{fieldname: 'hours', columns: 2},
-			{fieldname: 'to_time', columns: 2},
+			{fieldname: 'from_time', columns: 3},
+			{fieldname: 'hours', columns: 1},
+			{fieldname: 'project', columns: 3}
 		];
 
 		frm.fields_dict.employee.get_query = function() {
@@ -22,7 +22,8 @@
 			child = locals[cdt][cdn];
 			return{
 				filters: {
-					'project': child.project
+					'project': child.project,
+					'status': ["!=", "Closed"]
 				}
 			}
 		}
@@ -37,8 +38,7 @@
 
 	refresh: function(frm) {
 		if(frm.doc.docstatus==1) {
-			if(!frm.doc.sales_invoice && frm.doc.total_billing_amount > 0
-				&& !frm.doc.production_order){
+			if(!frm.doc.sales_invoice && frm.doc.total_billing_amount > 0){
 				frm.add_custom_button(__("Make Sales Invoice"), function() { frm.trigger("make_invoice") },
 					"icon-file-alt");
 			}
@@ -147,13 +147,16 @@
 	var tl = frm.doc.time_logs || [];
 	total_hr = 0;
 	total_billing_amount = 0;
+	total_costing_amount = 0;
 	for(var i=0; i<tl.length; i++) {
 		if (tl[i].hours) {
 			total_hr += tl[i].hours;
 			total_billing_amount += tl[i].billing_amount;
+			total_costing_amount += tl[i].costing_amount;
 		}
 	}
 
 	cur_frm.set_value("total_hours", total_hr);
 	cur_frm.set_value("total_billing_amount", total_billing_amount);
+	cur_frm.set_value("total_costing_amount", total_costing_amount);
 }
\ No newline at end of file
diff --git a/erpnext/projects/doctype/timesheet/timesheet.json b/erpnext/projects/doctype/timesheet/timesheet.json
index a15522b..c035cd3 100644
--- a/erpnext/projects/doctype/timesheet/timesheet.json
+++ b/erpnext/projects/doctype/timesheet/timesheet.json
@@ -157,7 +157,7 @@
    "no_copy": 1, 
    "options": "Draft\nSubmitted\nBilled\nPayslip\nCompleted\nCancelled", 
    "permlevel": 0, 
-   "print_hide": 0, 
+   "print_hide": 1, 
    "print_hide_if_no_value": 0, 
    "read_only": 1, 
    "report_hide": 0, 
@@ -478,7 +478,7 @@
    "bold": 0, 
    "collapsible": 0, 
    "default": "0", 
-   "description": "updated via Time Logs", 
+   "description": "", 
    "fieldname": "total_hours", 
    "fieldtype": "Float", 
    "hidden": 0, 
@@ -529,7 +529,7 @@
    "collapsible": 0, 
    "default": "0", 
    "depends_on": "", 
-   "description": "updated via Time Logs", 
+   "description": "", 
    "fieldname": "total_billing_amount", 
    "fieldtype": "Float", 
    "hidden": 0, 
@@ -555,6 +555,31 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "fieldname": "total_costing_amount", 
+   "fieldtype": "Float", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "label": "Total Costing Amount", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 1, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
    "fieldname": "section_break_18", 
    "fieldtype": "Section Break", 
    "hidden": 0, 
@@ -637,7 +662,7 @@
  "issingle": 0, 
  "istable": 0, 
  "max_attachments": 0, 
- "modified": "2016-07-13 23:44:05.086570", 
+ "modified": "2016-07-26 00:01:56.055046", 
  "modified_by": "Administrator", 
  "module": "Projects", 
  "name": "Timesheet", 
diff --git a/erpnext/projects/doctype/timesheet/timesheet.py b/erpnext/projects/doctype/timesheet/timesheet.py
index e882346..895ace3 100644
--- a/erpnext/projects/doctype/timesheet/timesheet.py
+++ b/erpnext/projects/doctype/timesheet/timesheet.py
@@ -20,14 +20,21 @@
 class Timesheet(Document):
 	def validate(self):
 		self.set_status()
-		self.total_hours = 0.0
-		self.total_billing_amount = 0.0
 		self.validate_dates()
 		self.validate_time_logs()
 		self.update_cost()
+		self.calculate_total_amounts()
+
+	def calculate_total_amounts(self):
+		self.total_hours = 0.0
+		self.total_billing_amount = 0.0
+		self.total_costing_amount = 0.0
+
 		for d in self.get("time_logs"):
 			self.total_hours += flt(d.hours)
-			if d.billable: self.total_billing_amount += flt(d.billing_amount)
+			if d.billable: 
+				self.total_billing_amount += flt(d.billing_amount)
+				self.total_costing_amount += flt(d.costing_amount)
 
 	def set_status(self):
 		self.status = {
@@ -88,7 +95,7 @@
 				frappe.throw(_("Row {0}: Completed Qty must be greater than zero.").format(data.idx))
 
 			if self.production_order and flt(pending_qty) < flt(data.completed_qty):
-				frappe.throw(_("Row {0}: Completed Qty cannot be more than {0} for operation {1}").format(data.idx, pending_qty, self.operation),
+				frappe.throw(_("Row {0}: Completed Qty cannot be more than {1} for operation {2}").format(data.idx, pending_qty, data.operation),
 					OverProductionLoggedError)
 
 	def update_production_order(self, time_sheet):
@@ -220,7 +227,7 @@
 
 	def update_cost(self):
 		for data in self.time_logs:
-			if data.activity_type and not data.billing_amount:
+			if data.activity_type and (not data.billing_amount or not data.costing_amount):
 				rate = get_activity_cost(self.employee, data.activity_type)
 				hours =  data.hours or 0
 				if rate:
diff --git a/erpnext/projects/doctype/timesheet_detail/timesheet_detail.json b/erpnext/projects/doctype/timesheet_detail/timesheet_detail.json
index 9413629..7604ded 100644
--- a/erpnext/projects/doctype/timesheet_detail/timesheet_detail.json
+++ b/erpnext/projects/doctype/timesheet_detail/timesheet_detail.json
@@ -14,7 +14,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
-   "depends_on": "eval:!parent.production_order", 
+   "depends_on": "", 
    "fieldname": "billable", 
    "fieldtype": "Check", 
    "hidden": 0, 
@@ -27,7 +27,7 @@
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
-   "print_hide": 0, 
+   "print_hide": 1, 
    "print_hide_if_no_value": 0, 
    "read_only": 0, 
    "report_hide": 0, 
@@ -163,7 +163,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
-   "depends_on": "eval:!parent.production_order", 
+   "depends_on": "billable", 
    "fieldname": "section_break_11", 
    "fieldtype": "Section Break", 
    "hidden": 0, 
@@ -265,7 +265,7 @@
    "collapsible": 0, 
    "default": "0", 
    "depends_on": "", 
-   "description": "To display value check Billable", 
+   "description": "", 
    "fieldname": "billing_amount", 
    "fieldtype": "Currency", 
    "hidden": 0, 
@@ -292,7 +292,7 @@
    "bold": 0, 
    "collapsible": 0, 
    "default": "0", 
-   "description": "To display value check Billable", 
+   "description": "", 
    "fieldname": "costing_amount", 
    "fieldtype": "Currency", 
    "hidden": 0, 
@@ -532,7 +532,7 @@
  "issingle": 0, 
  "istable": 1, 
  "max_attachments": 0, 
- "modified": "2016-07-21 09:59:01.622745", 
+ "modified": "2016-07-26 00:07:58.267131", 
  "modified_by": "Administrator", 
  "module": "Projects", 
  "name": "Timesheet Detail", 
diff --git a/erpnext/schools/doctype/course/test_records.json b/erpnext/schools/doctype/course/test_records.json
index 5dc981a..ec57dc7 100644
--- a/erpnext/schools/doctype/course/test_records.json
+++ b/erpnext/schools/doctype/course/test_records.json
@@ -1,14 +1,17 @@
 [
 	{
 		"course_name": "_Test Course",
-		"course_code": "TC100"
+		"course_code": "TC100",
+		"course_abbreviation": "TC"
 	},
 	{
 		"course_name": "_Test Course 1",
-		"course_code": "TC101"
+		"course_code": "TC101",
+		"course_abbreviation": "TC1"
 	},
 	{
 		"course_name": "_Test Course 2",
-		"course_code": "TC102"
+		"course_code": "TC102",
+		"course_abbreviation": "TC2"
 	}
 ]
\ No newline at end of file
diff --git a/erpnext/schools/doctype/course_schedule/test_course_schedule.py b/erpnext/schools/doctype/course_schedule/test_course_schedule.py
index f5e17f2..b527303 100644
--- a/erpnext/schools/doctype/course_schedule/test_course_schedule.py
+++ b/erpnext/schools/doctype/course_schedule/test_course_schedule.py
@@ -24,27 +24,27 @@
 		cs1 = make_course_schedule_test_record(simulate= True)
 		
 		cs2 = make_course_schedule_test_record(from_time= cs1.from_time, to_time= cs1.to_time, 
-			student_group="_Test Student Group 1", room="RM0002", do_not_save= 1)
+			student_group="TC2-TP-2014-2015-_Test Academic Term", room="RM0002", do_not_save= 1)
 		self.assertRaises(OverlapError, cs2.save)
 
 	def test_room_conflict(self):
 		cs1 = make_course_schedule_test_record(simulate= True)
 		
 		cs2 = make_course_schedule_test_record(from_time= cs1.from_time, to_time= cs1.to_time, 
-			student_group="_Test Student Group 1", instructor="_T-Instructor-00002", do_not_save= 1)
+			student_group="TC2-TP-2014-2015-_Test Academic Term", instructor="_T-Instructor-00002", do_not_save= 1)
 		self.assertRaises(OverlapError, cs2.save)
 		
 	def test_no_conflict(self):
 		cs1 = make_course_schedule_test_record(simulate= True)
 		
 		make_course_schedule_test_record(from_time= cs1.from_time, to_time= cs1.to_time, 
-			student_group="_Test Student Group 1", instructor="_T-Instructor-00002", room="RM0002")
+			student_group="TC2-TP-2014-2015-_Test Academic Term", instructor="_T-Instructor-00002", room="RM0002")
 
 def make_course_schedule_test_record(**args):
 	args = frappe._dict(args)
 
 	course_schedule = frappe.new_doc("Course Schedule")
-	course_schedule.student_group = args.student_group or "_Test Student Group"
+	course_schedule.student_group = args.student_group or "TC-TP-2014-2015-_Test Academic Term"
 	course_schedule.course = args.course or "_Test Course"
 	course_schedule.instructor = args.instructor or "_T-Instructor-00001"
 	course_schedule.room = args.room or "RM0001"
diff --git a/erpnext/schools/doctype/examination/examination.json b/erpnext/schools/doctype/examination/examination.json
index 1bec29b..2a76d1d 100644
--- a/erpnext/schools/doctype/examination/examination.json
+++ b/erpnext/schools/doctype/examination/examination.json
@@ -1,6 +1,6 @@
 {
  "allow_copy": 0, 
- "allow_import": 0, 
+ "allow_import": 1, 
  "allow_rename": 0, 
  "autoname": "field:exam_name", 
  "beta": 0, 
@@ -480,7 +480,7 @@
  "istable": 0, 
  "max_attachments": 0, 
  "menu_index": 0, 
- "modified": "2016-07-25 01:26:26.776581", 
+ "modified": "2016-07-25 06:24:11.126911", 
  "modified_by": "Administrator", 
  "module": "Schools", 
  "name": "Examination", 
diff --git a/erpnext/schools/doctype/fee_category/fee_category.json b/erpnext/schools/doctype/fee_category/fee_category.json
index 0224629..4314aae 100644
--- a/erpnext/schools/doctype/fee_category/fee_category.json
+++ b/erpnext/schools/doctype/fee_category/fee_category.json
@@ -79,7 +79,7 @@
  "istable": 0, 
  "max_attachments": 0, 
  "menu_index": 0, 
- "modified": "2016-07-25 05:24:22.972715", 
+ "modified": "2016-07-25 08:42:24.309236", 
  "modified_by": "Administrator", 
  "module": "Schools", 
  "name": "Fee Category", 
diff --git a/erpnext/schools/doctype/fee_amount/__init__.py b/erpnext/schools/doctype/fee_component/__init__.py
similarity index 100%
rename from erpnext/schools/doctype/fee_amount/__init__.py
rename to erpnext/schools/doctype/fee_component/__init__.py
diff --git a/erpnext/schools/doctype/fee_amount/fee_amount.json b/erpnext/schools/doctype/fee_component/fee_component.json
similarity index 95%
rename from erpnext/schools/doctype/fee_amount/fee_amount.json
rename to erpnext/schools/doctype/fee_component/fee_component.json
index 942b6ef..c0f7bd6 100644
--- a/erpnext/schools/doctype/fee_amount/fee_amount.json
+++ b/erpnext/schools/doctype/fee_component/fee_component.json
@@ -104,10 +104,10 @@
  "issingle": 0, 
  "istable": 1, 
  "max_attachments": 0, 
- "modified": "2016-07-21 12:25:44.368245", 
- "modified_by": "r@r.com", 
+ "modified": "2016-07-25 08:43:25.405166", 
+ "modified_by": "Administrator", 
  "module": "Schools", 
- "name": "Fee Amount", 
+ "name": "Fee Component", 
  "name_case": "", 
  "owner": "Administrator", 
  "permissions": [], 
diff --git a/erpnext/schools/doctype/fee_amount/fee_amount.py b/erpnext/schools/doctype/fee_component/fee_component.py
similarity index 64%
rename from erpnext/schools/doctype/fee_amount/fee_amount.py
rename to erpnext/schools/doctype/fee_component/fee_component.py
index a26e1d9..8694610 100644
--- a/erpnext/schools/doctype/fee_amount/fee_amount.py
+++ b/erpnext/schools/doctype/fee_component/fee_component.py
@@ -1,10 +1,10 @@
 # -*- coding: utf-8 -*-
-# Copyright (c) 2015, Frappe Technologies and contributors
+# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and contributors
 # For license information, please see license.txt
 
 from __future__ import unicode_literals
 import frappe
 from frappe.model.document import Document
 
-class FeeAmount(Document):
+class FeeComponent(Document):
 	pass
diff --git a/erpnext/schools/doctype/fee_structure/fee_structure.json b/erpnext/schools/doctype/fee_structure/fee_structure.json
index 51e48d2..d6c5a7f 100644
--- a/erpnext/schools/doctype/fee_structure/fee_structure.json
+++ b/erpnext/schools/doctype/fee_structure/fee_structure.json
@@ -146,17 +146,17 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
-   "fieldname": "amount", 
+   "fieldname": "components", 
    "fieldtype": "Table", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
-   "label": "Amount", 
+   "label": "Components", 
    "length": 0, 
    "no_copy": 0, 
-   "options": "Fee Amount", 
+   "options": "Fee Component", 
    "permlevel": 0, 
    "precision": "", 
    "print_hide": 0, 
@@ -230,7 +230,7 @@
  "istable": 0, 
  "max_attachments": 0, 
  "menu_index": 0, 
- "modified": "2016-07-25 01:25:22.796777", 
+ "modified": "2016-07-25 08:44:07.886467", 
  "modified_by": "Administrator", 
  "module": "Schools", 
  "name": "Fee Structure", 
diff --git a/erpnext/schools/doctype/fees/fees.json b/erpnext/schools/doctype/fees/fees.json
index 49ab8b9..75e3315 100644
--- a/erpnext/schools/doctype/fees/fees.json
+++ b/erpnext/schools/doctype/fees/fees.json
@@ -295,17 +295,17 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
-   "fieldname": "amount", 
+   "fieldname": "components", 
    "fieldtype": "Table", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
-   "label": "Amount", 
+   "label": "Components", 
    "length": 0, 
    "no_copy": 0, 
-   "options": "Fee Amount", 
+   "options": "Fee Component", 
    "permlevel": 0, 
    "precision": "", 
    "print_hide": 0, 
@@ -478,7 +478,7 @@
  "istable": 0, 
  "max_attachments": 0, 
  "menu_index": 0, 
- "modified": "2016-07-25 01:27:43.220809", 
+ "modified": "2016-07-25 08:44:33.595812", 
  "modified_by": "Administrator", 
  "module": "Schools", 
  "name": "Fees", 
diff --git a/erpnext/schools/doctype/program/test_records.json b/erpnext/schools/doctype/program/test_records.json
index c0f8231..b2374d6 100644
--- a/erpnext/schools/doctype/program/test_records.json
+++ b/erpnext/schools/doctype/program/test_records.json
@@ -1,8 +1,10 @@
 [
 	{
-		"program_name": "_Test Program"
+		"program_name": "_Test Program",
+		"program_abbreviation": "TP"
 	},
 	{
-		"program_name": "_Test Program 2"
+		"program_name": "_Test Program 2",
+		"program_abbreviation": "TP2"
 	}
 ]
diff --git a/erpnext/schools/doctype/student/student.json b/erpnext/schools/doctype/student/student.json
index 7eda577..4901dc4 100644
--- a/erpnext/schools/doctype/student/student.json
+++ b/erpnext/schools/doctype/student/student.json
@@ -556,7 +556,7 @@
  "istable": 0, 
  "max_attachments": 0, 
  "menu_index": 0, 
- "modified": "2016-07-25 01:27:04.145185", 
+ "modified": "2016-07-25 06:23:57.581538", 
  "modified_by": "Administrator", 
  "module": "Schools", 
  "name": "Student", 
diff --git a/erpnext/schools/doctype/student_batch/student_batch.py b/erpnext/schools/doctype/student_batch/student_batch.py
index 7c7568d..107ef93 100644
--- a/erpnext/schools/doctype/student_batch/student_batch.py
+++ b/erpnext/schools/doctype/student_batch/student_batch.py
@@ -8,9 +8,12 @@
 import frappe
 
 class StudentBatch(Document):
-	def validate(self):
-		validate_duplicate_student(self.students)
+	def autoname(self):
 		prog_abb = frappe.db.get_value("Program", self.program, "program_abbreviation")
 		if not prog_abb:
 			prog_abb = self.program
-		self.name = prog_abb + "-"+ self.student_batch_name + "-" + self.academic_year
\ No newline at end of file
+		self.name = prog_abb + "-"+ self.student_batch_name + "-" + self.academic_year
+	
+	def validate(self):
+		validate_duplicate_student(self.students)
+		
\ No newline at end of file
diff --git a/erpnext/schools/doctype/student_group/student_group.json b/erpnext/schools/doctype/student_group/student_group.json
index 3d15e25..e4b4ea3 100644
--- a/erpnext/schools/doctype/student_group/student_group.json
+++ b/erpnext/schools/doctype/student_group/student_group.json
@@ -1,7 +1,7 @@
 {
  "allow_copy": 0, 
- "allow_import": 0, 
- "allow_rename": 0, 
+ "allow_import": 1, 
+ "allow_rename": 1, 
  "autoname": "", 
  "beta": 0, 
  "creation": "2015-09-07 12:55:52.072792", 
@@ -280,7 +280,7 @@
  "istable": 0, 
  "max_attachments": 0, 
  "menu_index": 0, 
- "modified": "2016-07-25 01:32:57.819189", 
+ "modified": "2016-07-25 06:23:43.903111", 
  "modified_by": "Administrator", 
  "module": "Schools", 
  "name": "Student Group", 
diff --git a/erpnext/schools/doctype/student_group/student_group.py b/erpnext/schools/doctype/student_group/student_group.py
index 3cd9bfb..f604773 100644
--- a/erpnext/schools/doctype/student_group/student_group.py
+++ b/erpnext/schools/doctype/student_group/student_group.py
@@ -9,13 +9,7 @@
 from erpnext.schools.utils import validate_duplicate_student
 
 class StudentGroup(Document):
-	def validate(self):
-		self.set_name()
-		self.validate_strength()
-		self.validate_student_name()
-		validate_duplicate_student(self.students)
-	
-	def set_name(self):
+	def autoname(self):
 		self.name = frappe.db.get_value("Course", self.course, "course_abbreviation")
 		if not self.name:
 			self.name = self.course
@@ -31,6 +25,11 @@
 				self.name += "-" + self.academic_year
 		if self.academic_term:
 			self.name += "-" + self.academic_term
+	
+	def validate(self):
+		self.validate_strength()
+		self.validate_student_name()
+		validate_duplicate_student(self.students)
 
 	def validate_strength(self):
 		if self.max_strength and len(self.students) > self.max_strength:
diff --git a/erpnext/schools/doctype/student_group/test_records.json b/erpnext/schools/doctype/student_group/test_records.json
index 23186ca..a14f670 100644
--- a/erpnext/schools/doctype/student_group/test_records.json
+++ b/erpnext/schools/doctype/student_group/test_records.json
@@ -1,13 +1,11 @@
 [
 	{
-		"group_name": "_Test Student Group",
 		"program": "_Test Program",
 		"course": "_Test Course",
 		"academic_year": "2014-2015",
 		"academic_term": "_Test Academic Term"
 	},
 	{
-		"group_name": "_Test Student Group 1",
 		"program": "_Test Program",
 		"course": "_Test Course 2",
 		"academic_year": "2014-2015",
diff --git a/erpnext/schools/doctype/student_group_creation_tool/student_group_creation_tool.json b/erpnext/schools/doctype/student_group_creation_tool/student_group_creation_tool.json
index 3291d83..dd011c3 100644
--- a/erpnext/schools/doctype/student_group_creation_tool/student_group_creation_tool.json
+++ b/erpnext/schools/doctype/student_group_creation_tool/student_group_creation_tool.json
@@ -176,7 +176,7 @@
    "label": "Courses", 
    "length": 0, 
    "no_copy": 0, 
-   "options": "SG Creation Tool Course", 
+   "options": "Student Group Creation Tool Course", 
    "permlevel": 0, 
    "precision": "", 
    "print_hide": 0, 
@@ -199,7 +199,7 @@
  "issingle": 1, 
  "istable": 0, 
  "max_attachments": 0, 
- "modified": "2016-07-25 01:23:31.192112", 
+ "modified": "2016-07-25 06:40:46.107131", 
  "modified_by": "Administrator", 
  "module": "Schools", 
  "name": "Student Group Creation Tool", 
diff --git a/erpnext/schools/doctype/sg_creation_tool_course/__init__.py b/erpnext/schools/doctype/student_group_creation_tool_course/__init__.py
similarity index 100%
rename from erpnext/schools/doctype/sg_creation_tool_course/__init__.py
rename to erpnext/schools/doctype/student_group_creation_tool_course/__init__.py
diff --git a/erpnext/schools/doctype/sg_creation_tool_course/sg_creation_tool_course.json b/erpnext/schools/doctype/student_group_creation_tool_course/student_group_creation_tool_course.json
similarity index 95%
rename from erpnext/schools/doctype/sg_creation_tool_course/sg_creation_tool_course.json
rename to erpnext/schools/doctype/student_group_creation_tool_course/student_group_creation_tool_course.json
index 8814f88..88466b6 100644
--- a/erpnext/schools/doctype/sg_creation_tool_course/sg_creation_tool_course.json
+++ b/erpnext/schools/doctype/student_group_creation_tool_course/student_group_creation_tool_course.json
@@ -147,10 +147,10 @@
  "issingle": 0, 
  "istable": 1, 
  "max_attachments": 0, 
- "modified": "2016-07-21 12:31:41.252860", 
- "modified_by": "r@r.com", 
+ "modified": "2016-07-25 06:40:49.000588", 
+ "modified_by": "Administrator", 
  "module": "Schools", 
- "name": "SG Creation Tool Course", 
+ "name": "Student Group Creation Tool Course", 
  "name_case": "", 
  "owner": "Administrator", 
  "permissions": [], 
diff --git a/erpnext/schools/doctype/sg_creation_tool_course/sg_creation_tool_course.py b/erpnext/schools/doctype/student_group_creation_tool_course/student_group_creation_tool_course.py
similarity index 60%
rename from erpnext/schools/doctype/sg_creation_tool_course/sg_creation_tool_course.py
rename to erpnext/schools/doctype/student_group_creation_tool_course/student_group_creation_tool_course.py
index 4024c69..b3411ea 100644
--- a/erpnext/schools/doctype/sg_creation_tool_course/sg_creation_tool_course.py
+++ b/erpnext/schools/doctype/student_group_creation_tool_course/student_group_creation_tool_course.py
@@ -1,10 +1,10 @@
 # -*- coding: utf-8 -*-
-# Copyright (c) 2015, Frappe and contributors
+# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and contributors
 # For license information, please see license.txt
 
 from __future__ import unicode_literals
 import frappe
 from frappe.model.document import Document
 
-class SGCreationToolCourse(Document):
+class StudentGroupCreationToolCourse(Document):
 	pass
diff --git a/erpnext/setup/doctype/company/company.py b/erpnext/setup/doctype/company/company.py
index 65fb420..00538cd 100644
--- a/erpnext/setup/doctype/company/company.py
+++ b/erpnext/setup/doctype/company/company.py
@@ -32,6 +32,9 @@
 		self.validate_currency()
 
 	def validate_abbr(self):
+		if not self.abbr:
+			self.abbr = ''.join([c[0] for c in self.company_name.split()]).upper()
+
 		self.abbr = self.abbr.strip()
 
 		if self.get('__islocal') and len(self.abbr) > 5:
@@ -66,7 +69,7 @@
 			if not frappe.local.flags.ignore_chart_of_accounts:
 				self.create_default_accounts()
 				self.create_default_warehouses()
-			
+
 				self.install_country_fixtures()
 
 		if not frappe.db.get_value("Cost Center", {"is_group": 0, "company": self.name}):
@@ -92,7 +95,7 @@
 			{"warehouse_name": _("Stores"), "is_group": 0},
 			{"warehouse_name": _("Work In Progress"), "is_group": 0},
 			{"warehouse_name": _("Finished Goods"), "is_group": 0}]:
-			
+
 			if not frappe.db.exists("Warehouse", "{0} - {1}".format(wh_detail["warehouse_name"], self.abbr)):
 				stock_group = frappe.db.get_value("Account", {"account_type": "Stock",
 					"is_group": 1, "company": self.name})
@@ -203,9 +206,9 @@
 		rec = frappe.db.sql("SELECT name from `tabGL Entry` where company = %s", self.name)
 		if not rec:
 			frappe.db.sql("""delete from `tabBudget Account`
-				where exists(select name from tabBudget 
+				where exists(select name from tabBudget
 					where name=`tabBudget Account`.parent and company = %s)""", self.name)
-			
+
 			for doctype in ["Account", "Cost Center", "Budget", "Party Account"]:
 				frappe.db.sql("delete from `tab{0}` where company = %s".format(doctype), self.name)