Added ability to mark student batch in-active

This commit is contained in:
Neil Trini Lasrado 2016-11-28 18:09:50 +05:30
parent 331361d03b
commit 87edfef0bb
12 changed files with 149 additions and 43 deletions

View File

@ -7,6 +7,16 @@ cur_frm.add_fetch("supervisor", "instructor_name", "supervisor_name");
cur_frm.add_fetch("student", "title", "student_name");
frappe.ui.form.on("Assessment" ,{
onload: function(frm){
cur_frm.set_query("student_batch", function(){
return{
"filters": {
"active": 1
}
};
});
},
student_group : function(frm) {
frm.set_value("results" ,"");
if (frm.doc.student_group) {

View File

@ -6,10 +6,14 @@ from __future__ import unicode_literals
from frappe.model.document import Document
import frappe
from frappe import _
from erpnext.schools.doctype.student_batch.student_batch import validate_active_student_batch
class Assessment(Document):
def validate(self):
self.validate_overlap()
if self.student_batch:
validate_active_student_batch(self.student_batch)
def validate_overlap(self):
"""Validates overlap for Student Group/Student Batch, Instructor, Room"""

View File

@ -9,6 +9,14 @@ frappe.ui.form.on("Course Schedule" ,{
frm.doc.from_time = from_datetime.format("HH:mm:ss");
frm.doc.to_time = to_datetime.format("HH:mm:ss");
}
cur_frm.set_query("student_batch", function(){
return{
"filters": {
"active": 1
}
};
});
},
refresh :function(frm) {

View File

@ -6,6 +6,7 @@ from __future__ import unicode_literals
import frappe
from frappe import _
from frappe.model.document import Document
from erpnext.schools.doctype.student_batch.student_batch import validate_active_student_batch
class CourseSchedule(Document):
def validate(self):
@ -16,6 +17,9 @@ class CourseSchedule(Document):
self.set_student_batch()
self.validate_date()
self.validate_overlap()
if self.student_batch:
validate_active_student_batch(self.student_batch)
def set_title(self):
"""Set document Title"""

View File

@ -7,12 +7,25 @@ cur_frm.add_fetch("student_group", "course", "course");
cur_frm.add_fetch("student_group", "academic_year", "academic_year");
cur_frm.add_fetch("student_group", "academic_term", "academic_term");
frappe.ui.form.on("Course Scheduling Tool", "refresh", function(frm) {
frm.disable_save();
frm.page.set_primary_action(__("Schedule Course"), function() {
frappe.call({
method: "schedule_course",
doc:frm.doc
})
});
frappe.ui.form.on("Course Scheduling Tool", {
refresh: function(frm) {
frm.disable_save();
frm.page.set_primary_action(__("Schedule Course"), function() {
frappe.call({
method: "schedule_course",
doc:frm.doc
})
});
},
onload: function(frm){
cur_frm.set_query("student_batch", function(){
return{
"filters": {
"active": 1
}
};
});
}
});

View File

@ -5,7 +5,13 @@ cur_frm.add_fetch("course_schedule", "schedule_date", "date");
cur_frm.add_fetch("course_schedule", "student_batch", "student_batch");
frappe.ui.form.on('Student Attendance', {
refresh: function(frm) {
onload: function(frm){
cur_frm.set_query("student_batch", function(){
return{
"filters": {
"active": 1
}
};
});
}
});

View File

@ -6,6 +6,7 @@ from __future__ import unicode_literals
import frappe
from frappe.model.document import Document
from frappe import _
from erpnext.schools.doctype.student_batch.student_batch import validate_active_student_batch
class StudentAttendance(Document):
def validate(self):
@ -13,6 +14,9 @@ class StudentAttendance(Document):
self.validate_mandatory()
self.validate_duplication()
if self.student_batch:
validate_active_student_batch(self.student_batch)
def validate_date(self):
if self.course_schedule:
self.date = frappe.db.get_value("Course Schedule", self.course_schedule, "schedule_date")

View File

@ -70,6 +70,35 @@
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"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,
"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,
@ -280,7 +309,7 @@
"issingle": 0,
"istable": 0,
"max_attachments": 0,
"modified": "2016-11-21 19:08:05.775954",
"modified": "2016-11-28 16:59:31.270816",
"modified_by": "Administrator",
"module": "Schools",
"name": "Student Batch",

View File

@ -6,14 +6,18 @@ from __future__ import unicode_literals
from frappe.model.document import Document
from erpnext.schools.utils import validate_duplicate_student
import frappe
from frappe import _
class StudentBatch(Document):
def autoname(self):
prog_abb = frappe.db.get_value("Program", self.program, "program_abbreviation")
if not prog_abb:
prog_abb = self.program
self.name = prog_abb + "-"+ self.student_batch_name + "-" + self.academic_year
def validate(self):
validate_duplicate_student(self.students)
def autoname(self):
prog_abb = frappe.db.get_value("Program", self.program, "program_abbreviation")
if not prog_abb:
prog_abb = self.program
self.name = prog_abb + "-"+ self.student_batch_name + "-" + self.academic_year
def validate(self):
validate_duplicate_student(self.students)
def validate_active_student_batch(student_batch):
if not frappe.db.get_value("Student Batch", student_batch, "active"):
frappe.throw(_("Student Batch is not Active."))

View File

@ -8,6 +8,16 @@ frappe.ui.form.on('Student Batch Attendance Tool', {
hide_field('attendance');
},
onload: function(frm){
cur_frm.set_query("student_batch", function(){
return{
"filters": {
"active": 1
}
};
});
},
student_batch :function(frm) {
if(frm.doc.student_batch && frm.doc.date) {
frappe.call({

View File

@ -1,31 +1,41 @@
cur_frm.add_fetch("student", "title", "student_name");
frappe.ui.form.on("Student Group", "refresh", function(frm) {
if(!frm.doc.__islocal) {
frm.add_custom_button(__("Course Schedule"), function() {
frappe.route_options = {
student_group: frm.doc.name
}
frappe.set_route("List", "Course Schedule");
frappe.ui.form.on("Student Group", {
refresh: function(frm) {
if(!frm.doc.__islocal) {
frm.add_custom_button(__("Course Schedule"), function() {
frappe.route_options = {
student_group: frm.doc.name
}
frappe.set_route("List", "Course Schedule");
});
frm.add_custom_button(__("Assessment"), function() {
frappe.route_options = {
student_group: frm.doc.name
}
frappe.set_route("List", "Assessment");
});
}
},
onload: function(frm){
cur_frm.set_query("academic_term",function(){
return{
"filters":{
"academic_year": (frm.doc.academic_year)
}
};
});
frm.add_custom_button(__("Assessment"), function() {
frappe.route_options = {
student_group: frm.doc.name
}
frappe.set_route("List", "Assessment");
cur_frm.set_query("student_batch", function(){
return{
"filters": {
"active": 1
}
};
});
}
});
frappe.ui.form.on("Student Group", "onload", function(frm){
cur_frm.set_query("academic_term",function(){
return{
"filters":{
"academic_year": (frm.doc.academic_year)
}
};
});
}
});
//If Student Batch is entered, deduce program, academic_year and academic term from it

View File

@ -7,6 +7,7 @@ import frappe
from frappe.model.document import Document
from frappe import _
from erpnext.schools.utils import validate_duplicate_student
from erpnext.schools.doctype.student_batch.student_batch import validate_active_student_batch
class StudentGroup(Document):
def autoname(self):
@ -30,6 +31,9 @@ class StudentGroup(Document):
self.validate_strength()
self.validate_student_name()
validate_duplicate_student(self.students)
if self.student_batch:
validate_active_student_batch(self.student_batch)
def validate_strength(self):
if self.max_strength and len(self.students) > self.max_strength: