brotherton-erpnext/erpnext/hr/utils.py

26 lines
820 B
Python
Raw Normal View History

2013-11-20 07:29:58 +00:00
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
2014-02-14 10:17:51 +00:00
import frappe
from frappe import _
2014-02-14 10:17:51 +00:00
@frappe.whitelist()
def get_leave_approver_list():
2014-02-26 07:05:33 +00:00
roles = [r[0] for r in frappe.db.sql("""select distinct parent from `tabUserRole`
where role='Leave Approver'""")]
if not roles:
2014-02-14 10:17:51 +00:00
frappe.msgprint(_("No Leave Approvers. Please assign 'Leave Approver' Role to atleast one user."))
return roles
2014-02-14 10:17:51 +00:00
@frappe.whitelist()
def get_expense_approver_list():
2014-02-26 07:05:33 +00:00
roles = [r[0] for r in frappe.db.sql("""select distinct parent from `tabUserRole`
where role='Expense Approver'""")]
if not roles:
2014-02-14 10:17:51 +00:00
frappe.msgprint("No Expense Approvers. Please assign 'Expense Approver' \
Role to atleast one user.")
return roles