Browse Source

fix: make Exit Interview submittable

develop
Rucha Mahabal 3 years ago
parent
commit
09fdfed163
  1. 17
      erpnext/hr/doctype/exit_interview/exit_interview.json
  2. 12
      erpnext/hr/doctype/exit_interview/exit_interview.py

17
erpnext/hr/doctype/exit_interview/exit_interview.json

@ -32,7 +32,8 @@
"interviewers",
"text_editor_12",
"employee_status_section",
"employee_status"
"employee_status",
"amended_from"
],
"fields": [
{
@ -188,7 +189,7 @@
"in_list_view": 1,
"in_standard_filter": 1,
"label": "Status",
"options": "Pending\nScheduled\nCompleted",
"options": "Pending\nScheduled\nCompleted\nCancelled",
"reqd": 1
},
{
@ -203,11 +204,21 @@
"label": "Final Decision",
"mandatory_depends_on": "eval:doc.status==='Completed';",
"options": "\nEmployee Retained\nExit Confirmed"
},
{
"fieldname": "amended_from",
"fieldtype": "Link",
"label": "Amended From",
"no_copy": 1,
"options": "Exit Interview",
"print_hide": 1,
"read_only": 1
}
],
"index_web_pages_for_search": 1,
"is_submittable": 1,
"links": [],
"modified": "2021-12-05 17:17:20.033950",
"modified": "2021-12-05 17:49:44.839277",
"modified_by": "Administrator",
"module": "HR",
"name": "Exit Interview",

12
erpnext/hr/doctype/exit_interview/exit_interview.py

@ -12,6 +12,7 @@ from erpnext.hr.doctype.employee.employee import get_employee_email
class ExitInterview(Document):
def validate(self):
self.validate_relieving_date()
self.validate_duplicate_interview()
self.set_employee_email()
def validate_relieving_date(self):
@ -20,10 +21,21 @@ class ExitInterview(Document):
get_link_to_form('Employee', self.employee)),
title=_('Relieving Date Missing'))
def validate_duplicate_interview(self):
doc = frappe.db.exists('Exit Interview', {'employee': self.employee, 'name': ('!=', self.name)})
if doc:
frappe.throw(_('Exit Interview {0} already scheduled for Employee: {1}').format(
get_link_to_form('Exit Interview', doc), frappe.bold(self.employee)),
title=_('Duplicate Document'))
def set_employee_email(self):
employee = frappe.get_doc('Employee', self.employee)
self.email = get_employee_email(employee)
def on_submit(self):
if self.status != 'Completed':
frappe.throw(_('Only Completed documents can be submitted'))
@frappe.whitelist()
def send_exit_questionnaire(exit_interview):

Loading…
Cancel
Save