From 78352d1e7176cad8acbbc8db6277d9901cefab2d Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Mon, 18 Feb 2013 17:09:11 +0530 Subject: [PATCH] leave application permissions patch - removed permlevel 2 --- .../leave_application/leave_application.txt | 37 ++++++++----------- .../february_2013/p05_leave_application.py | 9 +++++ patches/patch_list.py | 1 + 3 files changed, 26 insertions(+), 21 deletions(-) create mode 100644 patches/february_2013/p05_leave_application.py diff --git a/hr/doctype/leave_application/leave_application.txt b/hr/doctype/leave_application/leave_application.txt index f51a91a2f7..32d4cc5101 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\"", @@ -217,15 +217,6 @@ "role": "Employee", "write": 1 }, - { - "amend": 0, - "cancel": 0, - "create": 0, - "doctype": "DocPerm", - "permlevel": 1, - "role": "All", - "submit": 0 - }, { "amend": 1, "cancel": 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 0000000000..88d166e613 --- /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 472360ed1a..6f21d5df85 100644 --- a/patches/patch_list.py +++ b/patches/patch_list.py @@ -173,4 +173,5 @@ patch_list = [ "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