From 851b9c0aade9f8ca91771329261511a887a4860b Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Mon, 2 Jul 2012 20:25:26 +0530 Subject: [PATCH] address contact permissions --- .../july_2012/address_contact_perms.py | 11 ++ erpnext/patches/patch_list.py | 5 + erpnext/utilities/doctype/address/address.txt | 124 ++++++++++++++++-- erpnext/utilities/doctype/contact/contact.txt | 48 +++---- 4 files changed, 150 insertions(+), 38 deletions(-) create mode 100644 erpnext/patches/july_2012/address_contact_perms.py diff --git a/erpnext/patches/july_2012/address_contact_perms.py b/erpnext/patches/july_2012/address_contact_perms.py new file mode 100644 index 0000000000..1f14bd028f --- /dev/null +++ b/erpnext/patches/july_2012/address_contact_perms.py @@ -0,0 +1,11 @@ +def execute(): + import webnotes + webnotes.conn.sql("""\ + delete from `tabDocPerm` + where parent in ('Address', 'Contact')""") + webnotes.conn.commit() + + import webnotes.model.sync + webnotes.model.sync.sync('utilities', 'address') + webnotes.model.sync.sync('utilities', 'contact') + webnotes.conn.begin() \ No newline at end of file diff --git a/erpnext/patches/patch_list.py b/erpnext/patches/patch_list.py index 3a043b9e7e..82d7917dc4 100644 --- a/erpnext/patches/patch_list.py +++ b/erpnext/patches/patch_list.py @@ -472,4 +472,9 @@ patch_list = [ 'patch_file': 'reload_pr_po_mapper', 'description': "order date should be greater than equal to request date" }, + { + 'patch_module': 'patches.july_2012', + 'patch_file': 'address_contact_perms', + 'description': "sync address contact perms" + }, ] \ No newline at end of file diff --git a/erpnext/utilities/doctype/address/address.txt b/erpnext/utilities/doctype/address/address.txt index 56bbbe52a0..1ccfaa18f1 100644 --- a/erpnext/utilities/doctype/address/address.txt +++ b/erpnext/utilities/doctype/address/address.txt @@ -3,9 +3,9 @@ # These values are common in all dictionaries { - 'creation': '2012-03-27 14:36:45', + 'creation': '2012-07-02 19:57:47', 'docstatus': 0, - 'modified': '2012-03-27 14:36:45', + 'modified': '2012-07-02 20:24:15', 'modified_by': u'Administrator', 'owner': u'Administrator' }, @@ -24,7 +24,7 @@ 'search_fields': u'customer, supplier, sales_partner, country, state', 'section_style': u'Simple', 'show_in_menu': 0, - 'version': 43 + 'version': 1 }, # These values are common for all DocField @@ -38,17 +38,12 @@ # These values are common for all DocPerm { - 'cancel': 1, - 'create': 1, 'doctype': u'DocPerm', 'name': '__common__', 'parent': u'Address', 'parentfield': u'permissions', 'parenttype': u'DocType', - 'permlevel': 0, - 'read': 1, - 'role': u'All', - 'write': 1 + 'read': 1 }, # DocType, Address @@ -59,7 +54,116 @@ # DocPerm { - 'doctype': u'DocPerm' + 'cancel': 1, + 'create': 1, + 'doctype': u'DocPerm', + 'permlevel': 0, + 'role': u'System Manager', + 'write': 1 + }, + + # DocPerm + { + 'cancel': 1, + 'create': 1, + 'doctype': u'DocPerm', + 'permlevel': 0, + 'role': u'Sales Master Manager', + 'write': 1 + }, + + # DocPerm + { + 'cancel': 1, + 'create': 1, + 'doctype': u'DocPerm', + 'permlevel': 0, + 'role': u'Purchase Master Manager', + 'write': 1 + }, + + # DocPerm + { + 'cancel': 0, + 'create': 1, + 'doctype': u'DocPerm', + 'permlevel': 0, + 'role': u'Maintenance Manager', + 'write': 1 + }, + + # DocPerm + { + 'cancel': 0, + 'create': 1, + 'doctype': u'DocPerm', + 'permlevel': 0, + 'role': u'Accounts Manager', + 'write': 1 + }, + + # DocPerm + { + 'create': 1, + 'doctype': u'DocPerm', + 'permlevel': 0, + 'role': u'Sales Manager', + 'write': 1 + }, + + # DocPerm + { + 'create': 1, + 'doctype': u'DocPerm', + 'permlevel': 0, + 'role': u'Purchase Manager', + 'write': 1 + }, + + # DocPerm + { + 'create': 1, + 'doctype': u'DocPerm', + 'permlevel': 0, + 'role': u'Sales User', + 'write': 1 + }, + + # DocPerm + { + 'create': 1, + 'doctype': u'DocPerm', + 'permlevel': 0, + 'role': u'Purchase User', + 'write': 1 + }, + + # DocPerm + { + 'create': 1, + 'doctype': u'DocPerm', + 'permlevel': 0, + 'role': u'Maintenance User', + 'write': 1 + }, + + # DocPerm + { + 'create': 1, + 'doctype': u'DocPerm', + 'permlevel': 0, + 'role': u'Accounts User', + 'write': 1 + }, + + # DocPerm + { + 'cancel': 0, + 'create': 0, + 'doctype': u'DocPerm', + 'permlevel': 1, + 'role': u'All', + 'write': 0 }, # DocField diff --git a/erpnext/utilities/doctype/contact/contact.txt b/erpnext/utilities/doctype/contact/contact.txt index f385bd68d9..a4939c4d69 100644 --- a/erpnext/utilities/doctype/contact/contact.txt +++ b/erpnext/utilities/doctype/contact/contact.txt @@ -3,9 +3,9 @@ # These values are common in all dictionaries { - 'creation': '2012-03-27 14:36:46', + 'creation': '2012-07-02 19:57:48', 'docstatus': 0, - 'modified': '2012-03-27 14:36:46', + 'modified': '2012-07-02 20:24:17', 'modified_by': u'Administrator', 'owner': u'Administrator' }, @@ -26,7 +26,7 @@ 'server_code_error': u' ', 'show_in_menu': 0, 'subject': u'%(first_name)s %(last_name)s - Email: %(email_id)s | Contact: %(phone)s | Mobile: %(mobile_no)s', - 'version': 245 + 'version': 1 }, # These values are common for all DocField @@ -54,6 +54,16 @@ 'name': u'Contact' }, + # DocPerm + { + 'cancel': 1, + 'create': 1, + 'doctype': u'DocPerm', + 'permlevel': 0, + 'role': u'System Manager', + 'write': 1 + }, + # DocPerm { 'amend': 0, @@ -66,21 +76,6 @@ 'write': 1 }, - # DocPerm - { - 'doctype': u'DocPerm', - 'permlevel': 1, - 'role': u'All', - 'write': 1 - }, - - # DocPerm - { - 'doctype': u'DocPerm', - 'permlevel': 2, - 'role': u'All' - }, - # DocPerm { 'cancel': 1, @@ -91,16 +86,6 @@ 'write': 1 }, - # DocPerm - { - 'cancel': 1, - 'create': 1, - 'doctype': u'DocPerm', - 'permlevel': 0, - 'role': u'System Manager', - 'write': 1 - }, - # DocPerm { 'doctype': u'DocPerm', @@ -115,6 +100,13 @@ 'role': u'Purchase User' }, + # DocPerm + { + 'doctype': u'DocPerm', + 'permlevel': 1, + 'role': u'All' + }, + # DocField { 'colour': u'White:FFF',