feat: update Exit Interview date in employee master on submission
This commit is contained in:
parent
e30187f246
commit
d67536cc8d
@ -21,7 +21,11 @@ def get_data():
|
||||
},
|
||||
{
|
||||
'label': _('Lifecycle'),
|
||||
'items': ['Employee Transfer', 'Employee Promotion', 'Employee Separation', 'Employee Grievance']
|
||||
'items': ['Employee Transfer', 'Employee Promotion', 'Employee Grievance']
|
||||
},
|
||||
{
|
||||
'label': _('Exit'),
|
||||
'items': ['Employee Separation', 'Exit Interview', 'Full and Final Statement']
|
||||
},
|
||||
{
|
||||
'label': _('Shift'),
|
||||
|
@ -22,7 +22,11 @@ class ExitInterview(Document):
|
||||
title=_('Relieving Date Missing'))
|
||||
|
||||
def validate_duplicate_interview(self):
|
||||
doc = frappe.db.exists('Exit Interview', {'employee': self.employee, 'name': ('!=', self.name)})
|
||||
doc = frappe.db.exists('Exit Interview', {
|
||||
'employee': self.employee,
|
||||
'name': ('!=', self.name),
|
||||
'docstatus': ('!=', 2)
|
||||
})
|
||||
if doc:
|
||||
frappe.throw(_('Exit Interview {0} already scheduled for Employee: {1}').format(
|
||||
get_link_to_form('Exit Interview', doc), frappe.bold(self.employee)),
|
||||
@ -36,6 +40,18 @@ class ExitInterview(Document):
|
||||
if self.status != 'Completed':
|
||||
frappe.throw(_('Only Completed documents can be submitted'))
|
||||
|
||||
self.update_interview_date_in_employee()
|
||||
|
||||
def on_cancel(self):
|
||||
self.update_interview_date_in_employee()
|
||||
self.db_set('status', 'Cancelled')
|
||||
|
||||
def update_interview_date_in_employee(self):
|
||||
if self.docstatus == 1:
|
||||
frappe.db.set_value('Employee', self.employee, 'held_on', self.date)
|
||||
elif self.docstatus == 2:
|
||||
frappe.db.set_value('Employee', self.employee, 'held_on', None)
|
||||
|
||||
|
||||
@frappe.whitelist()
|
||||
def send_exit_questionnaire(interviews):
|
||||
|
Loading…
x
Reference in New Issue
Block a user