brotherton-erpnext/patches/1312/p04_new_permissions.py
Anand Doshi 8e332ffd16 Merge remote-tracking branch 'webnotes/4.0.0-wip' into permissions
Conflicts:
	erpnext/accounts/page/accounts_browser/accounts_browser.css
	erpnext/controllers/buying_controller.py
	erpnext/manufacturing/doctype/production_order/production_order.py
	erpnext/patches/patch_list.py
	erpnext/selling/doctype/customer/customer.txt
	erpnext/selling/doctype/sales_order/sales_order.py
	erpnext/selling/doctype/sales_order/test_sales_order.py
	erpnext/setup/doctype/features_setup/features_setup.txt
	erpnext/stock/doctype/stock_entry/test_stock_entry.py
	erpnext/stock/doctype/stock_ledger_entry/stock_ledger_entry.py
	startup/query_handlers.py
2013-12-26 19:12:51 +05:30

25 lines
924 B
Python

# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import webnotes
def execute():
# reset Page perms
from webnotes.core.page.permission_manager.permission_manager import reset
reset("Page")
reset("Report")
# patch to move print, email into DocPerm
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)