From d1b2afcd18294712be96bd58ffa27d193a98e8f2 Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Wed, 12 Dec 2012 15:58:46 +0530 Subject: [PATCH] webnotes.user.roles deprecated to webnotes.user.get_roles() --- accounts/page/accounts_browser/accounts_browser.py | 5 +++-- startup/event_handlers.py | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/accounts/page/accounts_browser/accounts_browser.py b/accounts/page/accounts_browser/accounts_browser.py index 8b24394f369..7c8116c77c4 100644 --- a/accounts/page/accounts_browser/accounts_browser.py +++ b/accounts/page/accounts_browser/accounts_browser.py @@ -10,9 +10,10 @@ def get_companies(): # check if match permission exists res = webnotes.conn.sql("""select role, `match` from `tabDocPerm` where parent='Account' and permlevel=0 and `read`=1""", as_dict=1) - + + roles = webnotes.user.get_roles() match = any((r["match"] for r in res - if r["role"] in webnotes.user.roles and r["match"]=="company")) + if r["role"] in roles and r["match"]=="company")) # if match == company is specified and companies are specified in user defaults if match and webnotes.user.get_defaults().get("company"): diff --git a/startup/event_handlers.py b/startup/event_handlers.py index f526c73fc0f..4808298368b 100644 --- a/startup/event_handlers.py +++ b/startup/event_handlers.py @@ -115,7 +115,7 @@ def check_if_expired(): from webnotes.utils import formatdate msg = """Oops! Your subscription expired on %s.
""" % formatdate(conf.expires_on) - if 'System Manager' in webnotes.user.roles: + if 'System Manager' in webnotes.user.get_roles(): msg += """Just drop in a mail at support@erpnext.com and we will guide you to get your account re-activated.""" else: