fix in the report (#9167)

This commit is contained in:
Manas Solanki 2017-06-07 11:29:27 +05:30 committed by Nabin Hait
parent c196d740e5
commit 2a0d650735

View File

@ -22,13 +22,14 @@ def execute(filters=None):
if not student_list: if not student_list:
return columns, [] return columns, []
group_roll_no_map = get_student_roll_no(academic_year, program, student_batch_name)
student_map = get_student_details(student_list) student_map = get_student_details(student_list)
guardian_map = get_guardian_map(student_list) guardian_map = get_guardian_map(student_list)
for d in program_enrollments: for d in program_enrollments:
student_details = student_map.get(d.student) student_details = student_map.get(d.student)
row = [d.student, d.student_name, student_details.get("student_mobile_number"), student_details.get("student_email_id"), row = [group_roll_no_map.get(d.student), d.student, d.student_name, student_details.get("student_mobile_number"),\
student_details.get("address")] student_details.get("student_email_id"), student_details.get("address")]
student_guardians = guardian_map.get(d.student) student_guardians = guardian_map.get(d.student)
@ -44,7 +45,8 @@ def execute(filters=None):
def get_columns(): def get_columns():
columns = [ columns = [
_(" Group Roll No") + "::60",
_("Student ID") + ":Link/Student:90", _("Student ID") + ":Link/Student:90",
_("Student Name") + "::150", _("Student Name") + "::150",
_("Student Mobile No.") + "::110", _("Student Mobile No.") + "::110",
@ -93,4 +95,13 @@ def get_guardian_map(student_list):
guardian["email_address"] = guardian_email_id.get(guardian.guardian) guardian["email_address"] = guardian_email_id.get(guardian.guardian)
guardian_map.setdefault(guardian.parent, []).append(guardian) guardian_map.setdefault(guardian.parent, []).append(guardian)
return guardian_map return guardian_map
def get_student_roll_no(academic_year, program, batch):
student_group = frappe.get_all("Student Group",
filters={"academic_year":academic_year, "program":program, "batch":batch})
if student_group:
roll_no_dict = dict(frappe.db.sql('''select student, group_roll_number from `tabStudent Group Student` where parent=%s''',
(student_group[0].name)))
return roll_no_dict
return {}