feat: Added check for duplicate course enrollment
diff --git a/erpnext/education/doctype/course_enrollment/course_enrollment.py b/erpnext/education/doctype/course_enrollment/course_enrollment.py
index a70d40d..d521828 100644
--- a/erpnext/education/doctype/course_enrollment/course_enrollment.py
+++ b/erpnext/education/doctype/course_enrollment/course_enrollment.py
@@ -20,4 +20,13 @@
progress = []
for topic in topics:
progress.append(student.get_topic_progress(self.name, topic))
- return reduce(lambda x,y: x+y, progress) # Flatten out the List
\ No newline at end of file
+ return reduce(lambda x,y: x+y, progress) # Flatten out the List
+
+ def validate_duplication(self):
+ enrollment = frappe.get_all("Course Enrollment", filters={
+ "student": self.student,
+ "course": self.course,
+ "program_enrollment": self.program_enrollment
+ })
+ if enrollment:
+ frappe.throw(_("Student is already enrolled."))
\ No newline at end of file