Fixed Student Attendence
This commit is contained in:
parent
293158db6e
commit
f869a679ae
@ -375,3 +375,4 @@ erpnext.patches.v7_2.setup_auto_close_settings
|
|||||||
erpnext.patches.v7_2.empty_supplied_items_for_non_subcontracted
|
erpnext.patches.v7_2.empty_supplied_items_for_non_subcontracted
|
||||||
erpnext.patches.v7_2.arrear_leave_encashment_as_salary_component
|
erpnext.patches.v7_2.arrear_leave_encashment_as_salary_component
|
||||||
erpnext.patches.v7_2.rename_att_date_attendance
|
erpnext.patches.v7_2.rename_att_date_attendance
|
||||||
|
erpnext.patches.v7_2.update_attendance_docstatus
|
10
erpnext/patches/v7_2/update_attendance_docstatus.py
Normal file
10
erpnext/patches/v7_2/update_attendance_docstatus.py
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
import frappe
|
||||||
|
|
||||||
|
def execute():
|
||||||
|
frappe.reload_doctype('Student Attendance')
|
||||||
|
# frappe.reload_doc("schools", "doctype", "student_attendance")
|
||||||
|
frappe.db.sql('''
|
||||||
|
update `tabStudent Attendance` set
|
||||||
|
docstatus=0
|
||||||
|
where
|
||||||
|
docstatus=1''')
|
@ -1,5 +1,5 @@
|
|||||||
<div class="col-sm-3">
|
<div class="col-sm-3">
|
||||||
<div class="checkbox {% if status %} text-muted {% endif %}">
|
<div class="checkbox">
|
||||||
<label>
|
<label>
|
||||||
<input
|
<input
|
||||||
type="checkbox"
|
type="checkbox"
|
||||||
@ -7,9 +7,6 @@
|
|||||||
data-student="{{student}}"
|
data-student="{{student}}"
|
||||||
data-student-name="{{student_name}}"
|
data-student-name="{{student_name}}"
|
||||||
class="students-check"
|
class="students-check"
|
||||||
{% if status %}
|
|
||||||
disabled="true"
|
|
||||||
{% endif %}
|
|
||||||
{% if status === "Present" %}
|
{% if status === "Present" %}
|
||||||
checked
|
checked
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
@ -67,13 +67,23 @@ def mark_attendance(students_present, students_absent, course_schedule=None, stu
|
|||||||
frappe.msgprint(_("Attendance has been marked successfully."))
|
frappe.msgprint(_("Attendance has been marked successfully."))
|
||||||
|
|
||||||
def make_attendance_records(student, student_name, status, course_schedule=None, student_batch=None, date=None):
|
def make_attendance_records(student, student_name, status, course_schedule=None, student_batch=None, date=None):
|
||||||
"""Creates Attendance Record.
|
"""Creates/Update Attendance Record.
|
||||||
|
|
||||||
:param student: Student.
|
:param student: Student.
|
||||||
:param student_name: Student Name.
|
:param student_name: Student Name.
|
||||||
:param course_schedule: Course Schedule.
|
:param course_schedule: Course Schedule.
|
||||||
:param status: Status (Present/Absent)
|
:param status: Status (Present/Absent)
|
||||||
"""
|
"""
|
||||||
|
student_attendance_list = frappe.get_list("Student Attendance", fields = ["name"], filters = {
|
||||||
|
"student": student,
|
||||||
|
"course_schedule": course_schedule,
|
||||||
|
"student_batch": student_batch,
|
||||||
|
"date": date
|
||||||
|
})
|
||||||
|
|
||||||
|
if student_attendance_list:
|
||||||
|
student_attendance = frappe.get_doc("Student Attendance", student_attendance_list[0])
|
||||||
|
else:
|
||||||
student_attendance = frappe.new_doc("Student Attendance")
|
student_attendance = frappe.new_doc("Student Attendance")
|
||||||
student_attendance.student = student
|
student_attendance.student = student
|
||||||
student_attendance.student_name = student_name
|
student_attendance.student_name = student_name
|
||||||
@ -81,7 +91,7 @@ def make_attendance_records(student, student_name, status, course_schedule=None,
|
|||||||
student_attendance.student_batch = student_batch
|
student_attendance.student_batch = student_batch
|
||||||
student_attendance.date = date
|
student_attendance.date = date
|
||||||
student_attendance.status = status
|
student_attendance.status = status
|
||||||
student_attendance.submit()
|
student_attendance.save()
|
||||||
|
|
||||||
@frappe.whitelist()
|
@frappe.whitelist()
|
||||||
def get_student_guardians(student):
|
def get_student_guardians(student):
|
||||||
|
@ -578,6 +578,7 @@
|
|||||||
"bold": 0,
|
"bold": 0,
|
||||||
"collapsible": 0,
|
"collapsible": 0,
|
||||||
"columns": 0,
|
"columns": 0,
|
||||||
|
"default": "INDIAN",
|
||||||
"fieldname": "nationality",
|
"fieldname": "nationality",
|
||||||
"fieldtype": "Data",
|
"fieldtype": "Data",
|
||||||
"hidden": 0,
|
"hidden": 0,
|
||||||
@ -1022,7 +1023,7 @@
|
|||||||
"istable": 0,
|
"istable": 0,
|
||||||
"max_attachments": 0,
|
"max_attachments": 0,
|
||||||
"menu_index": 0,
|
"menu_index": 0,
|
||||||
"modified": "2017-02-20 13:20:10.117987",
|
"modified": "2017-02-21 01:14:59.352772",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "Schools",
|
"module": "Schools",
|
||||||
"name": "Student Applicant",
|
"name": "Student Applicant",
|
||||||
|
@ -256,11 +256,11 @@
|
|||||||
"image_view": 0,
|
"image_view": 0,
|
||||||
"in_create": 0,
|
"in_create": 0,
|
||||||
"in_dialog": 0,
|
"in_dialog": 0,
|
||||||
"is_submittable": 1,
|
"is_submittable": 0,
|
||||||
"issingle": 0,
|
"issingle": 0,
|
||||||
"istable": 0,
|
"istable": 0,
|
||||||
"max_attachments": 0,
|
"max_attachments": 0,
|
||||||
"modified": "2017-02-20 13:19:02.708904",
|
"modified": "2017-02-21 01:15:20.989687",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "Schools",
|
"module": "Schools",
|
||||||
"name": "Student Attendance",
|
"name": "Student Attendance",
|
||||||
@ -268,9 +268,9 @@
|
|||||||
"owner": "Administrator",
|
"owner": "Administrator",
|
||||||
"permissions": [
|
"permissions": [
|
||||||
{
|
{
|
||||||
"amend": 1,
|
"amend": 0,
|
||||||
"apply_user_permissions": 0,
|
"apply_user_permissions": 0,
|
||||||
"cancel": 1,
|
"cancel": 0,
|
||||||
"create": 1,
|
"create": 1,
|
||||||
"delete": 1,
|
"delete": 1,
|
||||||
"email": 1,
|
"email": 1,
|
||||||
@ -284,7 +284,7 @@
|
|||||||
"role": "Academics User",
|
"role": "Academics User",
|
||||||
"set_user_permissions": 0,
|
"set_user_permissions": 0,
|
||||||
"share": 1,
|
"share": 1,
|
||||||
"submit": 1,
|
"submit": 0,
|
||||||
"write": 1
|
"write": 1
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
@ -121,6 +121,8 @@ schools.StudentsEditor = Class.extend({
|
|||||||
return !stud.disabled && !stud.checked;
|
return !stud.disabled && !stud.checked;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
frappe.confirm(__("Do you want to save attendance?<br>Present: {0}\
|
||||||
|
<br>Absent: {1}", [students_present.length, students_absent.length]), function() {
|
||||||
frappe.call({
|
frappe.call({
|
||||||
method: "erpnext.schools.api.mark_attendance",
|
method: "erpnext.schools.api.mark_attendance",
|
||||||
args: {
|
args: {
|
||||||
@ -136,6 +138,8 @@ schools.StudentsEditor = Class.extend({
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
var htmls = students.map(function(student) {
|
var htmls = students.map(function(student) {
|
||||||
return frappe.render_template("student_button", {
|
return frappe.render_template("student_button", {
|
||||||
student: student.student,
|
student: student.student,
|
||||||
|
@ -23,6 +23,7 @@
|
|||||||
"ignore_user_permissions": 0,
|
"ignore_user_permissions": 0,
|
||||||
"ignore_xss_filter": 0,
|
"ignore_xss_filter": 0,
|
||||||
"in_filter": 0,
|
"in_filter": 0,
|
||||||
|
"in_global_search": 0,
|
||||||
"in_list_view": 0,
|
"in_list_view": 0,
|
||||||
"in_standard_filter": 0,
|
"in_standard_filter": 0,
|
||||||
"label": "Based On",
|
"label": "Based On",
|
||||||
@ -52,6 +53,7 @@
|
|||||||
"ignore_user_permissions": 0,
|
"ignore_user_permissions": 0,
|
||||||
"ignore_xss_filter": 0,
|
"ignore_xss_filter": 0,
|
||||||
"in_filter": 0,
|
"in_filter": 0,
|
||||||
|
"in_global_search": 0,
|
||||||
"in_list_view": 0,
|
"in_list_view": 0,
|
||||||
"in_standard_filter": 0,
|
"in_standard_filter": 0,
|
||||||
"length": 0,
|
"length": 0,
|
||||||
@ -80,6 +82,7 @@
|
|||||||
"ignore_user_permissions": 0,
|
"ignore_user_permissions": 0,
|
||||||
"ignore_xss_filter": 0,
|
"ignore_xss_filter": 0,
|
||||||
"in_filter": 0,
|
"in_filter": 0,
|
||||||
|
"in_global_search": 0,
|
||||||
"in_list_view": 0,
|
"in_list_view": 0,
|
||||||
"in_standard_filter": 0,
|
"in_standard_filter": 0,
|
||||||
"label": "Student Batch",
|
"label": "Student Batch",
|
||||||
@ -110,6 +113,7 @@
|
|||||||
"ignore_user_permissions": 0,
|
"ignore_user_permissions": 0,
|
||||||
"ignore_xss_filter": 0,
|
"ignore_xss_filter": 0,
|
||||||
"in_filter": 0,
|
"in_filter": 0,
|
||||||
|
"in_global_search": 0,
|
||||||
"in_list_view": 0,
|
"in_list_view": 0,
|
||||||
"in_standard_filter": 0,
|
"in_standard_filter": 0,
|
||||||
"label": "Course Schedule",
|
"label": "Course Schedule",
|
||||||
@ -140,6 +144,7 @@
|
|||||||
"ignore_user_permissions": 0,
|
"ignore_user_permissions": 0,
|
||||||
"ignore_xss_filter": 0,
|
"ignore_xss_filter": 0,
|
||||||
"in_filter": 0,
|
"in_filter": 0,
|
||||||
|
"in_global_search": 0,
|
||||||
"in_list_view": 0,
|
"in_list_view": 0,
|
||||||
"in_standard_filter": 0,
|
"in_standard_filter": 0,
|
||||||
"label": "Date",
|
"label": "Date",
|
||||||
@ -169,6 +174,7 @@
|
|||||||
"ignore_user_permissions": 0,
|
"ignore_user_permissions": 0,
|
||||||
"ignore_xss_filter": 0,
|
"ignore_xss_filter": 0,
|
||||||
"in_filter": 0,
|
"in_filter": 0,
|
||||||
|
"in_global_search": 0,
|
||||||
"in_list_view": 0,
|
"in_list_view": 0,
|
||||||
"in_standard_filter": 0,
|
"in_standard_filter": 0,
|
||||||
"label": "Attendance",
|
"label": "Attendance",
|
||||||
@ -197,6 +203,7 @@
|
|||||||
"ignore_user_permissions": 0,
|
"ignore_user_permissions": 0,
|
||||||
"ignore_xss_filter": 0,
|
"ignore_xss_filter": 0,
|
||||||
"in_filter": 0,
|
"in_filter": 0,
|
||||||
|
"in_global_search": 0,
|
||||||
"in_list_view": 0,
|
"in_list_view": 0,
|
||||||
"in_standard_filter": 0,
|
"in_standard_filter": 0,
|
||||||
"label": "Students HTML",
|
"label": "Students HTML",
|
||||||
@ -225,7 +232,7 @@
|
|||||||
"issingle": 1,
|
"issingle": 1,
|
||||||
"istable": 0,
|
"istable": 0,
|
||||||
"max_attachments": 0,
|
"max_attachments": 0,
|
||||||
"modified": "2016-12-09 17:36:28.739318",
|
"modified": "2017-02-21 01:15:11.435110",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "Schools",
|
"module": "Schools",
|
||||||
"name": "Student Attendance Tool",
|
"name": "Student Attendance Tool",
|
||||||
@ -242,7 +249,6 @@
|
|||||||
"export": 0,
|
"export": 0,
|
||||||
"if_owner": 0,
|
"if_owner": 0,
|
||||||
"import": 0,
|
"import": 0,
|
||||||
"is_custom": 0,
|
|
||||||
"permlevel": 0,
|
"permlevel": 0,
|
||||||
"print": 0,
|
"print": 0,
|
||||||
"read": 1,
|
"read": 1,
|
||||||
@ -263,7 +269,6 @@
|
|||||||
"export": 0,
|
"export": 0,
|
||||||
"if_owner": 0,
|
"if_owner": 0,
|
||||||
"import": 0,
|
"import": 0,
|
||||||
"is_custom": 0,
|
|
||||||
"permlevel": 0,
|
"permlevel": 0,
|
||||||
"print": 1,
|
"print": 1,
|
||||||
"read": 1,
|
"read": 1,
|
||||||
@ -278,7 +283,9 @@
|
|||||||
"quick_entry": 0,
|
"quick_entry": 0,
|
||||||
"read_only": 0,
|
"read_only": 0,
|
||||||
"read_only_onload": 0,
|
"read_only_onload": 0,
|
||||||
|
"show_name_in_global_search": 0,
|
||||||
"sort_field": "modified",
|
"sort_field": "modified",
|
||||||
"sort_order": "DESC",
|
"sort_order": "DESC",
|
||||||
|
"track_changes": 0,
|
||||||
"track_seen": 0
|
"track_seen": 0
|
||||||
}
|
}
|
@ -27,10 +27,10 @@ def get_student_attendance_records(based_on, date=None, student_batch=None, cour
|
|||||||
|
|
||||||
if course_schedule:
|
if course_schedule:
|
||||||
student_attendance_list= frappe.db.sql("""select student, status from `tabStudent Attendance` where \
|
student_attendance_list= frappe.db.sql("""select student, status from `tabStudent Attendance` where \
|
||||||
course_schedule= %s and docstatus=1""", (course_schedule), as_dict=1)
|
course_schedule= %s""", (course_schedule), as_dict=1)
|
||||||
else:
|
else:
|
||||||
student_attendance_list= frappe.db.sql("""select student, status from `tabStudent Attendance` where \
|
student_attendance_list= frappe.db.sql("""select student, status from `tabStudent Attendance` where \
|
||||||
student_batch= %s and date= %s and docstatus=1 and \
|
student_batch= %s and date= %s and \
|
||||||
(course_schedule is Null or course_schedule='')""",
|
(course_schedule is Null or course_schedule='')""",
|
||||||
(student_batch, date), as_dict=1)
|
(student_batch, date), as_dict=1)
|
||||||
|
|
||||||
@ -38,4 +38,5 @@ def get_student_attendance_records(based_on, date=None, student_batch=None, cour
|
|||||||
for student in student_list:
|
for student in student_list:
|
||||||
if student.student == attendance.student:
|
if student.student == attendance.student:
|
||||||
student.status = attendance.status
|
student.status = attendance.status
|
||||||
|
print student_list
|
||||||
return student_list
|
return student_list
|
Loading…
x
Reference in New Issue
Block a user