Merge pull request #7551 from neilLasrado/assessment

Added ability to disable a student in student group/student batch
diff --git a/erpnext/patches.txt b/erpnext/patches.txt
index 2a741d1..9e37081 100644
--- a/erpnext/patches.txt
+++ b/erpnext/patches.txt
@@ -365,4 +365,5 @@
 erpnext.patches.v7_2.update_salary_slips
 erpnext.patches.v7_2.delete_fleet_management_module_def
 erpnext.patches.v7_2.contact_address_links
+erpnext.patches.v7_2.mark_students_active
 erpnext.patches.v7_2.set_null_value_to_fields
diff --git a/erpnext/patches/v7_2/mark_students_active.py b/erpnext/patches/v7_2/mark_students_active.py
new file mode 100644
index 0000000..12057ed
--- /dev/null
+++ b/erpnext/patches/v7_2/mark_students_active.py
@@ -0,0 +1,7 @@
+import frappe
+
+def execute():
+    frappe.reload_doc('schools', 'doctype', 'student_batch_student')
+    frappe.reload_doc('schools', 'doctype', 'student_group_student')
+    frappe.db.sql("update `tabStudent Batch Student` set active=1")
+    frappe.db.sql("update `tabStudent Group Student` set active=1")
diff --git a/erpnext/schools/api.py b/erpnext/schools/api.py
index e31a944..81ae9c4 100644
--- a/erpnext/schools/api.py
+++ b/erpnext/schools/api.py
@@ -88,7 +88,8 @@
 
 	:param student_batch: Student Batch.
 	"""
-	students = frappe.get_list("Student Batch Student", fields=["student", "student_name", "idx"] , filters={"parent": student_batch}, order_by= "idx")
+	students = frappe.get_list("Student Batch Student", fields=["student", "student_name", "idx"] , 
+		filters={"parent": student_batch, "active": 1}, order_by= "idx")
 	return students
 
 @frappe.whitelist()
@@ -97,7 +98,8 @@
 
 	:param student_group: Student Group.
 	"""
-	students = frappe.get_list("Student Group Student", fields=["student", "student_name"] , filters={"parent": student_group}, order_by= "idx")
+	students = frappe.get_list("Student Group Student", fields=["student", "student_name"] , 
+		filters={"parent": student_group, "active": 1}, order_by= "idx")
 	return students
 
 @frappe.whitelist()
diff --git a/erpnext/schools/doctype/student_attendance_tool/student_attendance_tool.py b/erpnext/schools/doctype/student_attendance_tool/student_attendance_tool.py
index 30a692c..58588a9 100644
--- a/erpnext/schools/doctype/student_attendance_tool/student_attendance_tool.py
+++ b/erpnext/schools/doctype/student_attendance_tool/student_attendance_tool.py
@@ -18,11 +18,12 @@
 		student_group = frappe.db.get_value("Course Schedule", course_schedule, "student_group")
 		if student_group:
 			student_list = frappe.get_list("Student Group Student", fields=["student", "student_name", "idx"] , \
-			filters={"parent": student_group}, order_by= "idx")
+			filters={"parent": student_group, "active": 1}, order_by= "idx")
 		else:
 			student_batch = frappe.db.get_value("Course Schedule", course_schedule, "student_batch")
 	if not student_list: 
-		student_list = frappe.get_list("Student Batch Student", fields=["student", "student_name", "idx"] , filters={"parent": student_batch}, order_by= "idx")
+		student_list = frappe.get_list("Student Batch Student", fields=["student", "student_name", "idx"] , 
+			filters={"parent": student_batch, "active": 1}, order_by= "idx")
 	
 	if course_schedule:
 		student_attendance_list= frappe.db.sql("""select student, status from `tabStudent Attendance` where \
diff --git a/erpnext/schools/doctype/student_batch_student/student_batch_student.json b/erpnext/schools/doctype/student_batch_student/student_batch_student.json
index c9b1b01..5933f9e 100644
--- a/erpnext/schools/doctype/student_batch_student/student_batch_student.json
+++ b/erpnext/schools/doctype/student_batch_student/student_batch_student.json
@@ -14,6 +14,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "student", 
    "fieldtype": "Link", 
    "hidden": 0, 
@@ -21,6 +22,7 @@
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 1, 
+   "in_standard_filter": 0, 
    "label": "Student", 
    "length": 0, 
    "no_copy": 0, 
@@ -30,6 +32,7 @@
    "print_hide": 0, 
    "print_hide_if_no_value": 0, 
    "read_only": 0, 
+   "remember_last_selected_value": 0, 
    "report_hide": 0, 
    "reqd": 1, 
    "search_index": 0, 
@@ -40,13 +43,17 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
-   "fieldname": "column_break_2", 
-   "fieldtype": "Column Break", 
+   "columns": 0, 
+   "default": "1", 
+   "fieldname": "active", 
+   "fieldtype": "Check", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Active", 
    "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
@@ -54,6 +61,7 @@
    "print_hide": 0, 
    "print_hide_if_no_value": 0, 
    "read_only": 0, 
+   "remember_last_selected_value": 0, 
    "report_hide": 0, 
    "reqd": 0, 
    "search_index": 0, 
@@ -64,6 +72,34 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "column_break_2", 
+   "fieldtype": "Column Break", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "student_name", 
    "fieldtype": "Data", 
    "hidden": 0, 
@@ -71,6 +107,7 @@
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 1, 
+   "in_standard_filter": 0, 
    "label": "Student Name", 
    "length": 0, 
    "no_copy": 0, 
@@ -80,6 +117,7 @@
    "print_hide": 0, 
    "print_hide_if_no_value": 0, 
    "read_only": 1, 
+   "remember_last_selected_value": 0, 
    "report_hide": 0, 
    "reqd": 0, 
    "search_index": 0, 
@@ -97,8 +135,8 @@
  "issingle": 0, 
  "istable": 1, 
  "max_attachments": 0, 
- "modified": "2016-07-22 03:27:52.913126", 
- "modified_by": "Administrator", 
+ "modified": "2017-01-20 18:26:51.242924", 
+ "modified_by": "neil@frappe.io", 
  "module": "Schools", 
  "name": "Student Batch Student", 
  "name_case": "", 
@@ -109,5 +147,6 @@
  "read_only_onload": 0, 
  "sort_field": "modified", 
  "sort_order": "DESC", 
+ "track_changes": 0, 
  "track_seen": 0
 }
\ No newline at end of file
diff --git a/erpnext/schools/doctype/student_group_student/student_group_student.json b/erpnext/schools/doctype/student_group_student/student_group_student.json
index 94493ae..df49ba8 100644
--- a/erpnext/schools/doctype/student_group_student/student_group_student.json
+++ b/erpnext/schools/doctype/student_group_student/student_group_student.json
@@ -14,6 +14,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "student", 
    "fieldtype": "Link", 
    "hidden": 0, 
@@ -21,6 +22,7 @@
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 1, 
+   "in_standard_filter": 0, 
    "label": "Student", 
    "length": 0, 
    "no_copy": 0, 
@@ -30,6 +32,7 @@
    "print_hide": 0, 
    "print_hide_if_no_value": 0, 
    "read_only": 0, 
+   "remember_last_selected_value": 0, 
    "report_hide": 0, 
    "reqd": 1, 
    "search_index": 0, 
@@ -40,13 +43,17 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
-   "fieldname": "column_break_2", 
-   "fieldtype": "Column Break", 
+   "columns": 0, 
+   "default": "1", 
+   "fieldname": "active", 
+   "fieldtype": "Check", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Active", 
    "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
@@ -54,6 +61,7 @@
    "print_hide": 0, 
    "print_hide_if_no_value": 0, 
    "read_only": 0, 
+   "remember_last_selected_value": 0, 
    "report_hide": 0, 
    "reqd": 0, 
    "search_index": 0, 
@@ -64,6 +72,34 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "column_break_2", 
+   "fieldtype": "Column Break", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "student_name", 
    "fieldtype": "Data", 
    "hidden": 0, 
@@ -71,6 +107,7 @@
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 1, 
+   "in_standard_filter": 0, 
    "label": "Student Name", 
    "length": 0, 
    "no_copy": 0, 
@@ -79,6 +116,7 @@
    "print_hide": 0, 
    "print_hide_if_no_value": 0, 
    "read_only": 1, 
+   "remember_last_selected_value": 0, 
    "report_hide": 0, 
    "reqd": 0, 
    "search_index": 0, 
@@ -96,8 +134,8 @@
  "issingle": 0, 
  "istable": 1, 
  "max_attachments": 0, 
- "modified": "2016-07-21 12:27:02.479077", 
- "modified_by": "Administrator", 
+ "modified": "2017-01-20 19:11:16.837202", 
+ "modified_by": "neil@frappe.io", 
  "module": "Schools", 
  "name": "Student Group Student", 
  "name_case": "", 
@@ -108,5 +146,6 @@
  "read_only_onload": 0, 
  "sort_field": "modified", 
  "sort_order": "DESC", 
+ "track_changes": 0, 
  "track_seen": 0
 }
\ No newline at end of file