Merge pull request #20595 from anuradha-8/develop

fix: to date cannot be less than from date validation on student leave application form
This commit is contained in:
Deepesh Garg 2020-02-17 10:57:29 +05:30 committed by GitHub
commit 5894c2d005
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -7,9 +7,11 @@ import frappe
from frappe import _ from frappe import _
from frappe.utils import get_link_to_form from frappe.utils import get_link_to_form
from frappe.model.document import Document from frappe.model.document import Document
from frappe import throw, _
class StudentLeaveApplication(Document): class StudentLeaveApplication(Document):
def validate(self): def validate(self):
self.validate_dates()
self.validate_duplicate() self.validate_duplicate()
def validate_duplicate(self): def validate_duplicate(self):
@ -30,3 +32,7 @@ class StudentLeaveApplication(Document):
link = get_link_to_form("Student Leave Application", data[0].name) link = get_link_to_form("Student Leave Application", data[0].name)
frappe.throw(_("Leave application {0} already exists against the student {1}") frappe.throw(_("Leave application {0} already exists against the student {1}")
.format(link, self.student)) .format(link, self.student))
def validate_dates(self):
if self.to_date < self.from_date :
throw(_("To Date cannot be less than From Date"))