changes according to the workflow (#13160)

This commit is contained in:
Zarrar 2018-03-05 11:30:53 +05:30 committed by Nabin Hait
parent 4417cb0006
commit 950fff0ba1

View File

@ -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):