2013-12-27 12:00:24 +00:00
|
|
|
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
|
|
|
|
# License: GNU General Public License v3. See license.txt
|
|
|
|
|
|
|
|
from __future__ import unicode_literals
|
2014-02-14 10:17:51 +00:00
|
|
|
import frappe
|
2013-12-27 12:00:24 +00:00
|
|
|
|
|
|
|
def execute():
|
|
|
|
# reset Page perms
|
2014-02-14 10:17:51 +00:00
|
|
|
from frappe.core.page.permission_manager.permission_manager import reset
|
2013-12-27 12:00:24 +00:00
|
|
|
reset("Page")
|
|
|
|
reset("Report")
|
|
|
|
|
|
|
|
# patch to move print, email into DocPerm
|
2014-02-26 07:05:33 +00:00
|
|
|
for doctype, hide_print, hide_email in frappe.db.sql("""select name, ifnull(allow_print, 0), ifnull(allow_email, 0)
|
2013-12-27 12:00:24 +00:00
|
|
|
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:
|
2014-02-26 07:05:33 +00:00
|
|
|
frappe.db.sql("""update `tabDocPerm` set `print`=1
|
2013-12-27 12:00:24 +00:00
|
|
|
where permlevel=0 and `read`=1 and parent=%s""", doctype)
|
|
|
|
|
|
|
|
if not hide_email:
|
2014-02-26 07:05:33 +00:00
|
|
|
frappe.db.sql("""update `tabDocPerm` set `email`=1
|
2013-12-27 12:00:24 +00:00
|
|
|
where permlevel=0 and `read`=1 and parent=%s""", doctype)
|