feat: add Inactive status to Employee
This commit is contained in:
parent
42d72b55b8
commit
efd7d584b2
@ -457,7 +457,7 @@ def validate_party_frozen_disabled(party_type, party_name):
|
||||
frappe.throw(_("{0} {1} is frozen").format(party_type, party_name), PartyFrozen)
|
||||
|
||||
elif party_type == "Employee":
|
||||
if frappe.db.get_value("Employee", party_name, "status") == "Left":
|
||||
if frappe.db.get_value("Employee", party_name, "status") != "Active":
|
||||
frappe.msgprint(_("{0} {1} is not active").format(party_type, party_name), alert=True)
|
||||
|
||||
def get_timeline_data(doctype, name):
|
||||
|
@ -207,7 +207,7 @@
|
||||
"label": "Status",
|
||||
"oldfieldname": "status",
|
||||
"oldfieldtype": "Select",
|
||||
"options": "Active\nLeft",
|
||||
"options": "Active\nInactive\nLeft",
|
||||
"reqd": 1,
|
||||
"search_index": 1
|
||||
},
|
||||
@ -813,7 +813,7 @@
|
||||
"idx": 24,
|
||||
"image_field": "image",
|
||||
"links": [],
|
||||
"modified": "2021-01-02 16:54:33.477439",
|
||||
"modified": "2021-06-12 11:31:37.730760",
|
||||
"modified_by": "Administrator",
|
||||
"module": "HR",
|
||||
"name": "Employee",
|
||||
|
@ -37,7 +37,7 @@ class Employee(NestedSet):
|
||||
|
||||
def validate(self):
|
||||
from erpnext.controllers.status_updater import validate_status
|
||||
validate_status(self.status, ["Active", "Temporary Leave", "Left"])
|
||||
validate_status(self.status, ["Active", "Inactive", "Left"])
|
||||
|
||||
self.employee = self.name
|
||||
self.set_employee_name()
|
||||
@ -478,7 +478,7 @@ def get_employee_emails(employee_list):
|
||||
@frappe.whitelist()
|
||||
def get_children(doctype, parent=None, company=None, is_root=False, is_tree=False):
|
||||
|
||||
filters = [['status', '!=', 'Left']]
|
||||
filters = [['status', '=', 'Active']]
|
||||
if company and company != 'All Companies':
|
||||
filters.append(['company', '=', company])
|
||||
|
||||
|
@ -3,7 +3,7 @@ frappe.listview_settings['Employee'] = {
|
||||
filters: [["status","=", "Active"]],
|
||||
get_indicator: function(doc) {
|
||||
var indicator = [__(doc.status), frappe.utils.guess_colour(doc.status), "status,=," + doc.status];
|
||||
indicator[1] = {"Active": "green", "Temporary Leave": "red", "Left": "gray"}[doc.status];
|
||||
indicator[1] = {"Active": "green", "Inactive": "red", "Left": "gray"}[doc.status];
|
||||
return indicator;
|
||||
}
|
||||
};
|
||||
|
@ -11,12 +11,12 @@ from erpnext.hr.utils import update_employee
|
||||
|
||||
class EmployeePromotion(Document):
|
||||
def validate(self):
|
||||
if frappe.get_value("Employee", self.employee, "status") == "Left":
|
||||
frappe.throw(_("Cannot promote Employee with status Left"))
|
||||
if frappe.get_value("Employee", self.employee, "status") != "Active":
|
||||
frappe.throw(_("Cannot promote Employee with status Left or Inactive"))
|
||||
|
||||
def before_submit(self):
|
||||
if getdate(self.promotion_date) > getdate():
|
||||
frappe.throw(_("Employee Promotion cannot be submitted before Promotion Date "),
|
||||
frappe.throw(_("Employee Promotion cannot be submitted before Promotion Date"),
|
||||
frappe.DocstatusTransitionError)
|
||||
|
||||
def on_submit(self):
|
||||
|
@ -11,12 +11,12 @@ from erpnext.hr.utils import update_employee
|
||||
|
||||
class EmployeeTransfer(Document):
|
||||
def validate(self):
|
||||
if frappe.get_value("Employee", self.employee, "status") == "Left":
|
||||
frappe.throw(_("Cannot transfer Employee with status Left"))
|
||||
if frappe.get_value("Employee", self.employee, "status") != "Active":
|
||||
frappe.throw(_("Cannot transfer Employee with status Left or Inactive"))
|
||||
|
||||
def before_submit(self):
|
||||
if getdate(self.transfer_date) > getdate():
|
||||
frappe.throw(_("Employee Transfer cannot be submitted before Transfer Date "),
|
||||
frappe.throw(_("Employee Transfer cannot be submitted before Transfer Date"),
|
||||
frappe.DocstatusTransitionError)
|
||||
|
||||
def on_submit(self):
|
||||
|
@ -10,8 +10,8 @@ from frappe.utils import getdate
|
||||
|
||||
class RetentionBonus(Document):
|
||||
def validate(self):
|
||||
if frappe.get_value('Employee', self.employee, 'status') == 'Left':
|
||||
frappe.throw(_('Cannot create Retention Bonus for left Employees'))
|
||||
if frappe.get_value('Employee', self.employee, 'status') != 'Active':
|
||||
frappe.throw(_('Cannot create Retention Bonus for Left or Inactive Employees'))
|
||||
if getdate(self.bonus_payment_date) < getdate():
|
||||
frappe.throw(_('Bonus Payment Date cannot be a past date'))
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user