Merge pull request #20607 from khushalti/develop

fix: validation on max group strength student group form
This commit is contained in:
Deepesh Garg 2020-02-20 13:23:04 +05:30 committed by GitHub
commit a871d30a7d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -26,6 +26,8 @@ class StudentGroup(Document):
frappe.throw(_("Please select Program"))
def validate_strength(self):
if self.max_strength <= 0:
frappe.throw(_("""Max strength must be greater than zero."""))
if self.max_strength and len(self.students) > self.max_strength:
frappe.throw(_("""Cannot enroll more than {0} students for this student group.""").format(self.max_strength))