Merge branch 'master' of github.com:webnotes/erpnext
diff --git a/erpnext/setup/doctype/company/company.py b/erpnext/setup/doctype/company/company.py
index 38c689e..cfa32bb 100644
--- a/erpnext/setup/doctype/company/company.py
+++ b/erpnext/setup/doctype/company/company.py
@@ -37,6 +37,11 @@
 class DocType:
 	def __init__(self,d,dl):
 		self.doc, self.doclist = d,dl
+		
+	def validate(self):
+		if self.doc.__islocal and len(self.doc.abbr) > 5:
+			webnotes.msgprint("Abbreviation cannot have more than 5 characters",
+				raise_exception=1)
 	
 	# Create default accounts
 	# ---------------------------------------------------
diff --git a/erpnext/stock/doctype/item/item.js b/erpnext/stock/doctype/item/item.js
index 0a255d1..96c0339 100644
--- a/erpnext/stock/doctype/item/item.js
+++ b/erpnext/stock/doctype/item/item.js
@@ -18,6 +18,10 @@
 	// make sensitive fields(has_serial_no, is_stock_item, valuation_method)
 	// read only if any stock ledger entry exists
 
+	if (!doc.__islocal) {
+		set_field_permlevel("item_code", 1);
+	}
+
 	if ((!doc.__islocal) && (doc.is_stock_item == 'Yes')) {
 		var callback = function(r, rt) {
 			if (r.message == 'exists') permlevel = 1;