more refactoring to renaming
diff --git a/accounts/doctype/cost_center/cost_center.py b/accounts/doctype/cost_center/cost_center.py
index 59e5a0c..f0fc6fd 100644
--- a/accounts/doctype/cost_center/cost_center.py
+++ b/accounts/doctype/cost_center/cost_center.py
@@ -90,3 +90,17 @@
 			
 		self.validate_mandatory()
 		self.validate_budget_details()
+		
+	def on_rename(self, new, old):
+		company_abbr = webnotes.conn.get_value("Company", self.doc.company_name, "abbr")		
+		parts = new.split(" - ")	
+
+		if parts[-1].lower() != company_abbr.lower():
+			parts.append(company_abbr)
+
+		# rename account name
+		cost_center_name = " - ".join(parts[:-1])
+		webnotes.conn.sql("update `tabCost Center` set cost_center_name = %s where name = %s", \
+			(cost_center_name, old))
+
+		return " - ".join(parts)	
diff --git a/accounts/doctype/cost_center/cost_center.txt b/accounts/doctype/cost_center/cost_center.txt
index df65584..ecb3ad6 100644
--- a/accounts/doctype/cost_center/cost_center.txt
+++ b/accounts/doctype/cost_center/cost_center.txt
@@ -1,319 +1,262 @@
-# DocType, Cost Center
 [
-
-	# These values are common in all dictionaries
-	{
-		'creation': '2012-07-03 13:30:47',
-		'docstatus': 0,
-		'modified': '2012-07-11 14:41:39',
-		'modified_by': u'Administrator',
-		'owner': u'Administrator'
-	},
-
-	# These values are common for all DocType
-	{
-		'_last_update': u'1317365120',
-		'allow_copy': 1,
-		'allow_trash': 1,
-		'autoname': u'field:cost_center_name',
-		'colour': u'White:FFF',
-		'default_print_format': u'Standard',
-		'description': u'**Chart of Accounts** is mainly for reporting information for governmental purposes and less for how business actually performs. \n\nMost businesses have multiple activities like different product lines, market segments, areas of business that share some common overheads but should ideally have their own structure to report whether they are profitable or not. For this purpose, there is an alternate structure, called the **Cost Centers**.\n\nA tree of **Cost Centers** to cab be designed to reflect the different units of an organization. Each Income / Expense entry is also tagged against a **Cost Center** and hence you can get Profit and Loss against a **Cost Center** too.\n\n### Budgeting\n\n**Cost Centers** can be used for budgeting purposes too. A budget can be set against each **Account** and the system will either stop, warn or ignore the budget based on the settings in the **Company** master.\n\nBudgets can also be distributed seasonally using **Budget Distribution**.',
-		'doctype': 'DocType',
-		'document_type': u'Master',
-		'in_create': 1,
-		'module': u'Accounts',
-		'name': '__common__',
-		'search_fields': u'name,parent_cost_center',
-		'section_style': u'Simple',
-		'server_code_error': u' ',
-		'show_in_menu': 0,
-		'version': 1
-	},
-
-	# These values are common for all DocField
-	{
-		'doctype': u'DocField',
-		'name': '__common__',
-		'parent': u'Cost Center',
-		'parentfield': u'fields',
-		'parenttype': u'DocType'
-	},
-
-	# These values are common for all DocPerm
-	{
-		'doctype': u'DocPerm',
-		'name': '__common__',
-		'parent': u'Cost Center',
-		'parentfield': u'permissions',
-		'parenttype': u'DocType',
-		'read': 1
-	},
-
-	# DocType, Cost Center
-	{
-		'doctype': 'DocType',
-		'name': u'Cost Center'
-	},
-
-	# DocPerm
-	{
-		'amend': 0,
-		'cancel': 0,
-		'create': 0,
-		'doctype': u'DocPerm',
-		'permlevel': 1,
-		'role': u'Accounts Manager',
-		'submit': 0,
-		'write': 0
-	},
-
-	# DocPerm
-	{
-		'amend': 0,
-		'cancel': 1,
-		'create': 1,
-		'doctype': u'DocPerm',
-		'permlevel': 0,
-		'role': u'Accounts Manager',
-		'submit': 0,
-		'write': 1
-	},
-
-	# DocPerm
-	{
-		'amend': 0,
-		'cancel': 0,
-		'create': 0,
-		'doctype': u'DocPerm',
-		'permlevel': 1,
-		'role': u'Accounts User',
-		'submit': 0,
-		'write': 0
-	},
-
-	# DocPerm
-	{
-		'amend': 0,
-		'cancel': 0,
-		'create': 0,
-		'doctype': u'DocPerm',
-		'permlevel': 0,
-		'role': u'Accounts User',
-		'submit': 0,
-		'write': 0
-	},
-
-	# DocPerm
-	{
-		'cancel': 1,
-		'create': 1,
-		'doctype': u'DocPerm',
-		'permlevel': 0,
-		'role': u'System Manager',
-		'write': 1
-	},
-
-	# DocPerm
-	{
-		'doctype': u'DocPerm',
-		'permlevel': 1,
-		'role': u'All'
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'sb0',
-		'fieldtype': u'Section Break',
-		'label': u'Cost Center Details',
-		'permlevel': 0
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'trash_reason',
-		'fieldtype': u'Small Text',
-		'label': u'Trash Reason',
-		'oldfieldname': u'trash_reason',
-		'oldfieldtype': u'Small Text',
-		'permlevel': 1
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'cost_center_name',
-		'fieldtype': u'Data',
-		'in_filter': 0,
-		'label': u'Cost Center Name',
-		'no_copy': 1,
-		'oldfieldname': u'cost_center_name',
-		'oldfieldtype': u'Data',
-		'permlevel': 0,
-		'reqd': 1,
-		'search_index': 0
-	},
-
-	# DocField
-	{
-		'colour': u'White:FFF',
-		'doctype': u'DocField',
-		'fieldname': u'parent_cost_center',
-		'fieldtype': u'Link',
-		'label': u'Parent Cost Center',
-		'oldfieldname': u'parent_cost_center',
-		'oldfieldtype': u'Link',
-		'options': u'Cost Center',
-		'permlevel': 0,
-		'reqd': 1,
-		'trigger': u'Client'
-	},
-
-	# DocField
-	{
-		'colour': u'White:FFF',
-		'doctype': u'DocField',
-		'fieldname': u'company_name',
-		'fieldtype': u'Link',
-		'label': u'Company',
-		'oldfieldname': u'company_name',
-		'oldfieldtype': u'Link',
-		'options': u'Company',
-		'permlevel': 0,
-		'reqd': 1,
-		'trigger': u'Client'
-	},
-
-	# DocField
-	{
-		'colour': u'White:FFF',
-		'doctype': u'DocField',
-		'fieldname': u'company_abbr',
-		'fieldtype': u'Data',
-		'hidden': 1,
-		'label': u'Company Abbr',
-		'oldfieldname': u'company_abbr',
-		'oldfieldtype': u'Data',
-		'permlevel': 1
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'cb0',
-		'fieldtype': u'Column Break',
-		'permlevel': 0,
-		'width': u'50%'
-	},
-
-	# DocField
-	{
-		'colour': u'White:FFF',
-		'doctype': u'DocField',
-		'fieldname': u'group_or_ledger',
-		'fieldtype': u'Select',
-		'hidden': 0,
-		'label': u'Group or Ledger',
-		'no_copy': 1,
-		'oldfieldname': u'group_or_ledger',
-		'oldfieldtype': u'Select',
-		'options': u'\nGroup\nLedger',
-		'permlevel': 0,
-		'print_hide': 1,
-		'report_hide': 1,
-		'reqd': 1,
-		'trigger': u'Client'
-	},
-
-	# DocField
-	{
-		'colour': u'White:FFF',
-		'description': u'Define Budget for this Cost Center. To set budget action, see <a href="#!List/Company">Company Master</a>',
-		'doctype': u'DocField',
-		'fieldname': u'sb1',
-		'fieldtype': u'Section Break',
-		'label': u'Budget',
-		'permlevel': 0
-	},
-
-	# DocField
-	{
-		'colour': u'White:FFF',
-		'description': u'Select Budget Distribution, if you want to track based on seasonality.',
-		'doctype': u'DocField',
-		'fieldname': u'distribution_id',
-		'fieldtype': u'Link',
-		'label': u'Distribution Id',
-		'oldfieldname': u'distribution_id',
-		'oldfieldtype': u'Link',
-		'options': u'Budget Distribution',
-		'permlevel': 0
-	},
-
-	# DocField
-	{
-		'colour': u'White:FFF',
-		'description': u'Add rows to set annual budgets on Accounts.',
-		'doctype': u'DocField',
-		'fieldname': u'budget_details',
-		'fieldtype': u'Table',
-		'label': u'Budget Details',
-		'oldfieldname': u'budget_details',
-		'oldfieldtype': u'Table',
-		'options': u'Budget Detail',
-		'permlevel': 0
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'lft',
-		'fieldtype': u'Int',
-		'hidden': 1,
-		'in_filter': 1,
-		'label': u'lft',
-		'no_copy': 1,
-		'oldfieldname': u'lft',
-		'oldfieldtype': u'Int',
-		'permlevel': 0,
-		'print_hide': 1,
-		'report_hide': 1,
-		'search_index': 1
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'rgt',
-		'fieldtype': u'Int',
-		'hidden': 1,
-		'in_filter': 1,
-		'label': u'rgt',
-		'no_copy': 1,
-		'oldfieldname': u'rgt',
-		'oldfieldtype': u'Int',
-		'permlevel': 0,
-		'print_hide': 1,
-		'report_hide': 1,
-		'reqd': 0,
-		'search_index': 1
-	},
-
-	# DocField
-	{
-		'doctype': u'DocField',
-		'fieldname': u'old_parent',
-		'fieldtype': u'Link',
-		'hidden': 1,
-		'label': u'old_parent',
-		'no_copy': 1,
-		'oldfieldname': u'old_parent',
-		'oldfieldtype': u'Data',
-		'options': u'Cost Center',
-		'permlevel': 0,
-		'print_hide': 1,
-		'report_hide': 1
-	}
+ {
+  "owner": "Administrator", 
+  "docstatus": 0, 
+  "creation": "2012-07-12 23:29:41", 
+  "modified_by": "Administrator", 
+  "modified": "2012-12-06 12:12:46"
+ }, 
+ {
+  "in_create": 1, 
+  "search_fields": "name,parent_cost_center", 
+  "module": "Accounts", 
+  "document_type": "Master", 
+  "description": "Track separate Income and Expense for product verticals or divisions.", 
+  "autoname": "field:cost_center_name", 
+  "name": "__common__", 
+  "default_print_format": "Standard", 
+  "allow_rename": 1, 
+  "doctype": "DocType", 
+  "allow_copy": 1
+ }, 
+ {
+  "name": "__common__", 
+  "parent": "Cost Center", 
+  "doctype": "DocField", 
+  "parenttype": "DocType", 
+  "parentfield": "fields"
+ }, 
+ {
+  "name": "__common__", 
+  "parent": "Cost Center", 
+  "read": 1, 
+  "doctype": "DocPerm", 
+  "parenttype": "DocType", 
+  "parentfield": "permissions"
+ }, 
+ {
+  "name": "Cost Center", 
+  "doctype": "DocType"
+ }, 
+ {
+  "doctype": "DocField", 
+  "label": "Cost Center Details", 
+  "fieldname": "sb0", 
+  "fieldtype": "Section Break", 
+  "permlevel": 0
+ }, 
+ {
+  "oldfieldtype": "Small Text", 
+  "doctype": "DocField", 
+  "label": "Trash Reason", 
+  "oldfieldname": "trash_reason", 
+  "fieldname": "trash_reason", 
+  "fieldtype": "Small Text", 
+  "permlevel": 1
+ }, 
+ {
+  "no_copy": 1, 
+  "oldfieldtype": "Data", 
+  "doctype": "DocField", 
+  "label": "Cost Center Name", 
+  "oldfieldname": "cost_center_name", 
+  "fieldname": "cost_center_name", 
+  "fieldtype": "Data", 
+  "search_index": 0, 
+  "reqd": 1, 
+  "permlevel": 0, 
+  "in_filter": 0
+ }, 
+ {
+  "oldfieldtype": "Link", 
+  "colour": "White:FFF", 
+  "doctype": "DocField", 
+  "label": "Parent Cost Center", 
+  "oldfieldname": "parent_cost_center", 
+  "trigger": "Client", 
+  "fieldname": "parent_cost_center", 
+  "fieldtype": "Link", 
+  "reqd": 1, 
+  "options": "Cost Center", 
+  "permlevel": 0
+ }, 
+ {
+  "oldfieldtype": "Link", 
+  "colour": "White:FFF", 
+  "doctype": "DocField", 
+  "label": "Company", 
+  "oldfieldname": "company_name", 
+  "trigger": "Client", 
+  "fieldname": "company_name", 
+  "fieldtype": "Link", 
+  "reqd": 1, 
+  "options": "Company", 
+  "permlevel": 0
+ }, 
+ {
+  "oldfieldtype": "Data", 
+  "colour": "White:FFF", 
+  "doctype": "DocField", 
+  "label": "Company Abbr", 
+  "oldfieldname": "company_abbr", 
+  "fieldname": "company_abbr", 
+  "fieldtype": "Data", 
+  "hidden": 1, 
+  "permlevel": 1
+ }, 
+ {
+  "doctype": "DocField", 
+  "width": "50%", 
+  "fieldname": "cb0", 
+  "fieldtype": "Column Break", 
+  "permlevel": 0
+ }, 
+ {
+  "print_hide": 1, 
+  "no_copy": 1, 
+  "oldfieldtype": "Select", 
+  "colour": "White:FFF", 
+  "doctype": "DocField", 
+  "label": "Group or Ledger", 
+  "oldfieldname": "group_or_ledger", 
+  "permlevel": 0, 
+  "trigger": "Client", 
+  "fieldname": "group_or_ledger", 
+  "fieldtype": "Select", 
+  "reqd": 1, 
+  "hidden": 0, 
+  "options": "\nGroup\nLedger", 
+  "report_hide": 1
+ }, 
+ {
+  "description": "Define Budget for this Cost Center. To set budget action, see <a href=\"#!List/Company\">Company Master</a>", 
+  "colour": "White:FFF", 
+  "doctype": "DocField", 
+  "label": "Budget", 
+  "fieldname": "sb1", 
+  "fieldtype": "Section Break", 
+  "permlevel": 0
+ }, 
+ {
+  "description": "Select Budget Distribution, if you want to track based on seasonality.", 
+  "oldfieldtype": "Link", 
+  "colour": "White:FFF", 
+  "doctype": "DocField", 
+  "label": "Distribution Id", 
+  "oldfieldname": "distribution_id", 
+  "options": "Budget Distribution", 
+  "fieldname": "distribution_id", 
+  "fieldtype": "Link", 
+  "permlevel": 0
+ }, 
+ {
+  "description": "Add rows to set annual budgets on Accounts.", 
+  "oldfieldtype": "Table", 
+  "colour": "White:FFF", 
+  "doctype": "DocField", 
+  "label": "Budget Details", 
+  "oldfieldname": "budget_details", 
+  "options": "Budget Detail", 
+  "fieldname": "budget_details", 
+  "fieldtype": "Table", 
+  "permlevel": 0
+ }, 
+ {
+  "print_hide": 1, 
+  "no_copy": 1, 
+  "oldfieldtype": "Int", 
+  "doctype": "DocField", 
+  "label": "lft", 
+  "oldfieldname": "lft", 
+  "fieldname": "lft", 
+  "fieldtype": "Int", 
+  "search_index": 1, 
+  "hidden": 1, 
+  "permlevel": 0, 
+  "report_hide": 1, 
+  "in_filter": 1
+ }, 
+ {
+  "print_hide": 1, 
+  "no_copy": 1, 
+  "oldfieldtype": "Int", 
+  "doctype": "DocField", 
+  "label": "rgt", 
+  "oldfieldname": "rgt", 
+  "fieldname": "rgt", 
+  "fieldtype": "Int", 
+  "search_index": 1, 
+  "reqd": 0, 
+  "hidden": 1, 
+  "permlevel": 0, 
+  "report_hide": 1, 
+  "in_filter": 1
+ }, 
+ {
+  "print_hide": 1, 
+  "no_copy": 1, 
+  "oldfieldtype": "Data", 
+  "doctype": "DocField", 
+  "label": "old_parent", 
+  "oldfieldname": "old_parent", 
+  "permlevel": 0, 
+  "fieldname": "old_parent", 
+  "fieldtype": "Link", 
+  "hidden": 1, 
+  "options": "Cost Center", 
+  "report_hide": 1
+ }, 
+ {
+  "amend": 0, 
+  "create": 0, 
+  "doctype": "DocPerm", 
+  "submit": 0, 
+  "write": 0, 
+  "role": "Accounts Manager", 
+  "cancel": 0, 
+  "permlevel": 1
+ }, 
+ {
+  "amend": 0, 
+  "create": 1, 
+  "doctype": "DocPerm", 
+  "submit": 0, 
+  "write": 1, 
+  "role": "Accounts Manager", 
+  "cancel": 1, 
+  "permlevel": 0
+ }, 
+ {
+  "amend": 0, 
+  "create": 0, 
+  "doctype": "DocPerm", 
+  "submit": 0, 
+  "write": 0, 
+  "role": "Accounts User", 
+  "cancel": 0, 
+  "permlevel": 1
+ }, 
+ {
+  "amend": 0, 
+  "create": 0, 
+  "doctype": "DocPerm", 
+  "submit": 0, 
+  "write": 0, 
+  "role": "Accounts User", 
+  "cancel": 0, 
+  "permlevel": 0
+ }, 
+ {
+  "create": 1, 
+  "doctype": "DocPerm", 
+  "write": 1, 
+  "role": "System Manager", 
+  "cancel": 1, 
+  "permlevel": 0
+ }, 
+ {
+  "doctype": "DocPerm", 
+  "role": "All", 
+  "permlevel": 1
+ }
 ]
\ No newline at end of file
diff --git a/home/page/latest_updates/latest_updates.js b/home/page/latest_updates/latest_updates.js
index d3bde12..070f34a 100644
--- a/home/page/latest_updates/latest_updates.js
+++ b/home/page/latest_updates/latest_updates.js
@@ -1,10 +1,13 @@
 erpnext.updates = [
+	["6th December 2012", [
+		"Rename: Cost Center, Item Group, Customer Group, Supplier Type, Territory, Sales Person can now be renamed.",
+	]],
 	["5th December 2012", [
 		"Leave Application: Now can set approver.",
 		"New Roles Added: Leave Approver and Expense Approver.",
-		"Production Order is now linked with sales order.",
+		"Production Order: Now linked with Sales Order.",
 		"Production Planning Tool: The field 'Allow SA items as raw material' has been renamed to 'Use multi-level BOM', 'Include in plan' column from SO table has been deleted",
-		"Batch nos are now filtered with item and available qty",
+		"Batch Numbers: Batch nos are now filtered with Item and available qty at time of selection in transactions.",
 		"BOM: 'Update Costing' button has been deleted, once submitted cost are fixed.",
 		"[For indian customer only] Deprecated TDS related documents and fields. Old TDS amount added into tax table in Purchase Invoice and entries table in case of JV",
 	]],