blob: 0d23a16c44b652fa1d83fb88cf6f860ae311e440 [file] [log] [blame]
Anand Doshi60666a22013-04-12 20:19:53 +05301# ERPNext - web based ERP (http://erpnext.com)
2# Copyright (C) 2012 Web Notes Technologies Pvt Ltd
3#
4# This program is free software: you can redistribute it and/or modify
5# it under the terms of the GNU General Public License as published by
6# the Free Software Foundation, either version 3 of the License, or
7# (at your option) any later version.
8#
9# This program is distributed in the hope that it will be useful,
10# but WITHOUT ANY WARRANTY; without even the implied warranty of
11# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12# GNU General Public License for more details.
13#
14# You should have received a copy of the GNU General Public License
15# along with this program. If not, see <http://www.gnu.org/licenses/>.
16
17from __future__ import unicode_literals
18import webnotes
19from webnotes import _
20
21@webnotes.whitelist()
22def get_leave_approver_list():
23 roles = [r[0] for r in webnotes.conn.sql("""select distinct parent from `tabUserRole`
24 where role='Leave Approver'""")]
25 if not roles:
26 webnotes.msgprint(_("No Leave Approvers. Please assign 'Leave Approver' Role to atleast one user."))
27
28 return roles
29
30
31@webnotes.whitelist()
32def get_expense_approver_list():
33 roles = [r[0] for r in webnotes.conn.sql("""select distinct parent from `tabUserRole`
34 where role='Expense Approver'""")]
35 if not roles:
36 webnotes.msgprint("No Expense Approvers. Please assign 'Expense Approver' \
37 Role to atleast one user.")
38 return roles