Patch to migrate allow_print and allow_email to print and email rights of DocPerm
diff --git a/patches/1312/p04_new_permissions.py b/patches/1312/p04_new_permissions.py
index 301c15e..e6042f4 100644
--- a/patches/1312/p04_new_permissions.py
+++ b/patches/1312/p04_new_permissions.py
@@ -8,6 +8,17 @@
# reset Page perms
from core.page.permission_manager.permission_manager import reset
reset("Page")
+ reset("Report")
# patch to move print, email into DocPerm
-
\ No newline at end of file
+ for doctype, hide_print, hide_email in webnotes.conn.sql("""select name, ifnull(allow_print, 0), ifnull(allow_email, 0)
+ from `tabDocType` where ifnull(issingle, 0)=0 and ifnull(istable, 0)=0 and
+ (ifnull(allow_print, 0)=0 or ifnull(allow_email, 0)=0)"""):
+
+ if not hide_print:
+ webnotes.conn.sql("""update `tabDocPerm` set `print`=1
+ where permlevel=0 and `read`=1 and parent=%s""", doctype)
+
+ if not hide_email:
+ webnotes.conn.sql("""update `tabDocPerm` set `email`=1
+ where permlevel=0 and `read`=1 and parent=%s""", doctype)