From 1118ee07a8f56337cce2dd2ca892f204a54b8028 Mon Sep 17 00:00:00 2001 From: indictrans Date: Sat, 15 Feb 2020 17:37:39 +0530 Subject: [PATCH 1/4] fix:Future date of birth accepted at Sibling Detail section in Student form #20619 --- erpnext/education/doctype/student/student.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/erpnext/education/doctype/student/student.py b/erpnext/education/doctype/student/student.py index 99c4c0e908..d7d35ca122 100644 --- a/erpnext/education/doctype/student/student.py +++ b/erpnext/education/doctype/student/student.py @@ -22,6 +22,10 @@ class Student(Document): self.update_student_name_in_linked_doctype() def validate_dates(self): + for sibling in self.siblings: + if sibling.date_of_birth and getdate(sibling.date_of_birth) >= getdate(today()): + frappe.throw(_("Sibling Date of Birth cannot be greater than today at row #{0} ").format(sibling.idx)) + if self.date_of_birth and getdate(self.date_of_birth) >= getdate(today()): frappe.throw(_("Date of Birth cannot be greater than today.")) From ad5da823e12e6f3cfd2a67e33a16343622a7d327 Mon Sep 17 00:00:00 2001 From: indictrans Date: Sun, 16 Feb 2020 22:59:41 +0530 Subject: [PATCH 2/4] fix:Future date of birth accepted at Sibling Detail section in Student form #20619 --- erpnext/education/doctype/student/student.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/erpnext/education/doctype/student/student.py b/erpnext/education/doctype/student/student.py index d7d35ca122..1a870a3cbe 100644 --- a/erpnext/education/doctype/student/student.py +++ b/erpnext/education/doctype/student/student.py @@ -23,8 +23,8 @@ class Student(Document): def validate_dates(self): for sibling in self.siblings: - if sibling.date_of_birth and getdate(sibling.date_of_birth) >= getdate(today()): - frappe.throw(_("Sibling Date of Birth cannot be greater than today at row #{0} ").format(sibling.idx)) + if sibling.date_of_birth and getdate(sibling.date_of_birth) >= getdate(): + frappe.throw(_("Row {0}:Sibling Date of Birth cannot be greater than today").format(sibling.idx)) if self.date_of_birth and getdate(self.date_of_birth) >= getdate(today()): frappe.throw(_("Date of Birth cannot be greater than today.")) From 68fa65edd171f9ec44d0cae5c030ded70f07a492 Mon Sep 17 00:00:00 2001 From: indictrans Date: Mon, 17 Feb 2020 14:55:56 +0530 Subject: [PATCH 3/4] fix: Throw message --- erpnext/education/doctype/student/student.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/education/doctype/student/student.py b/erpnext/education/doctype/student/student.py index 45e848b55e..81fa7f7fae 100644 --- a/erpnext/education/doctype/student/student.py +++ b/erpnext/education/doctype/student/student.py @@ -24,7 +24,7 @@ class Student(Document): def validate_dates(self): for sibling in self.siblings: if sibling.date_of_birth and getdate(sibling.date_of_birth) >= getdate(): - frappe.throw(_("Row {0}:Sibling Date of Birth cannot be greater than today").format(sibling.idx)) + frappe.throw(_("Row {0}:Sibling Date of Birth cannot be greater than today.").format(sibling.idx)) if self.date_of_birth and getdate(self.date_of_birth) >= getdate(today()): frappe.throw(_("Date of Birth cannot be greater than today.")) From aaea4e60b6996bb9c63671e689643317a8ef09d5 Mon Sep 17 00:00:00 2001 From: Deepesh Garg <42651287+deepeshgarg007@users.noreply.github.com> Date: Sun, 23 Feb 2020 20:59:05 +0530 Subject: [PATCH 4/4] fix: Validation condition --- erpnext/education/doctype/student/student.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/education/doctype/student/student.py b/erpnext/education/doctype/student/student.py index 81fa7f7fae..6b545d99be 100644 --- a/erpnext/education/doctype/student/student.py +++ b/erpnext/education/doctype/student/student.py @@ -23,7 +23,7 @@ class Student(Document): def validate_dates(self): for sibling in self.siblings: - if sibling.date_of_birth and getdate(sibling.date_of_birth) >= getdate(): + if sibling.date_of_birth and getdate(sibling.date_of_birth) > getdate(): frappe.throw(_("Row {0}:Sibling Date of Birth cannot be greater than today.").format(sibling.idx)) if self.date_of_birth and getdate(self.date_of_birth) >= getdate(today()):