From 93e8fc183335c90e8c65a3ec4301d200a76fa360 Mon Sep 17 00:00:00 2001 From: Anuradha Kalaskar Date: Tue, 18 Feb 2020 11:32:35 +0530 Subject: [PATCH] fix: date of birth cannot be greater than today on student application form --- .../education/doctype/student_applicant/student_applicant.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/erpnext/education/doctype/student_applicant/student_applicant.py b/erpnext/education/doctype/student_applicant/student_applicant.py index 6d0957c502..ab947807dd 100644 --- a/erpnext/education/doctype/student_applicant/student_applicant.py +++ b/erpnext/education/doctype/student_applicant/student_applicant.py @@ -29,10 +29,15 @@ class StudentApplicant(Document): set_name_by_naming_series(self) def validate(self): + self.validate_dates() self.title = " ".join(filter(None, [self.first_name, self.middle_name, self.last_name])) if self.student_admission and self.program and self.date_of_birth: self.validation_from_student_admission() + def validate_dates(self): + if self.date_of_birth and getdate(self.date_of_birth) >= getdate(): + frappe.throw(_("Date of Birth cannot be greater than today.")) + def on_update_after_submit(self): student = frappe.get_list("Student", filters= {"student_applicant": self.name}) if student: