HR - Leave Approver and Expense Approver fields changed to Link Fields, better default permissions
diff --git a/erpnext/hr/doctype/employee/employee.js b/erpnext/hr/doctype/employee/employee.js
index 0934bc5..b068bde 100644
--- a/erpnext/hr/doctype/employee/employee.js
+++ b/erpnext/hr/doctype/employee/employee.js
@@ -11,8 +11,12 @@
},
onload: function() {
- this.setup_leave_approver_select();
if(this.frm.doc.__islocal) this.frm.set_value("employee_name", "");
+ this.frm.set_query("leave_approver", "employee_leave_approvers", function() {
+ return {
+ filters: [["UserRole", "role", "=", "Leave Approver"]]
+ }
+ });
},
refresh: function() {
@@ -25,21 +29,6 @@
}
},
- setup_leave_approver_select: function() {
- var me = this;
- return this.frm.call({
- method: "erpnext.hr.utils.get_leave_approver_list",
- callback: function(r) {
- var df = frappe.meta.get_docfield("Employee Leave Approver", "leave_approver",
- me.frm.doc.name);
- df.options = $.map(r.message, function(user) {
- return {value: user, label: frappe.user_info(user).fullname};
- });
- me.frm.fields_dict.employee_leave_approvers.refresh();
- }
- });
- },
-
date_of_birth: function() {
return cur_frm.call({
method: "get_retirement_date",
diff --git a/erpnext/hr/doctype/employee/employee.json b/erpnext/hr/doctype/employee/employee.json
index 254e763..7be1c40 100644
--- a/erpnext/hr/doctype/employee/employee.json
+++ b/erpnext/hr/doctype/employee/employee.json
@@ -1,5 +1,5 @@
{
- "allow_import": 1,
+ "allow_import": 1,
"allow_rename": 1,
"autoname": "naming_series:",
"creation": "2013-03-07 09:04:18",
@@ -172,6 +172,7 @@
{
"fieldname": "employment_type",
"fieldtype": "Link",
+ "ignore_user_permissions": 1,
"in_filter": 1,
"in_list_view": 1,
"label": "Employment Type",
@@ -185,6 +186,7 @@
"description": "Applicable Holiday List",
"fieldname": "holiday_list",
"fieldtype": "Link",
+ "ignore_user_permissions": 1,
"label": "Holiday List",
"oldfieldname": "holiday_list",
"oldfieldtype": "Link",
@@ -672,7 +674,7 @@
],
"icon": "icon-user",
"idx": 1,
- "modified": "2014-05-27 07:34:49.337586",
+ "modified": "2014-08-27 05:55:00.514660",
"modified_by": "Administrator",
"module": "HR",
"name": "Employee",
@@ -704,6 +706,7 @@
"report": 1,
"role": "HR User",
"submit": 0,
+ "user_permission_doctypes": "[\"Branch\",\"Company\",\"Department\",\"Designation\"]",
"write": 1
},
{
@@ -719,12 +722,6 @@
"set_user_permissions": 1,
"submit": 0,
"write": 1
- },
- {
- "apply_user_permissions": 1,
- "permlevel": 0,
- "read": 1,
- "role": "Leave Approver"
}
],
"search_fields": "employee_name",
diff --git a/erpnext/hr/doctype/employee/employee.py b/erpnext/hr/doctype/employee/employee.py
index 01ab91d..5d4beaf 100644
--- a/erpnext/hr/doctype/employee/employee.py
+++ b/erpnext/hr/doctype/employee/employee.py
@@ -50,21 +50,11 @@
self.update_user_permissions()
self.update_dob_event()
- self.update_leave_approver_user_permissions()
def update_user_permissions(self):
frappe.permissions.add_user_permission("Employee", self.name, self.user_id)
frappe.permissions.set_user_permission_if_allowed("Company", self.company, self.user_id)
- def update_leave_approver_user_permissions(self):
- """add employee user permission for leave approver"""
- employee_leave_approvers = [d.leave_approver for d in self.get("employee_leave_approvers")]
- if self.reports_to and self.reports_to not in employee_leave_approvers:
- employee_leave_approvers.append(frappe.db.get_value("Employee", self.reports_to, "user_id"))
-
- for user in employee_leave_approvers:
- frappe.permissions.add_user_permission("Employee", self.name, user)
-
def update_user(self):
# add employee role if missing
user = frappe.get_doc("User", self.user_id)
diff --git a/erpnext/hr/doctype/employee_leave_approver/employee_leave_approver.json b/erpnext/hr/doctype/employee_leave_approver/employee_leave_approver.json
index 0302bc9..76335fb 100644
--- a/erpnext/hr/doctype/employee_leave_approver/employee_leave_approver.json
+++ b/erpnext/hr/doctype/employee_leave_approver/employee_leave_approver.json
@@ -8,10 +8,11 @@
"fields": [
{
"fieldname": "leave_approver",
- "fieldtype": "Select",
+ "fieldtype": "Link",
+ "ignore_user_permissions": 1,
"in_list_view": 1,
"label": "Leave Approver",
- "options": "[Select]",
+ "options": "User",
"permlevel": 0,
"print_hide": 1,
"reqd": 1,
@@ -20,7 +21,7 @@
],
"idx": 1,
"istable": 1,
- "modified": "2014-05-15 19:32:14.134420",
+ "modified": "2014-08-27 06:21:36.887205",
"modified_by": "Administrator",
"module": "HR",
"name": "Employee Leave Approver",
diff --git a/erpnext/hr/doctype/expense_claim/expense_claim.js b/erpnext/hr/doctype/expense_claim/expense_claim.js
index 4ef2efc..7098445 100644
--- a/erpnext/hr/doctype/expense_claim/expense_claim.js
+++ b/erpnext/hr/doctype/expense_claim/expense_claim.js
@@ -57,14 +57,12 @@
return{
query: "erpnext.controllers.queries.employee_query"
}
- }
- var exp_approver = doc.exp_approver;
- return cur_frm.call({
- method: "erpnext.hr.utils.get_expense_approver_list",
- callback: function(r) {
- cur_frm.set_df_property("exp_approver", "options", r.message);
- if(exp_approver) cur_frm.set_value("exp_approver", exp_approver);
- }
+ };
+
+ cur_frm.set_query("exp_approver", function() {
+ return {
+ filters: [["UserRole", "role", "=", "Expense Approver"]]
+ };
});
}
diff --git a/erpnext/hr/doctype/expense_claim/expense_claim.json b/erpnext/hr/doctype/expense_claim/expense_claim.json
index c13710a..15ef03e 100644
--- a/erpnext/hr/doctype/expense_claim/expense_claim.json
+++ b/erpnext/hr/doctype/expense_claim/expense_claim.json
@@ -20,11 +20,13 @@
"search_index": 1
},
{
+ "description": "A user with \"Expense Approver\" role",
"fieldname": "exp_approver",
- "fieldtype": "Select",
+ "fieldtype": "Link",
"label": "Approver",
"oldfieldname": "exp_approver",
"oldfieldtype": "Select",
+ "options": "User",
"permlevel": 0,
"width": "160px"
},
@@ -188,7 +190,7 @@
"icon": "icon-money",
"idx": 1,
"is_submittable": 1,
- "modified": "2014-06-23 07:55:48.580747",
+ "modified": "2014-08-27 07:08:48.454580",
"modified_by": "Administrator",
"module": "HR",
"name": "Expense Claim",
@@ -204,6 +206,7 @@
"read": 1,
"report": 1,
"role": "Employee",
+ "user_permission_doctypes": "[\"Company\",\"Employee\",\"Expense Claim\",\"Fiscal Year\"]",
"write": 1
},
{
@@ -219,6 +222,7 @@
"report": 1,
"role": "Expense Approver",
"submit": 1,
+ "user_permission_doctypes": "[\"Expense Claim\",\"User\"]",
"write": 1
},
{
@@ -234,6 +238,7 @@
"report": 1,
"role": "HR User",
"submit": 1,
+ "user_permission_doctypes": "[\"Company\",\"Expense Claim\",\"Fiscal Year\"]",
"write": 1
}
],
diff --git a/erpnext/hr/doctype/expense_claim/test_expense_claim.py b/erpnext/hr/doctype/expense_claim/test_expense_claim.py
new file mode 100644
index 0000000..5a55cbf
--- /dev/null
+++ b/erpnext/hr/doctype/expense_claim/test_expense_claim.py
@@ -0,0 +1,10 @@
+# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors and Contributors
+# See license.txt
+
+import frappe
+import unittest
+
+test_records = frappe.get_test_records('Expense Claim')
+
+class TestExpenseClaim(unittest.TestCase):
+ pass
diff --git a/erpnext/hr/doctype/expense_claim/test_records.json b/erpnext/hr/doctype/expense_claim/test_records.json
new file mode 100644
index 0000000..fe51488
--- /dev/null
+++ b/erpnext/hr/doctype/expense_claim/test_records.json
@@ -0,0 +1 @@
+[]
diff --git a/erpnext/hr/doctype/leave_application/leave_application.js b/erpnext/hr/doctype/leave_application/leave_application.js
index acb91c6..0d8b37e 100755
--- a/erpnext/hr/doctype/leave_application/leave_application.js
+++ b/erpnext/hr/doctype/leave_application/leave_application.js
@@ -11,20 +11,13 @@
cur_frm.cscript.calculate_total_days(doc, dt, dn);
}
- var leave_approver = doc.leave_approver;
- return cur_frm.call({
- method: "erpnext.hr.utils.get_leave_approver_list",
- callback: function(r) {
- cur_frm.set_df_property("leave_approver", "options", $.map(r.message,
- function(user) {
- return {value: user, label: frappe.user_info(user).fullname};
- }));
-
- if(leave_approver) cur_frm.set_value("leave_approver", leave_approver);
-
- cur_frm.cscript.get_leave_balance(cur_frm.doc);
- }
+ cur_frm.set_query("leave_approver", function() {
+ return {
+ filters: [["UserRole", "role", "=", "Leave Approver"]]
+ };
});
+
+ cur_frm.cscript.get_leave_balance(cur_frm.doc);
}
cur_frm.cscript.refresh = function(doc, dt, dn) {
diff --git a/erpnext/hr/doctype/leave_application/leave_application.json b/erpnext/hr/doctype/leave_application/leave_application.json
index 959f30d..9818150 100644
--- a/erpnext/hr/doctype/leave_application/leave_application.json
+++ b/erpnext/hr/doctype/leave_application/leave_application.json
@@ -1,285 +1,294 @@
{
- "autoname": "LAP/.#####",
- "creation": "2013-02-20 11:18:11",
- "description": "Apply / Approve Leaves",
- "docstatus": 0,
- "doctype": "DocType",
- "document_type": "Transaction",
+ "autoname": "LAP/.#####",
+ "creation": "2013-02-20 11:18:11",
+ "description": "Apply / Approve Leaves",
+ "docstatus": 0,
+ "doctype": "DocType",
+ "document_type": "Transaction",
"fields": [
{
- "default": "Open",
- "fieldname": "status",
- "fieldtype": "Select",
- "in_list_view": 1,
- "label": "Status",
- "no_copy": 1,
- "options": "Open\nApproved\nRejected",
+ "default": "Open",
+ "fieldname": "status",
+ "fieldtype": "Select",
+ "in_list_view": 1,
+ "label": "Status",
+ "no_copy": 1,
+ "options": "Open\nApproved\nRejected",
"permlevel": 1
- },
+ },
{
- "description": "Leave can be approved by users with Role, \"Leave Approver\"",
- "fieldname": "leave_approver",
- "fieldtype": "Select",
- "label": "Leave Approver",
- "options": "[Select]",
+ "description": "Leave can be approved by users with Role, \"Leave Approver\"",
+ "fieldname": "leave_approver",
+ "fieldtype": "Link",
+ "label": "Leave Approver",
+ "options": "User",
"permlevel": 0
- },
+ },
{
- "fieldname": "leave_type",
- "fieldtype": "Link",
- "in_filter": 1,
- "in_list_view": 1,
- "label": "Leave Type",
- "options": "Leave Type",
- "permlevel": 0,
- "reqd": 1,
+ "fieldname": "leave_type",
+ "fieldtype": "Link",
+ "ignore_user_permissions": 1,
+ "in_filter": 1,
+ "in_list_view": 1,
+ "label": "Leave Type",
+ "options": "Leave Type",
+ "permlevel": 0,
+ "reqd": 1,
"search_index": 1
- },
+ },
{
- "fieldname": "from_date",
- "fieldtype": "Date",
- "in_list_view": 1,
- "label": "From Date",
- "permlevel": 0,
- "reqd": 1,
+ "fieldname": "from_date",
+ "fieldtype": "Date",
+ "in_list_view": 1,
+ "label": "From Date",
+ "permlevel": 0,
+ "reqd": 1,
"search_index": 1
- },
+ },
{
- "fieldname": "to_date",
- "fieldtype": "Date",
- "in_list_view": 0,
- "label": "To Date",
- "permlevel": 0,
- "reqd": 1,
+ "fieldname": "to_date",
+ "fieldtype": "Date",
+ "in_list_view": 0,
+ "label": "To Date",
+ "permlevel": 0,
+ "reqd": 1,
"search_index": 1
- },
+ },
{
- "fieldname": "half_day",
- "fieldtype": "Check",
- "label": "Half Day",
+ "fieldname": "half_day",
+ "fieldtype": "Check",
+ "label": "Half Day",
"permlevel": 0
- },
+ },
{
- "fieldname": "column_break1",
- "fieldtype": "Column Break",
- "permlevel": 0,
- "print_width": "50%",
+ "fieldname": "column_break1",
+ "fieldtype": "Column Break",
+ "permlevel": 0,
+ "print_width": "50%",
"width": "50%"
- },
+ },
{
- "fieldname": "description",
- "fieldtype": "Small Text",
- "label": "Reason",
+ "fieldname": "description",
+ "fieldtype": "Small Text",
+ "label": "Reason",
"permlevel": 0
- },
+ },
{
- "fieldname": "employee",
- "fieldtype": "Link",
- "in_filter": 1,
- "label": "Employee",
- "options": "Employee",
- "permlevel": 0,
- "reqd": 1,
+ "fieldname": "employee",
+ "fieldtype": "Link",
+ "in_filter": 1,
+ "label": "Employee",
+ "options": "Employee",
+ "permlevel": 0,
+ "reqd": 1,
"search_index": 1
- },
+ },
{
- "fieldname": "employee_name",
- "fieldtype": "Data",
- "in_filter": 1,
- "in_list_view": 1,
- "label": "Employee Name",
- "permlevel": 0,
- "read_only": 1,
+ "fieldname": "employee_name",
+ "fieldtype": "Data",
+ "in_filter": 1,
+ "in_list_view": 1,
+ "label": "Employee Name",
+ "permlevel": 0,
+ "read_only": 1,
"search_index": 0
- },
+ },
{
- "fieldname": "leave_balance",
- "fieldtype": "Float",
- "label": "Leave Balance Before Application",
- "no_copy": 1,
- "permlevel": 0,
+ "fieldname": "leave_balance",
+ "fieldtype": "Float",
+ "label": "Leave Balance Before Application",
+ "no_copy": 1,
+ "permlevel": 0,
"read_only": 1
- },
+ },
{
- "fieldname": "total_leave_days",
- "fieldtype": "Float",
- "label": "Total Leave Days",
- "no_copy": 1,
- "permlevel": 0,
+ "fieldname": "total_leave_days",
+ "fieldtype": "Float",
+ "label": "Total Leave Days",
+ "no_copy": 1,
+ "permlevel": 0,
"read_only": 1
- },
+ },
{
- "fieldname": "sb10",
- "fieldtype": "Section Break",
- "label": "More Info",
+ "fieldname": "sb10",
+ "fieldtype": "Section Break",
+ "label": "More Info",
"permlevel": 0
- },
+ },
{
- "allow_on_submit": 1,
- "default": "1",
- "fieldname": "follow_via_email",
- "fieldtype": "Check",
- "label": "Follow via Email",
- "permlevel": 0,
+ "allow_on_submit": 1,
+ "default": "1",
+ "fieldname": "follow_via_email",
+ "fieldtype": "Check",
+ "label": "Follow via Email",
+ "permlevel": 0,
"print_hide": 1
- },
+ },
{
- "default": "Today",
- "fieldname": "posting_date",
- "fieldtype": "Date",
- "label": "Posting Date",
- "no_copy": 1,
- "permlevel": 0,
+ "default": "Today",
+ "fieldname": "posting_date",
+ "fieldtype": "Date",
+ "label": "Posting Date",
+ "no_copy": 1,
+ "permlevel": 0,
"reqd": 1
- },
+ },
{
- "fieldname": "fiscal_year",
- "fieldtype": "Link",
- "in_filter": 1,
- "label": "Fiscal Year",
- "options": "Fiscal Year",
- "permlevel": 0,
- "read_only": 0,
- "reqd": 1,
+ "fieldname": "fiscal_year",
+ "fieldtype": "Link",
+ "in_filter": 1,
+ "label": "Fiscal Year",
+ "options": "Fiscal Year",
+ "permlevel": 0,
+ "read_only": 0,
+ "reqd": 1,
"search_index": 0
- },
+ },
{
- "fieldname": "column_break_17",
- "fieldtype": "Column Break",
+ "fieldname": "column_break_17",
+ "fieldtype": "Column Break",
"permlevel": 0
- },
+ },
{
- "fieldname": "company",
- "fieldtype": "Link",
- "label": "Company",
- "options": "Company",
- "permlevel": 0,
+ "fieldname": "company",
+ "fieldtype": "Link",
+ "label": "Company",
+ "options": "Company",
+ "permlevel": 0,
"reqd": 1
- },
+ },
{
- "fieldname": "letter_head",
- "fieldtype": "Link",
- "label": "Letter Head",
- "options": "Letter Head",
- "permlevel": 0,
- "print_hide": 1,
+ "fieldname": "letter_head",
+ "fieldtype": "Link",
+ "ignore_user_permissions": 1,
+ "label": "Letter Head",
+ "options": "Letter Head",
+ "permlevel": 0,
+ "print_hide": 1,
"read_only": 0
- },
+ },
{
- "fieldname": "amended_from",
- "fieldtype": "Link",
- "ignore_user_permissions": 1,
- "label": "Amended From",
- "no_copy": 1,
- "options": "Leave Application",
- "permlevel": 0,
- "print_hide": 1,
+ "fieldname": "amended_from",
+ "fieldtype": "Link",
+ "ignore_user_permissions": 1,
+ "label": "Amended From",
+ "no_copy": 1,
+ "options": "Leave Application",
+ "permlevel": 0,
+ "print_hide": 1,
"read_only": 1
}
- ],
- "icon": "icon-calendar",
- "idx": 1,
- "is_submittable": 1,
- "max_attachments": 3,
- "modified": "2014-06-06 05:06:44.594229",
- "modified_by": "Administrator",
- "module": "HR",
- "name": "Leave Application",
- "owner": "Administrator",
+ ],
+ "icon": "icon-calendar",
+ "idx": 1,
+ "is_submittable": 1,
+ "max_attachments": 3,
+ "modified": "2014-08-28 03:32:38.865202",
+ "modified_by": "Administrator",
+ "module": "HR",
+ "name": "Leave Application",
+ "owner": "Administrator",
"permissions": [
{
- "apply_user_permissions": 1,
- "create": 1,
- "delete": 0,
- "email": 1,
- "permlevel": 0,
- "print": 1,
- "read": 1,
- "report": 1,
- "role": "Employee",
+ "apply_user_permissions": 1,
+ "create": 1,
+ "delete": 0,
+ "email": 1,
+ "permlevel": 0,
+ "print": 1,
+ "read": 1,
+ "report": 1,
+ "role": "Employee",
+ "user_permission_doctypes": "[\"Company\",\"Employee\",\"Fiscal Year\",\"Leave Application\"]",
"write": 1
- },
+ },
{
- "amend": 1,
- "cancel": 1,
- "create": 1,
- "email": 1,
- "permlevel": 0,
- "print": 1,
- "read": 1,
- "report": 1,
- "role": "HR Manager",
- "set_user_permissions": 1,
- "submit": 1,
+ "amend": 1,
+ "cancel": 1,
+ "create": 1,
+ "delete": 1,
+ "email": 1,
+ "export": 1,
+ "import": 0,
+ "permlevel": 0,
+ "print": 1,
+ "read": 1,
+ "report": 1,
+ "role": "HR Manager",
+ "set_user_permissions": 1,
+ "submit": 1,
"write": 1
- },
+ },
{
- "amend": 0,
- "cancel": 0,
- "create": 0,
- "delete": 0,
- "permlevel": 1,
- "read": 1,
- "role": "All",
+ "amend": 0,
+ "cancel": 0,
+ "create": 0,
+ "delete": 0,
+ "permlevel": 1,
+ "read": 1,
+ "role": "All",
"submit": 0
- },
+ },
{
- "amend": 1,
- "apply_user_permissions": 1,
- "cancel": 1,
- "create": 1,
- "delete": 1,
- "email": 1,
- "permlevel": 0,
- "print": 1,
- "read": 1,
- "report": 1,
- "role": "HR User",
- "set_user_permissions": 1,
- "submit": 1,
+ "amend": 1,
+ "apply_user_permissions": 1,
+ "cancel": 1,
+ "create": 1,
+ "delete": 1,
+ "email": 1,
+ "export": 0,
+ "permlevel": 0,
+ "print": 1,
+ "read": 1,
+ "report": 1,
+ "role": "HR User",
+ "set_user_permissions": 1,
+ "submit": 1,
+ "user_permission_doctypes": "[\"Company\"]",
"write": 1
- },
+ },
{
- "amend": 1,
- "apply_user_permissions": 1,
- "cancel": 0,
- "create": 0,
- "delete": 0,
- "email": 1,
- "permlevel": 0,
- "print": 1,
- "read": 1,
- "report": 1,
- "role": "Leave Approver",
- "submit": 1,
+ "amend": 1,
+ "apply_user_permissions": 1,
+ "cancel": 0,
+ "create": 0,
+ "delete": 0,
+ "email": 1,
+ "permlevel": 0,
+ "print": 1,
+ "read": 1,
+ "report": 1,
+ "role": "Leave Approver",
+ "submit": 1,
+ "user_permission_doctypes": "[\"Company\",\"User\"]",
"write": 1
- },
+ },
{
- "amend": 0,
- "cancel": 0,
- "create": 0,
- "delete": 0,
- "permlevel": 1,
- "read": 1,
- "report": 1,
- "role": "HR User",
- "submit": 0,
+ "amend": 0,
+ "cancel": 0,
+ "create": 0,
+ "delete": 0,
+ "permlevel": 1,
+ "read": 1,
+ "report": 1,
+ "role": "HR User",
+ "submit": 0,
"write": 1
- },
+ },
{
- "amend": 0,
- "cancel": 0,
- "create": 0,
- "delete": 0,
- "permlevel": 1,
- "read": 1,
- "report": 1,
- "role": "Leave Approver",
- "submit": 0,
+ "amend": 0,
+ "cancel": 0,
+ "create": 0,
+ "delete": 0,
+ "permlevel": 1,
+ "read": 1,
+ "report": 1,
+ "role": "Leave Approver",
+ "submit": 0,
"write": 1
}
- ],
- "search_fields": "employee,employee_name,leave_type,from_date,to_date,total_leave_days,fiscal_year",
- "sort_field": "modified",
+ ],
+ "search_fields": "employee,employee_name,leave_type,from_date,to_date,total_leave_days,fiscal_year",
+ "sort_field": "modified",
"sort_order": "DESC"
-}
+}
\ No newline at end of file
diff --git a/erpnext/hr/doctype/leave_application/leave_application.py b/erpnext/hr/doctype/leave_application/leave_application.py
index 3222a0c..32c4443 100755
--- a/erpnext/hr/doctype/leave_application/leave_application.py
+++ b/erpnext/hr/doctype/leave_application/leave_application.py
@@ -155,8 +155,7 @@
def validate_leave_approver(self):
employee = frappe.get_doc("Employee", self.employee)
- leave_approvers = [l.leave_approver for l in
- employee.get("employee_leave_approvers")]
+ leave_approvers = [l.leave_approver for l in employee.get("employee_leave_approvers")]
if len(leave_approvers) and self.leave_approver not in leave_approvers:
frappe.throw(_("Leave approver must be one of {0}").format(comma_or(leave_approvers)), InvalidLeaveApproverError)
diff --git a/erpnext/hr/doctype/leave_application/test_leave_application.py b/erpnext/hr/doctype/leave_application/test_leave_application.py
index f547640..7ad28de 100644
--- a/erpnext/hr/doctype/leave_application/test_leave_application.py
+++ b/erpnext/hr/doctype/leave_application/test_leave_application.py
@@ -91,6 +91,7 @@
from frappe.utils.user import add_role
add_role("test1@example.com", "HR User")
+ add_role("test1@example.com", "Leave Approver")
clear_user_permissions_for_doctype("Employee")
frappe.db.set_value("Department", "_Test Department",
@@ -157,6 +158,7 @@
from frappe.utils.user import add_role
add_role("test@example.com", "Employee")
+ add_role("test1@example.com", "HR User")
add_role("test1@example.com", "Leave Approver")
add_role("test2@example.com", "Leave Approver")
diff --git a/erpnext/hr/doctype/leave_application/test_records.json b/erpnext/hr/doctype/leave_application/test_records.json
new file mode 100644
index 0000000..fe51488
--- /dev/null
+++ b/erpnext/hr/doctype/leave_application/test_records.json
@@ -0,0 +1 @@
+[]
diff --git a/erpnext/hr/doctype/salary_slip/salary_slip.json b/erpnext/hr/doctype/salary_slip/salary_slip.json
index 88a7ef2..b288c50 100644
--- a/erpnext/hr/doctype/salary_slip/salary_slip.json
+++ b/erpnext/hr/doctype/salary_slip/salary_slip.json
@@ -74,6 +74,7 @@
{
"fieldname": "letter_head",
"fieldtype": "Link",
+ "ignore_user_permissions": 1,
"label": "Letter Head",
"options": "Letter Head",
"permlevel": 0,
@@ -335,7 +336,7 @@
"icon": "icon-file-text",
"idx": 1,
"is_submittable": 1,
- "modified": "2014-07-21 07:58:08.033784",
+ "modified": "2014-08-27 06:38:10.006224",
"modified_by": "Administrator",
"module": "HR",
"name": "Salary Slip",
@@ -353,6 +354,7 @@
"report": 1,
"role": "HR User",
"submit": 1,
+ "user_permission_doctypes": "[\"Branch\",\"Company\",\"Department\",\"Designation\",\"Fiscal Year\",\"Salary Slip\"]",
"write": 1
},
{
diff --git a/erpnext/hr/utils.py b/erpnext/hr/utils.py
index 857f936..5d165c3 100644
--- a/erpnext/hr/utils.py
+++ b/erpnext/hr/utils.py
@@ -5,24 +5,6 @@
import frappe
from frappe import _
-@frappe.whitelist()
-def get_leave_approver_list():
- roles = [r[0] for r in frappe.db.sql("""select distinct parent from `tabUserRole`
- where role='Leave Approver'""")]
- if not roles:
- frappe.msgprint(_("No Leave Approvers. Please assign 'Leave Approver' Role to atleast one user"))
-
- return roles
-
-
-@frappe.whitelist()
-def get_expense_approver_list():
- roles = [r[0] for r in frappe.db.sql("""select distinct parent from `tabUserRole`
- where role='Expense Approver'""")]
- if not roles:
- frappe.msgprint(_("No Expense Approvers. Please assign 'Expense Approver' Role to atleast one user"))
- return roles
-
def set_employee_name(doc):
if doc.employee and not doc.employee_name:
doc.employee_name = frappe.db.get_value("Employee", doc.employee, "employee_name")