validate the duplicate assessment criteria
diff --git a/erpnext/schools/doctype/assessment_plan/assessment_plan.py b/erpnext/schools/doctype/assessment_plan/assessment_plan.py
index f988886..a09f3ee 100644
--- a/erpnext/schools/doctype/assessment_plan/assessment_plan.py
+++ b/erpnext/schools/doctype/assessment_plan/assessment_plan.py
@@ -11,6 +11,7 @@
def validate(self):
self.validate_overlap()
self.validate_max_score()
+ self.validate_assessment_criteria()
def validate_overlap(self):
"""Validates overlap for Student Group, Instructor, Room"""
@@ -37,3 +38,13 @@
max_score += d.maximum_score
if self.maximum_assessment_score != max_score:
frappe.throw(_("Sum of Scores of Assessment Criteria needs to be {0}.".format(self.maximum_assessment_score)))
+
+ def validate_assessment_criteria(self):
+ assessment_criteria_list = frappe.db.sql_list(''' select apc.assessment_criteria
+ from `tabAssessment Plan` ap , `tabAssessment Plan Criteria` apc
+ where ap.name = apc.parent and ap.course=%s and ap.student_group=%s and ap.assessment_group=%s
+ and ap.name != %s''', (self.course, self.student_group, self.assessment_group, self.name))
+ for d in self.assessment_criteria:
+ if d.assessment_criteria in assessment_criteria_list:
+ frappe.throw(_("You have already assessed for the assessment criteria {}.")
+ .format(frappe.bold(d.assessment_criteria)))