mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-31 18:59:08 +00:00
update role in address
This commit is contained in:
21
erpnext/patches/april_2012/update_role_in_address.py
Normal file
21
erpnext/patches/april_2012/update_role_in_address.py
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
def execute():
|
||||||
|
import webnotes
|
||||||
|
from webnotes.model.doc import addchild
|
||||||
|
from webnotes.model.code import get_obj
|
||||||
|
|
||||||
|
webnotes.conn.sql("delete from `tabDocPerm` where role = 'All' and parent = 'Address'")
|
||||||
|
|
||||||
|
role1 = ['Sales User', 'Purchase User', 'Accounts User', 'Maintenance User']
|
||||||
|
role2 = ['Sales Manager', 'Sales Master Manager', 'Purchase Manager', 'Purchase Master Manager', 'Accounts Manager', 'Maintenance Manager']
|
||||||
|
|
||||||
|
addr = get_obj('DocType', 'Address', with_children=1)
|
||||||
|
for d in role1+role2:
|
||||||
|
ch = addchild(addr.doc, 'permissions', 'DocPerm', 0)
|
||||||
|
ch.role = d
|
||||||
|
ch.read = 1
|
||||||
|
ch.write = 1
|
||||||
|
ch.create = 1
|
||||||
|
if d in role2:
|
||||||
|
ch.cancel = 1
|
||||||
|
|
||||||
|
ch.save()
|
||||||
Reference in New Issue
Block a user