[fix] check if academic_year exists (#13665)

This commit is contained in:
Saurabh
2018-04-17 14:21:40 +05:30
committed by Nabin Hait
parent c3fbc04aab
commit 492aff2a8b

View File

@@ -82,36 +82,39 @@ frappe.ui.form.on("Student Group", {
max_roll_no = d.group_roll_number; max_roll_no = d.group_roll_number;
} }
}); });
frappe.call({
method: "erpnext.education.doctype.student_group.student_group.get_students", if(frm.doc.academic_year) {
args: { frappe.call({
"academic_year": frm.doc.academic_year, method: "erpnext.education.doctype.student_group.student_group.get_students",
"academic_term": frm.doc.academic_term, args: {
"group_based_on": frm.doc.group_based_on, "academic_year": frm.doc.academic_year,
"program": frm.doc.program, "academic_term": frm.doc.academic_term,
"batch" : frm.doc.batch, "group_based_on": frm.doc.group_based_on,
"course": frm.doc.course "program": frm.doc.program,
}, "batch" : frm.doc.batch,
callback: function(r) { "course": frm.doc.course
if(r.message) { },
$.each(r.message, function(i, d) { callback: function(r) {
if(!in_list(student_list, d.student)) { if(r.message) {
var s = frm.add_child("students"); $.each(r.message, function(i, d) {
s.student = d.student; if(!in_list(student_list, d.student)) {
s.student_name = d.student_name; var s = frm.add_child("students");
if (d.active === 0) { s.student = d.student;
s.active = 0; s.student_name = d.student_name;
if (d.active === 0) {
s.active = 0;
}
s.group_roll_number = ++max_roll_no;
} }
s.group_roll_number = ++max_roll_no; });
} refresh_field("students");
}); frm.save();
refresh_field("students"); } else {
frm.save(); frappe.msgprint(__("Student Group is already updated."))
} else { }
frappe.msgprint(__("Student Group is already updated."))
} }
} })
}) }
} else { } else {
frappe.msgprint(__("Select students manually for the Activity based Group")); frappe.msgprint(__("Select students manually for the Activity based Group"));
} }