diff --git a/erpnext/education/doctype/student_group/student_group.py b/erpnext/education/doctype/student_group/student_group.py index 2925469312d..8b61c899bc0 100644 --- a/erpnext/education/doctype/student_group/student_group.py +++ b/erpnext/education/doctype/student_group/student_group.py @@ -26,8 +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 cint(self.max_strength) < 0: + frappe.throw(_("""Max strength cannot be less 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)) diff --git a/erpnext/education/doctype/student_group/test_records.json b/erpnext/education/doctype/student_group/test_records.json index c36c9b297c4..4c4e042b152 100644 --- a/erpnext/education/doctype/student_group/test_records.json +++ b/erpnext/education/doctype/student_group/test_records.json @@ -5,26 +5,30 @@ "program": "_TP1", "batch": "_Batch 1", "academic_year": "2014-2015", - "academic_term": "2014-2015 (_Test Academic Term)" + "academic_term": "2014-2015 (_Test Academic Term)", + "max_strength": 0 }, { "student_group_name": "Course-TC101-2014-2015 (_Test Academic Term)", "group_based_on": "Course", "course": "TC101", "academic_year": "2014-2015", - "academic_term": "2014-2015 (_Test Academic Term)" + "academic_term": "2014-2015 (_Test Academic Term)", + "max_strength": 0 }, { "student_group_name": "Course-TC102-2014-2015 (_Test Academic Term)", "group_based_on": "Course", "course": "TC102", "academic_year": "2014-2015", - "academic_term": "2014-2015 (_Test Academic Term)" + "academic_term": "2014-2015 (_Test Academic Term)", + "max_strength": 0 }, { "student_group_name": "Activity-2014-2015 (_Test Academic Term)", "group_based_on": "Activity", "academic_year": "2014-2015", - "academic_term": "2014-2015 (_Test Academic Term)" + "academic_term": "2014-2015 (_Test Academic Term)", + "max_strength": 0 } ] \ No newline at end of file