From 950fff0ba10f53754226a432514334a40b88f4c2 Mon Sep 17 00:00:00 2001 From: Zarrar Date: Mon, 5 Mar 2018 11:30:53 +0530 Subject: [PATCH] changes according to the workflow (#13160) --- .../doctype/leave_application/leave_application.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/erpnext/hr/doctype/leave_application/leave_application.py b/erpnext/hr/doctype/leave_application/leave_application.py index 22fd0e5f98..eb739466d6 100755 --- a/erpnext/hr/doctype/leave_application/leave_application.py +++ b/erpnext/hr/doctype/leave_application/leave_application.py @@ -34,14 +34,13 @@ class LeaveApplication(Document): self.validate_salary_processed_days() self.validate_attendance() + if hasattr(self, "workflow_state") and self.workflow_state == "Rejected": + # notify leave applier about rejection + self.notify_employee() + def on_submit(self): - self.validate_back_dated_application() - def on_cancel(self): - # notify leave applier about cancellation - self.notify_employee("cancelled") - def validate_dates(self): if self.from_date and self.to_date and (getdate(self.to_date) < getdate(self.from_date)): frappe.throw(_("To date cannot be before from date")) @@ -217,7 +216,8 @@ class LeaveApplication(Document): # for post in messages "message": _get_message(url=True), "message_to": employee.user_id, - "subject": (_("Leave Application") + ": %s - %s") % (self.name) + "subject": (_("Leave Application") + ": %s - %s") % (self.name, + self.workflow_state if hasattr(self, "workflow_state") else "") }) def _get_message(url=False):