chore: Remove HR related field references from Employee, Department form scripts
- removed approver fields and payroll cost center from Employee master - removed query filter code for HR related fields from employee and department form scripts - removed `update_approver_role`
This commit is contained in:
parent
eac58abcc5
commit
39e0d22044
@ -1,20 +1,11 @@
|
||||
// Copyright (c) 2016, Frappe Technologies Pvt. Ltd. and contributors
|
||||
// For license information, please see license.txt
|
||||
|
||||
frappe.ui.form.on('Department', {
|
||||
frappe.ui.form.on("Department", {
|
||||
onload: function(frm) {
|
||||
frm.set_query("parent_department", function(){
|
||||
frm.set_query("parent_department", function() {
|
||||
return {"filters": [["Department", "is_group", "=", 1]]};
|
||||
});
|
||||
|
||||
frm.set_query("payroll_cost_center", function() {
|
||||
return {
|
||||
filters: {
|
||||
"company": frm.doc.company,
|
||||
"is_group": 0
|
||||
}
|
||||
};
|
||||
});
|
||||
},
|
||||
refresh: function(frm) {
|
||||
// read-only for root department
|
||||
|
@ -38,25 +38,7 @@ erpnext.setup.EmployeeController = class EmployeeController extends frappe.ui.fo
|
||||
|
||||
};
|
||||
|
||||
frappe.ui.form.on('Employee', {
|
||||
setup: function (frm) {
|
||||
frm.set_query("leave_policy", function() {
|
||||
return {
|
||||
"filters": {
|
||||
"docstatus": 1
|
||||
}
|
||||
};
|
||||
});
|
||||
|
||||
frm.set_query("payroll_cost_center", function() {
|
||||
return {
|
||||
filters: {
|
||||
"company": frm.doc.company,
|
||||
"is_group": 0
|
||||
}
|
||||
};
|
||||
});
|
||||
},
|
||||
frappe.ui.form.on("Employee", {
|
||||
onload: function (frm) {
|
||||
frm.set_query("department", function() {
|
||||
return {
|
||||
|
@ -48,11 +48,6 @@
|
||||
"reports_to",
|
||||
"column_break_31",
|
||||
"branch",
|
||||
"approvers_section",
|
||||
"expense_approver",
|
||||
"leave_approver",
|
||||
"column_break_45",
|
||||
"shift_request_approver",
|
||||
"attendance_and_leave_details",
|
||||
"attendance_device_id",
|
||||
"column_break_44",
|
||||
@ -60,7 +55,6 @@
|
||||
"salary_information",
|
||||
"salary_currency",
|
||||
"ctc",
|
||||
"salary_mode",
|
||||
"payroll_cost_center",
|
||||
"column_break_52",
|
||||
"bank_name",
|
||||
@ -715,49 +709,14 @@
|
||||
"fieldname": "column_break_44",
|
||||
"fieldtype": "Column Break"
|
||||
},
|
||||
{
|
||||
"fieldname": "leave_approver",
|
||||
"fieldtype": "Link",
|
||||
"label": "Leave Approver",
|
||||
"options": "User"
|
||||
},
|
||||
{
|
||||
"fieldname": "column_break_19",
|
||||
"fieldtype": "Column Break"
|
||||
},
|
||||
{
|
||||
"fetch_from": "department.payroll_cost_center",
|
||||
"fetch_if_empty": 1,
|
||||
"fieldname": "payroll_cost_center",
|
||||
"fieldtype": "Link",
|
||||
"label": "Payroll Cost Center",
|
||||
"options": "Cost Center"
|
||||
},
|
||||
{
|
||||
"fieldname": "column_break_52",
|
||||
"fieldtype": "Column Break"
|
||||
},
|
||||
{
|
||||
"fieldname": "expense_approver",
|
||||
"fieldtype": "Link",
|
||||
"label": "Expense Approver",
|
||||
"options": "User"
|
||||
},
|
||||
{
|
||||
"fieldname": "approvers_section",
|
||||
"fieldtype": "Section Break",
|
||||
"label": "Approvers"
|
||||
},
|
||||
{
|
||||
"fieldname": "column_break_45",
|
||||
"fieldtype": "Column Break"
|
||||
},
|
||||
{
|
||||
"fieldname": "shift_request_approver",
|
||||
"fieldtype": "Link",
|
||||
"label": "Shift Request Approver",
|
||||
"options": "User"
|
||||
},
|
||||
{
|
||||
"fieldname": "salary_currency",
|
||||
"fieldtype": "Link",
|
||||
@ -775,7 +734,7 @@
|
||||
"idx": 24,
|
||||
"image_field": "image",
|
||||
"links": [],
|
||||
"modified": "2022-06-10 22:28:55.811983",
|
||||
"modified": "2022-06-23 22:28:55.811983",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Setup",
|
||||
"name": "Employee",
|
||||
|
@ -94,7 +94,6 @@ class Employee(NestedSet):
|
||||
self.update_user()
|
||||
self.update_user_permissions()
|
||||
self.reset_employee_emails_cache()
|
||||
self.update_approver_role()
|
||||
|
||||
def update_user_permissions(self):
|
||||
if not self.create_user_permission:
|
||||
@ -155,17 +154,6 @@ class Employee(NestedSet):
|
||||
|
||||
user.save()
|
||||
|
||||
def update_approver_role(self):
|
||||
if self.leave_approver:
|
||||
user = frappe.get_doc("User", self.leave_approver)
|
||||
user.flags.ignore_permissions = True
|
||||
user.add_roles("Leave Approver")
|
||||
|
||||
if self.expense_approver:
|
||||
user = frappe.get_doc("User", self.expense_approver)
|
||||
user.flags.ignore_permissions = True
|
||||
user.add_roles("Expense Approver")
|
||||
|
||||
def validate_date(self):
|
||||
if self.date_of_birth and getdate(self.date_of_birth) > getdate(today()):
|
||||
throw(_("Date of Birth cannot be greater than today."))
|
||||
|
Loading…
x
Reference in New Issue
Block a user