feat: add Inactive status to Employee

This commit is contained in:
Rucha Mahabal 2021-06-12 13:33:21 +05:30
parent 42d72b55b8
commit efd7d584b2
7 changed files with 14 additions and 14 deletions

View File

@ -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) frappe.throw(_("{0} {1} is frozen").format(party_type, party_name), PartyFrozen)
elif party_type == "Employee": 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) frappe.msgprint(_("{0} {1} is not active").format(party_type, party_name), alert=True)
def get_timeline_data(doctype, name): def get_timeline_data(doctype, name):

View File

@ -207,7 +207,7 @@
"label": "Status", "label": "Status",
"oldfieldname": "status", "oldfieldname": "status",
"oldfieldtype": "Select", "oldfieldtype": "Select",
"options": "Active\nLeft", "options": "Active\nInactive\nLeft",
"reqd": 1, "reqd": 1,
"search_index": 1 "search_index": 1
}, },
@ -813,7 +813,7 @@
"idx": 24, "idx": 24,
"image_field": "image", "image_field": "image",
"links": [], "links": [],
"modified": "2021-01-02 16:54:33.477439", "modified": "2021-06-12 11:31:37.730760",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "HR", "module": "HR",
"name": "Employee", "name": "Employee",

View File

@ -37,7 +37,7 @@ class Employee(NestedSet):
def validate(self): def validate(self):
from erpnext.controllers.status_updater import validate_status 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.employee = self.name
self.set_employee_name() self.set_employee_name()
@ -478,7 +478,7 @@ def get_employee_emails(employee_list):
@frappe.whitelist() @frappe.whitelist()
def get_children(doctype, parent=None, company=None, is_root=False, is_tree=False): 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': if company and company != 'All Companies':
filters.append(['company', '=', company]) filters.append(['company', '=', company])

View File

@ -3,7 +3,7 @@ frappe.listview_settings['Employee'] = {
filters: [["status","=", "Active"]], filters: [["status","=", "Active"]],
get_indicator: function(doc) { get_indicator: function(doc) {
var indicator = [__(doc.status), frappe.utils.guess_colour(doc.status), "status,=," + doc.status]; 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; return indicator;
} }
}; };

View File

@ -11,12 +11,12 @@ from erpnext.hr.utils import update_employee
class EmployeePromotion(Document): class EmployeePromotion(Document):
def validate(self): def validate(self):
if frappe.get_value("Employee", self.employee, "status") == "Left": if frappe.get_value("Employee", self.employee, "status") != "Active":
frappe.throw(_("Cannot promote Employee with status Left")) frappe.throw(_("Cannot promote Employee with status Left or Inactive"))
def before_submit(self): def before_submit(self):
if getdate(self.promotion_date) > getdate(): 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) frappe.DocstatusTransitionError)
def on_submit(self): def on_submit(self):

View File

@ -11,12 +11,12 @@ from erpnext.hr.utils import update_employee
class EmployeeTransfer(Document): class EmployeeTransfer(Document):
def validate(self): def validate(self):
if frappe.get_value("Employee", self.employee, "status") == "Left": if frappe.get_value("Employee", self.employee, "status") != "Active":
frappe.throw(_("Cannot transfer Employee with status Left")) frappe.throw(_("Cannot transfer Employee with status Left or Inactive"))
def before_submit(self): def before_submit(self):
if getdate(self.transfer_date) > getdate(): 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) frappe.DocstatusTransitionError)
def on_submit(self): def on_submit(self):

View File

@ -10,8 +10,8 @@ from frappe.utils import getdate
class RetentionBonus(Document): class RetentionBonus(Document):
def validate(self): def validate(self):
if frappe.get_value('Employee', self.employee, 'status') == 'Left': if frappe.get_value('Employee', self.employee, 'status') != 'Active':
frappe.throw(_('Cannot create Retention Bonus for left Employees')) frappe.throw(_('Cannot create Retention Bonus for Left or Inactive Employees'))
if getdate(self.bonus_payment_date) < getdate(): if getdate(self.bonus_payment_date) < getdate():
frappe.throw(_('Bonus Payment Date cannot be a past date')) frappe.throw(_('Bonus Payment Date cannot be a past date'))