leave application permissions patch - removed permlevel 2
diff --git a/hr/doctype/leave_application/leave_application.txt b/hr/doctype/leave_application/leave_application.txt
index f51a91a..32d4cc5 100644
--- a/hr/doctype/leave_application/leave_application.txt
+++ b/hr/doctype/leave_application/leave_application.txt
@@ -1,8 +1,8 @@
 [
  {
-  "creation": "2013-02-08 13:17:08", 
+  "creation": "2013-02-18 13:36:20", 
   "docstatus": 0, 
-  "modified": "2013-02-13 12:32:27", 
+  "modified": "2013-02-18 16:59:53", 
   "modified_by": "Administrator", 
   "owner": "Administrator"
  }, 
@@ -44,7 +44,7 @@
   "label": "Status", 
   "no_copy": 1, 
   "options": "Open\nApproved\nRejected", 
-  "permlevel": 2
+  "permlevel": 1
  }, 
  {
   "description": "Leave can be approved by users with Role, \"Leave Approver\"", 
@@ -218,15 +218,6 @@
   "write": 1
  }, 
  {
-  "amend": 0, 
-  "cancel": 0, 
-  "create": 0, 
-  "doctype": "DocPerm", 
-  "permlevel": 1, 
-  "role": "All", 
-  "submit": 0
- }, 
- {
   "amend": 1, 
   "cancel": 1, 
   "create": 1, 
@@ -254,8 +245,17 @@
   "cancel": 0, 
   "create": 0, 
   "doctype": "DocPerm", 
-  "permlevel": 2, 
-  "report": 1, 
+  "permlevel": 1, 
+  "role": "All", 
+  "submit": 0
+ }, 
+ {
+  "amend": 0, 
+  "cancel": 0, 
+  "create": 0, 
+  "doctype": "DocPerm", 
+  "permlevel": 1, 
+  "report": 0, 
   "role": "HR User", 
   "submit": 0, 
   "write": 1
@@ -265,15 +265,10 @@
   "cancel": 0, 
   "create": 0, 
   "doctype": "DocPerm", 
-  "permlevel": 2, 
-  "report": 1, 
+  "permlevel": 1, 
+  "report": 0, 
   "role": "Leave Approver", 
   "submit": 0, 
   "write": 1
- }, 
- {
-  "doctype": "DocPerm", 
-  "permlevel": 2, 
-  "role": "Employee"
  }
 ]
\ No newline at end of file
diff --git a/patches/february_2013/p05_leave_application.py b/patches/february_2013/p05_leave_application.py
new file mode 100644
index 0000000..88d166e
--- /dev/null
+++ b/patches/february_2013/p05_leave_application.py
@@ -0,0 +1,9 @@
+import webnotes
+
+def execute():
+	webnotes.reload_doc("hr", "doctype", "leave_application")
+	
+	if not webnotes.get_doctype("Leave Application").get({"doctype": "DocField", 
+			"parent": "Leave Application", "permlevel": 2}):
+		webnotes.conn.sql("""update `tabDocPerm` set permlevel=1 
+			where parent="Leave Application" and permlevel=2""")
\ No newline at end of file
diff --git a/patches/patch_list.py b/patches/patch_list.py
index 472360e..6f21d5d 100644
--- a/patches/patch_list.py
+++ b/patches/patch_list.py
@@ -173,4 +173,5 @@
 	"patches.february_2013.p01_event",
 	"execute:webnotes.delete_doc('Page', 'Calendar')",
 	"patches.february_2013.p02_email_digest",
+	"patches.february_2013.p05_leave_application",
 ]
\ No newline at end of file