From 57d33f9ce6a9e7cc9148d63bd6299d3f2705de82 Mon Sep 17 00:00:00 2001 From: Govind S Menokee Date: Tue, 11 Feb 2020 11:23:16 +0530 Subject: [PATCH] fix: get_students not respecting the program The get_students function is not taking into account the program for which the fee needs to be created. If a student is enrolled for multiple programs then the fee schedule pull up the wrong count of students. --- erpnext/education/doctype/fee_schedule/fee_schedule.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/erpnext/education/doctype/fee_schedule/fee_schedule.py b/erpnext/education/doctype/fee_schedule/fee_schedule.py index a42800a80d5..bba101f2f1f 100644 --- a/erpnext/education/doctype/fee_schedule/fee_schedule.py +++ b/erpnext/education/doctype/fee_schedule/fee_schedule.py @@ -123,9 +123,11 @@ def get_students(student_group, academic_year, academic_term=None, student_categ students = frappe.db.sql(""" select pe.student, pe.student_name, pe.program, pe.student_batch_name - from `tabStudent Group Student` sgs, `tabProgram Enrollment` pe + from `tabStudent Group Student` sgs, `tabProgram Enrollment` pe, `tabStudent Group` sg where pe.student = sgs.student and pe.academic_year = %s + and sg.program = pe.program + and sg.name = sgs.parent and sgs.parent = %s and sgs.active = 1 {conditions} """.format(conditions=conditions), (academic_year, student_group), as_dict=1)