[leave-allocation] can cancel and re-submit or make a new one, fixes frappe/erpnext#3042

This commit is contained in:
Rushabh Mehta 2015-04-15 15:02:29 +05:30
parent 850ee3c53d
commit 2dea40f7be

View File

@ -89,12 +89,3 @@ class LeaveAllocation(Document):
frappe.db.set(self,'carry_forwarded_leaves',flt(leave_det['carry_forwarded_leaves']))
frappe.db.set(self,'total_leaves_allocated',flt(leave_det['total_leaves_allocated']))
def check_for_leave_application(self):
exists = frappe.db.sql("""select name from `tabLeave Application`
where employee=%s and leave_type=%s and fiscal_year=%s and docstatus=1""",
(self.employee, self.leave_type, self.fiscal_year))
if exists:
frappe.msgprint(_("Cannot cancel because Employee {0} is already approved for {1}").format(self.employee,
self.leave_type))
frappe.throw('<a href="#Form/Leave Application/{0}">{0}</a>'.format(exists[0][0]))