remove the print option from the tools (#11484)

* remove the print option for the tools

* better student search queries and minor fixes in the student group
This commit is contained in:
Manas Solanki 2017-11-08 14:55:54 +05:30 committed by Nabin Hait
parent ff73646212
commit a658630751
4 changed files with 37 additions and 30 deletions

View File

@ -7,6 +7,7 @@ cur_frm.add_fetch("assessment_plan", "maximum_assessment_score", "maximum_score"
frappe.ui.form.on("Assessment Result", {
assessment_plan: function(frm) {
if (frm.doc.assessment_plan) {
frappe.call({
method: "erpnext.schools.api.get_assessment_details",
args: {
@ -25,6 +26,7 @@ frappe.ui.form.on("Assessment Result", {
}
});
}
}
});
frappe.ui.form.on("Assessment Result Detail", {

View File

@ -175,7 +175,7 @@
"issingle": 1,
"istable": 0,
"max_attachments": 0,
"modified": "2017-06-30 08:21:47.184562",
"modified": "2017-11-08 11:51:43.247815",
"modified_by": "Administrator",
"module": "Schools",
"name": "Assessment Result Tool",
@ -188,17 +188,17 @@
"cancel": 0,
"create": 1,
"delete": 0,
"email": 1,
"email": 0,
"export": 0,
"if_owner": 0,
"import": 0,
"permlevel": 0,
"print": 1,
"print": 0,
"read": 1,
"report": 0,
"role": "Academics User",
"set_user_permissions": 0,
"share": 1,
"share": 0,
"submit": 0,
"write": 1
}

View File

@ -273,7 +273,7 @@
"issingle": 1,
"istable": 0,
"max_attachments": 0,
"modified": "2017-06-30 08:21:51.390809",
"modified": "2017-11-08 11:53:27.994112",
"modified_by": "Administrator",
"module": "Schools",
"name": "Student Attendance Tool",
@ -306,17 +306,17 @@
"cancel": 0,
"create": 1,
"delete": 0,
"email": 1,
"email": 0,
"export": 0,
"if_owner": 0,
"import": 0,
"permlevel": 0,
"print": 1,
"print": 0,
"read": 1,
"report": 0,
"role": "Academics User",
"set_user_permissions": 0,
"share": 1,
"share": 0,
"submit": 0,
"write": 1
}

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 frappe.utils import cint
class StudentGroup(Document):
def validate(self):
@ -34,9 +35,13 @@ class StudentGroup(Document):
for d in self.students:
if not frappe.db.get_value("Student", d.student, "enabled") and d.active:
frappe.throw(_("{0} - {1} is inactive student".format(d.group_roll_number, d.student_name)))
if self.group_based_on == "Batch" and d.student not in students and frappe.defaults.get_defaults().validate_batch:
if (self.group_based_on == "Batch") and cint(frappe.defaults.get_defaults().validate_batch)\
and d.student not in students:
frappe.throw(_("{0} - {1} is not enrolled in the Batch {2}".format(d.group_roll_number, d.student_name, self.batch)))
if self.group_based_on == "Course" and d.student not in students and frappe.defaults.get_defaults().validate_course:
if (self.group_based_on == "Course") and cint(frappe.defaults.get_defaults().validate_course)\
and (d.student not in students):
frappe.throw(_("{0} - {1} is not enrolled in the Course {2}".format(d.group_roll_number, d.student_name, self.course)))
def validate_and_set_child_table_fields(self):
@ -108,14 +113,14 @@ def fetch_students(doctype, txt, searchfield, start, page_len, filters):
students = ([d.student for d in enrolled_students if d.student not in student_group_student]
if enrolled_students else [""]) or [""]
return frappe.db.sql("""select name, title from tabStudent
where name in ({0}) and `{1}` LIKE %s
where name in ({0}) and (`{1}` LIKE %s or title LIKE %s)
order by idx desc, name
limit %s, %s""".format(", ".join(['%s']*len(students)), searchfield),
tuple(students + ["%%%s%%" % txt, start, page_len]))
tuple(students + ["%%%s%%" % txt, "%%%s%%" % txt, start, page_len]))
else:
return frappe.db.sql("""select name, title from tabStudent
where `{0}` LIKE %s
where `{0}` LIKE %s or title LIKE %s
order by idx desc, name
limit %s, %s""".format(searchfield),
tuple(["%%%s%%" % txt, start, page_len]))
tuple(["%%%s%%" % txt, "%%%s%%" % txt, start, page_len]))