From 16dfa061c5517fa296c0abfba195cfb1d78e65fa Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Tue, 26 Jun 2012 12:46:58 +0530 Subject: [PATCH] get list of system managers function --- py/webnotes/utils/__init__.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/py/webnotes/utils/__init__.py b/py/webnotes/utils/__init__.py index b04e1c18f0..616f647c63 100644 --- a/py/webnotes/utils/__init__.py +++ b/py/webnotes/utils/__init__.py @@ -683,3 +683,18 @@ def get_label_doctype(label): WHERE dt_label=%s""", label) return res and res[0][0] or label + + +def get_system_managers_list(): + """Returns a list of system managers' email addresses""" + system_managers_list = webnotes.conn.sql("""\ + SELECT DISTINCT p.name + FROM tabUserRole ur, tabProfile p + WHERE + ur.parent = p.name AND + ur.role='System Manager' AND + p.docstatus<2 AND + p.enabled=1 AND + p.name not in ('Administrator', 'Guest')""", as_list=1) + + return [sysman[0] for sysman in system_managers_list]