[refactor] Client-side permission handling
diff --git a/accounts/doctype/account/account.js b/accounts/doctype/account/account.js
index 8837586..407b2d4 100644
--- a/accounts/doctype/account/account.js
+++ b/accounts/doctype/account/account.js
@@ -37,7 +37,7 @@
 
 	// read-only for root accounts
 	if(!doc.parent_account) {
-		cur_frm.perm = [[1,0,0], [1,0,0]];
+		cur_frm.set_read_only();
 		cur_frm.set_intro(wn._("This is a root account and cannot be edited."));
 	} else {
 		// credit days and type if customer or supplier
diff --git a/patches/1311/p06_update_user_properties.py b/patches/1312/p02_update_user_properties.py
similarity index 100%
rename from patches/1311/p06_update_user_properties.py
rename to patches/1312/p02_update_user_properties.py
diff --git a/patches/1311/p07_move_warehouse_user_to_restrictions.py b/patches/1312/p03_move_warehouse_user_to_restrictions.py
similarity index 100%
rename from patches/1311/p07_move_warehouse_user_to_restrictions.py
rename to patches/1312/p03_move_warehouse_user_to_restrictions.py
diff --git a/patches/1311/p08_new_permissions.py b/patches/1312/p04_new_permissions.py
similarity index 100%
rename from patches/1311/p08_new_permissions.py
rename to patches/1312/p04_new_permissions.py
diff --git a/patches/patch_list.py b/patches/patch_list.py
index 30a4fc9..d5d50b6 100644
--- a/patches/patch_list.py
+++ b/patches/patch_list.py
@@ -254,15 +254,15 @@
 	"patches.1311.p04_update_comments",
 	"patches.1311.p05_website_brand_html",
 	"patches.1311.p06_fix_report_columns",
-	"patches.1311.p06_update_user_properties",
 	"execute:webnotes.delete_doc('DocType', 'Documentation Tool')",
 	"execute:webnotes.delete_doc('Report', 'Stock Ledger') #2013-11-29",
-	"patches.1312.p01_delete_old_stock_reports",
 	"execute:webnotes.delete_doc('Report', 'Payment Collection With Ageing')",
 	"execute:webnotes.delete_doc('Report', 'Payment Made With Ageing')",
 	"patches.1311.p07_scheduler_errors_digest",
 	"patches.1311.p08_email_digest_recipients",
 	"execute:webnotes.delete_doc('DocType', 'Warehouse Type')",
-	"patches.1311.p07_move_warehouse_user_to_restrictions",
-	"patches.1311.p08_new_permissions",
+	"patches.1312.p01_delete_old_stock_reports",
+	"patches.1312.p02_update_user_properties",
+	"patches.1312.p03_move_warehouse_user_to_restrictions",
+	"patches.1312.p04_new_permissions",
 ]
\ No newline at end of file
diff --git a/setup/doctype/customer_group/customer_group.js b/setup/doctype/customer_group/customer_group.js
index 3e76986..17a08c6 100644
--- a/setup/doctype/customer_group/customer_group.js
+++ b/setup/doctype/customer_group/customer_group.js
@@ -8,7 +8,7 @@
 cur_frm.cscript.set_root_readonly = function(doc) {
 	// read-only for root customer group
 	if(!doc.parent_customer_group) {
-		cur_frm.perm = [[1,0,0], [1,0,0]];
+		cur_frm.set_read_only();
 		cur_frm.set_intro(wn._("This is a root customer group and cannot be edited."));
 	} else {
 		cur_frm.set_intro(null);
diff --git a/setup/doctype/item_group/item_group.js b/setup/doctype/item_group/item_group.js
index 78df609..65e0588 100644
--- a/setup/doctype/item_group/item_group.js
+++ b/setup/doctype/item_group/item_group.js
@@ -18,7 +18,7 @@
 cur_frm.cscript.set_root_readonly = function(doc) {
 	// read-only for root item group
 	if(!doc.parent_item_group) {
-		cur_frm.perm = [[1,0,0], [1,0,0]];
+		cur_frm.set_read_only();
 		cur_frm.set_intro(wn._("This is a root item group and cannot be edited."));
 	} else {
 		cur_frm.set_intro(null);
diff --git a/setup/doctype/sales_person/sales_person.js b/setup/doctype/sales_person/sales_person.js
index 55d8684..a2db271 100644
--- a/setup/doctype/sales_person/sales_person.js
+++ b/setup/doctype/sales_person/sales_person.js
@@ -8,7 +8,7 @@
 cur_frm.cscript.set_root_readonly = function(doc) {
 	// read-only for root
 	if(!doc.parent_sales_person) {
-		cur_frm.perm = [[1,0,0], [1,0,0]];
+		cur_frm.set_read_only();
 		cur_frm.set_intro(wn._("This is a root sales person and cannot be edited."));
 	} else {
 		cur_frm.set_intro(null);
diff --git a/setup/doctype/territory/territory.js b/setup/doctype/territory/territory.js
index 18dbbb3..9cb1d70 100644
--- a/setup/doctype/territory/territory.js
+++ b/setup/doctype/territory/territory.js
@@ -8,7 +8,7 @@
 cur_frm.cscript.set_root_readonly = function(doc) {
 	// read-only for root territory
 	if(!doc.parent_territory) {
-		cur_frm.perm = [[1,0,0], [1,0,0]];
+		cur_frm.set_read_only();
 		cur_frm.set_intro(wn._("This is a root territory and cannot be edited."));
 	} else {
 		cur_frm.set_intro(null);