From 5fda36f2c0f1bc7a5dd4b2f0623daaf2d35283da Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Thu, 24 May 2012 12:39:18 +0530 Subject: [PATCH] fix in profile permissions and support ticket response should update modified datetime --- .../patches/may_2012/profile_perm_patch.py | 22 +++++++++++++++++++ erpnext/patches/patch_list.py | 5 +++++ .../doctype/support_ticket/__init__.py | 7 +++++- 3 files changed, 33 insertions(+), 1 deletion(-) create mode 100644 erpnext/patches/may_2012/profile_perm_patch.py diff --git a/erpnext/patches/may_2012/profile_perm_patch.py b/erpnext/patches/may_2012/profile_perm_patch.py new file mode 100644 index 00000000000..fe247872d9e --- /dev/null +++ b/erpnext/patches/may_2012/profile_perm_patch.py @@ -0,0 +1,22 @@ +def execute(): + """Make profile readonly for role All""" + import webnotes.model.doc + webnotes.conn.sql("delete from `tabDocPerm` where parent='Profile' and role='All'") + new_perms = [ + { + 'parent': 'Profile', + 'parentfield': 'permissions', + 'parenttype': 'DocType', + 'role': 'All', + 'permlevel': 0, + 'read': 1, + }, + ] + for perms in new_perms: + doc = webnotes.model.doc.Document('DocPerm') + doc.fields.update(perms) + doc.save() + webnotes.conn.commit() + webnotes.conn.begin() + import webnotes.model.sync + webnotes.model.sync.sync('core', 'profile') \ No newline at end of file diff --git a/erpnext/patches/patch_list.py b/erpnext/patches/patch_list.py index 13a411c926f..f8738e51e4c 100644 --- a/erpnext/patches/patch_list.py +++ b/erpnext/patches/patch_list.py @@ -397,4 +397,9 @@ patch_list = [ 'patch_file': 'reload_customer_address_contact', 'description': 'Reload report customer address contact' }, + { + 'patch_module': 'patches.may_2012', + 'patch_file': 'profile_perm_patch', + 'description': 'Make profile readonly for role All' + }, ] \ No newline at end of file diff --git a/erpnext/support/doctype/support_ticket/__init__.py b/erpnext/support/doctype/support_ticket/__init__.py index ed42d2b9ece..d2dbe60f2c1 100644 --- a/erpnext/support/doctype/support_ticket/__init__.py +++ b/erpnext/support/doctype/support_ticket/__init__.py @@ -79,7 +79,12 @@ class SupportMailbox(POP3Mailbox): st = get_obj('Support Ticket', thread_id) st.make_response_record(content, mail.mail['From'], content_type) - webnotes.conn.set(st.doc, 'status', 'Open') + + # to update modified date + #webnotes.conn.set(st.doc, 'status', 'Open') + st.doc.status = 'Open' + st.doc.save() + update_feed(st.doc, 'on_update') webnotes.conn.commit() # extract attachments