address contact permissions
diff --git a/erpnext/patches/july_2012/address_contact_perms.py b/erpnext/patches/july_2012/address_contact_perms.py
new file mode 100644
index 0000000..1f14bd0
--- /dev/null
+++ b/erpnext/patches/july_2012/address_contact_perms.py
@@ -0,0 +1,11 @@
+def execute():
+	import webnotes
+	webnotes.conn.sql("""\
+		delete from `tabDocPerm`
+		where parent in ('Address', 'Contact')""")
+	webnotes.conn.commit()
+	
+	import webnotes.model.sync
+	webnotes.model.sync.sync('utilities', 'address')
+	webnotes.model.sync.sync('utilities', 'contact')
+	webnotes.conn.begin()
\ No newline at end of file
diff --git a/erpnext/patches/patch_list.py b/erpnext/patches/patch_list.py
index 3a043b9..82d7917 100644
--- a/erpnext/patches/patch_list.py
+++ b/erpnext/patches/patch_list.py
@@ -472,4 +472,9 @@
 		'patch_file': 'reload_pr_po_mapper',
 		'description': "order date should be greater than equal to request date"
 	},
+	{
+		'patch_module': 'patches.july_2012',
+		'patch_file': 'address_contact_perms',
+		'description': "sync address contact perms"
+	},
 ]
\ No newline at end of file
diff --git a/erpnext/utilities/doctype/address/address.txt b/erpnext/utilities/doctype/address/address.txt
index 56bbbe5..1ccfaa1 100644
--- a/erpnext/utilities/doctype/address/address.txt
+++ b/erpnext/utilities/doctype/address/address.txt
@@ -3,9 +3,9 @@
 
 	# These values are common in all dictionaries
 	{
-		'creation': '2012-03-27 14:36:45',
+		'creation': '2012-07-02 19:57:47',
 		'docstatus': 0,
-		'modified': '2012-03-27 14:36:45',
+		'modified': '2012-07-02 20:24:15',
 		'modified_by': u'Administrator',
 		'owner': u'Administrator'
 	},
@@ -24,7 +24,7 @@
 		'search_fields': u'customer, supplier, sales_partner, country, state',
 		'section_style': u'Simple',
 		'show_in_menu': 0,
-		'version': 43
+		'version': 1
 	},
 
 	# These values are common for all DocField
@@ -38,17 +38,12 @@
 
 	# These values are common for all DocPerm
 	{
-		'cancel': 1,
-		'create': 1,
 		'doctype': u'DocPerm',
 		'name': '__common__',
 		'parent': u'Address',
 		'parentfield': u'permissions',
 		'parenttype': u'DocType',
-		'permlevel': 0,
-		'read': 1,
-		'role': u'All',
-		'write': 1
+		'read': 1
 	},
 
 	# DocType, Address
@@ -59,7 +54,116 @@
 
 	# DocPerm
 	{
-		'doctype': u'DocPerm'
+		'cancel': 1,
+		'create': 1,
+		'doctype': u'DocPerm',
+		'permlevel': 0,
+		'role': u'System Manager',
+		'write': 1
+	},
+
+	# DocPerm
+	{
+		'cancel': 1,
+		'create': 1,
+		'doctype': u'DocPerm',
+		'permlevel': 0,
+		'role': u'Sales Master Manager',
+		'write': 1
+	},
+
+	# DocPerm
+	{
+		'cancel': 1,
+		'create': 1,
+		'doctype': u'DocPerm',
+		'permlevel': 0,
+		'role': u'Purchase Master Manager',
+		'write': 1
+	},
+
+	# DocPerm
+	{
+		'cancel': 0,
+		'create': 1,
+		'doctype': u'DocPerm',
+		'permlevel': 0,
+		'role': u'Maintenance Manager',
+		'write': 1
+	},
+
+	# DocPerm
+	{
+		'cancel': 0,
+		'create': 1,
+		'doctype': u'DocPerm',
+		'permlevel': 0,
+		'role': u'Accounts Manager',
+		'write': 1
+	},
+
+	# DocPerm
+	{
+		'create': 1,
+		'doctype': u'DocPerm',
+		'permlevel': 0,
+		'role': u'Sales Manager',
+		'write': 1
+	},
+
+	# DocPerm
+	{
+		'create': 1,
+		'doctype': u'DocPerm',
+		'permlevel': 0,
+		'role': u'Purchase Manager',
+		'write': 1
+	},
+
+	# DocPerm
+	{
+		'create': 1,
+		'doctype': u'DocPerm',
+		'permlevel': 0,
+		'role': u'Sales User',
+		'write': 1
+	},
+
+	# DocPerm
+	{
+		'create': 1,
+		'doctype': u'DocPerm',
+		'permlevel': 0,
+		'role': u'Purchase User',
+		'write': 1
+	},
+
+	# DocPerm
+	{
+		'create': 1,
+		'doctype': u'DocPerm',
+		'permlevel': 0,
+		'role': u'Maintenance User',
+		'write': 1
+	},
+
+	# DocPerm
+	{
+		'create': 1,
+		'doctype': u'DocPerm',
+		'permlevel': 0,
+		'role': u'Accounts User',
+		'write': 1
+	},
+
+	# DocPerm
+	{
+		'cancel': 0,
+		'create': 0,
+		'doctype': u'DocPerm',
+		'permlevel': 1,
+		'role': u'All',
+		'write': 0
 	},
 
 	# DocField
diff --git a/erpnext/utilities/doctype/contact/contact.txt b/erpnext/utilities/doctype/contact/contact.txt
index f385bd6..a4939c4 100644
--- a/erpnext/utilities/doctype/contact/contact.txt
+++ b/erpnext/utilities/doctype/contact/contact.txt
@@ -3,9 +3,9 @@
 
 	# These values are common in all dictionaries
 	{
-		'creation': '2012-03-27 14:36:46',
+		'creation': '2012-07-02 19:57:48',
 		'docstatus': 0,
-		'modified': '2012-03-27 14:36:46',
+		'modified': '2012-07-02 20:24:17',
 		'modified_by': u'Administrator',
 		'owner': u'Administrator'
 	},
@@ -26,7 +26,7 @@
 		'server_code_error': u' ',
 		'show_in_menu': 0,
 		'subject': u'%(first_name)s %(last_name)s - Email: %(email_id)s | Contact: %(phone)s | Mobile: %(mobile_no)s',
-		'version': 245
+		'version': 1
 	},
 
 	# These values are common for all DocField
@@ -56,6 +56,16 @@
 
 	# DocPerm
 	{
+		'cancel': 1,
+		'create': 1,
+		'doctype': u'DocPerm',
+		'permlevel': 0,
+		'role': u'System Manager',
+		'write': 1
+	},
+
+	# DocPerm
+	{
 		'amend': 0,
 		'cancel': 1,
 		'create': 1,
@@ -68,21 +78,6 @@
 
 	# DocPerm
 	{
-		'doctype': u'DocPerm',
-		'permlevel': 1,
-		'role': u'All',
-		'write': 1
-	},
-
-	# DocPerm
-	{
-		'doctype': u'DocPerm',
-		'permlevel': 2,
-		'role': u'All'
-	},
-
-	# DocPerm
-	{
 		'cancel': 1,
 		'create': 1,
 		'doctype': u'DocPerm',
@@ -93,16 +88,6 @@
 
 	# DocPerm
 	{
-		'cancel': 1,
-		'create': 1,
-		'doctype': u'DocPerm',
-		'permlevel': 0,
-		'role': u'System Manager',
-		'write': 1
-	},
-
-	# DocPerm
-	{
 		'doctype': u'DocPerm',
 		'permlevel': 0,
 		'role': u'Sales User'
@@ -115,6 +100,13 @@
 		'role': u'Purchase User'
 	},
 
+	# DocPerm
+	{
+		'doctype': u'DocPerm',
+		'permlevel': 1,
+		'role': u'All'
+	},
+
 	# DocField
 	{
 		'colour': u'White:FFF',