diff --git a/erpnext/education/api.py b/erpnext/education/api.py index 99fb36e52c..2bd2c2334d 100644 --- a/erpnext/education/api.py +++ b/erpnext/education/api.py @@ -88,16 +88,14 @@ def make_attendance_records(student, student_name, status, course_schedule=None, :param course_schedule: Course Schedule. :param status: Status (Present/Absent) """ - student_attendance_list = frappe.get_list("Student Attendance", fields = ['name'], filters = { + student_attendance = frappe.get_doc({ + "doctype": "Student Attendance", "student": student, "course_schedule": course_schedule, "student_group": student_group, "date": date }) - - if student_attendance_list: - student_attendance = frappe.get_doc("Student Attendance", student_attendance_list[0]) - else: + if not student_attendance: student_attendance = frappe.new_doc("Student Attendance") student_attendance.student = student student_attendance.student_name = student_name diff --git a/erpnext/education/doctype/student_attendance/student_attendance.json b/erpnext/education/doctype/student_attendance/student_attendance.json index 07530b40a0..7077d23b14 100644 --- a/erpnext/education/doctype/student_attendance/student_attendance.json +++ b/erpnext/education/doctype/student_attendance/student_attendance.json @@ -3,7 +3,7 @@ "allow_guest_to_view": 0, "allow_import": 1, "allow_rename": 0, - "autoname": "SA.######", + "autoname": "", "beta": 0, "creation": "2015-11-05 15:20:23.045996", "custom": 0, @@ -40,7 +40,7 @@ "remember_last_selected_value": 0, "report_hide": 0, "reqd": 1, - "search_index": 0, + "search_index": 1, "set_only_once": 0, "unique": 0 }, @@ -101,7 +101,7 @@ "remember_last_selected_value": 0, "report_hide": 0, "reqd": 1, - "search_index": 0, + "search_index": 1, "set_only_once": 0, "unique": 0 }, @@ -239,7 +239,7 @@ "issingle": 0, "istable": 0, "max_attachments": 0, - "modified": "2017-11-10 19:09:51.041960", + "modified": "2018-07-27 10:48:22.301531", "modified_by": "Administrator", "module": "Education", "name": "Student Attendance",