Moved Notification Count hooks to frappe, employee user id patch, Item ignore restriction fields
diff --git a/erpnext/hooks.txt b/erpnext/hooks.txt
index 8b0ece2..b6969dd 100644
--- a/erpnext/hooks.txt
+++ b/erpnext/hooks.txt
@@ -29,10 +29,6 @@
 bean_event:*:on_submit = erpnext.home.update_feed
 bean_event:Comment:on_update = erpnext.home.make_comment_feed
 
-bean_event:*:on_update = frappe.core.doctype.notification_count.notification_count.clear_doctype_notifications
-bean_event:*:on_cancel = frappe.core.doctype.notification_count.notification_count.clear_doctype_notifications
-bean_event:*:on_trash = frappe.core.doctype.notification_count.notification_count.clear_doctype_notifications
-
 bean_event:Stock Entry:on_submit = erpnext.stock.doctype.material_request.material_request.update_completed_qty
 bean_event:Stock Entry:on_cancel = erpnext.stock.doctype.material_request.material_request.update_completed_qty
 
diff --git a/erpnext/patches.txt b/erpnext/patches.txt
index 08caa76..824fe60 100644
--- a/erpnext/patches.txt
+++ b/erpnext/patches.txt
@@ -26,3 +26,4 @@
 execute:frappe.db.sql("""delete from `tabWebsite Item Group` where ifnull(item_group, '')=''""")
 erpnext.patches.4_0.remove_module_home_pages
 erpnext.patches.4_0.split_email_settings
+erpnext.patches.4_0.fix_employee_user_id
\ No newline at end of file
diff --git a/erpnext/patches/4_0/fix_employee_user_id.py b/erpnext/patches/4_0/fix_employee_user_id.py
new file mode 100644
index 0000000..71107f8
--- /dev/null
+++ b/erpnext/patches/4_0/fix_employee_user_id.py
@@ -0,0 +1,13 @@
+import frappe
+from frappe.utils import get_fullname
+
+def execute():
+	for user_id in frappe.db.sql_list("""select distinct user_id from `tabEmployee`
+		where ifnull(user_id, '')!=''
+		group by user_id having count(name) > 1"""):
+		
+		fullname = get_fullname(user_id)
+		employee = frappe.db.get_value("Employee", {"employee_name": fullname, "user_id": user_id})
+		if employee:
+			frappe.db.sql("""update `tabEmployee` set user_id=null
+				where user_id=%s and name!=%s""", (user_id, employee))
\ No newline at end of file
diff --git a/erpnext/stock/doctype/item/item.txt b/erpnext/stock/doctype/item/item.txt
index ff66df3..51abc22 100644
--- a/erpnext/stock/doctype/item/item.txt
+++ b/erpnext/stock/doctype/item/item.txt
@@ -2,7 +2,7 @@
  {
   "creation": "2013-05-03 10:45:46", 
   "docstatus": 0, 
-  "modified": "2014-02-20 18:27:02", 
+  "modified": "2014-03-05 15:20:59", 
   "modified_by": "Administrator", 
   "owner": "Administrator"
  }, 
@@ -111,6 +111,7 @@
   "doctype": "DocField", 
   "fieldname": "stock_uom", 
   "fieldtype": "Link", 
+  "ignore_restrictions": 1, 
   "label": "Default Unit of Measure", 
   "oldfieldname": "stock_uom", 
   "oldfieldtype": "Link", 
@@ -217,6 +218,7 @@
   "doctype": "DocField", 
   "fieldname": "default_warehouse", 
   "fieldtype": "Link", 
+  "ignore_restrictions": 1, 
   "label": "Default Warehouse", 
   "oldfieldname": "default_warehouse", 
   "oldfieldtype": "Link", 
@@ -349,6 +351,7 @@
   "doctype": "DocField", 
   "fieldname": "weight_uom", 
   "fieldtype": "Link", 
+  "ignore_restrictions": 1, 
   "label": "Weight UOM", 
   "options": "UOM", 
   "read_only": 0
@@ -420,6 +423,7 @@
   "doctype": "DocField", 
   "fieldname": "default_supplier", 
   "fieldtype": "Link", 
+  "ignore_restrictions": 1, 
   "label": "Default Supplier", 
   "options": "Supplier"
  }, 
@@ -441,6 +445,7 @@
   "doctype": "DocField", 
   "fieldname": "expense_account", 
   "fieldtype": "Link", 
+  "ignore_restrictions": 1, 
   "label": "Default Expense Account", 
   "oldfieldname": "purchase_account", 
   "oldfieldtype": "Link", 
@@ -453,6 +458,7 @@
   "doctype": "DocField", 
   "fieldname": "buying_cost_center", 
   "fieldtype": "Link", 
+  "ignore_restrictions": 1, 
   "label": "Default Buying Cost Center", 
   "oldfieldname": "cost_center", 
   "oldfieldtype": "Link", 
@@ -579,6 +585,7 @@
   "doctype": "DocField", 
   "fieldname": "income_account", 
   "fieldtype": "Link", 
+  "ignore_restrictions": 1, 
   "label": "Default Income Account", 
   "options": "Account", 
   "read_only": 0
@@ -588,6 +595,7 @@
   "doctype": "DocField", 
   "fieldname": "selling_cost_center", 
   "fieldtype": "Link", 
+  "ignore_restrictions": 1, 
   "label": "Default Selling Cost Center", 
   "options": "Cost Center", 
   "read_only": 0
@@ -691,6 +699,7 @@
   "doctype": "DocField", 
   "fieldname": "default_bom", 
   "fieldtype": "Link", 
+  "ignore_restrictions": 1, 
   "label": "Default BOM", 
   "no_copy": 1, 
   "oldfieldname": "default_bom", 
@@ -802,6 +811,7 @@
   "doctype": "DocField", 
   "fieldname": "website_warehouse", 
   "fieldtype": "Link", 
+  "ignore_restrictions": 1, 
   "label": "Website Warehouse", 
   "options": "Warehouse", 
   "read_only": 0
@@ -852,6 +862,7 @@
   "doctype": "DocField", 
   "fieldname": "parent_website_route", 
   "fieldtype": "Link", 
+  "ignore_restrictions": 1, 
   "label": "Parent Website Route", 
   "options": "Website Route"
  },