changes according to the workflow (#13160)
This commit is contained in:
parent
4417cb0006
commit
950fff0ba1
@ -34,14 +34,13 @@ class LeaveApplication(Document):
|
|||||||
self.validate_salary_processed_days()
|
self.validate_salary_processed_days()
|
||||||
self.validate_attendance()
|
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):
|
def on_submit(self):
|
||||||
|
|
||||||
self.validate_back_dated_application()
|
self.validate_back_dated_application()
|
||||||
|
|
||||||
def on_cancel(self):
|
|
||||||
# notify leave applier about cancellation
|
|
||||||
self.notify_employee("cancelled")
|
|
||||||
|
|
||||||
def validate_dates(self):
|
def validate_dates(self):
|
||||||
if self.from_date and self.to_date and (getdate(self.to_date) < getdate(self.from_date)):
|
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"))
|
frappe.throw(_("To date cannot be before from date"))
|
||||||
@ -217,7 +216,8 @@ class LeaveApplication(Document):
|
|||||||
# for post in messages
|
# for post in messages
|
||||||
"message": _get_message(url=True),
|
"message": _get_message(url=True),
|
||||||
"message_to": employee.user_id,
|
"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):
|
def _get_message(url=False):
|
||||||
|
Loading…
Reference in New Issue
Block a user