From 3f0a581b85074771b4b227591dc36f2a24f38e73 Mon Sep 17 00:00:00 2001 From: Neil Trini Lasrado Date: Tue, 19 Jul 2016 14:17:33 +0530 Subject: [PATCH 1/2] Merge ERPNext Schools into ERPNext --- erpnext/hooks.py | 9 +- erpnext/modules.txt | 3 +- .../v7_0/migrate_schools_to_erpnext.py | 7 + erpnext/public/js/setup_wizard.js | 1 + erpnext/schools/__init__.py | 0 erpnext/schools/api.py | 146 ++++ erpnext/schools/doctype/__init__.py | 0 .../schools/doctype/academic_term/__init__.py | 0 .../doctype/academic_term/academic_term.json | 94 +++ .../doctype/academic_term/academic_term.py | 10 + .../academic_term/test_academic_term.py | 12 + .../doctype/academic_term/test_records.json | 11 + .../schools/doctype/academic_year/__init__.py | 0 .../doctype/academic_year/academic_year.js | 10 + .../doctype/academic_year/academic_year.json | 139 ++++ .../doctype/academic_year/academic_year.py | 10 + .../academic_year/test_academic_year.py | 12 + .../doctype/academic_year/test_records.json | 11 + .../schools/doctype/announcement/__init__.py | 0 .../doctype/announcement/announcement.js | 9 + .../doctype/announcement/announcement.json | 334 +++++++++ .../doctype/announcement/announcement.py | 75 ++ .../doctype/announcement/test_announcement.py | 12 + .../attendance_tool_student/__init__.py | 0 .../attendance_tool_student.json | 98 +++ .../attendance_tool_student.py | 10 + erpnext/schools/doctype/course/.txt | 0 erpnext/schools/doctype/course/__init__.py | 0 erpnext/schools/doctype/course/course.js | 31 + erpnext/schools/doctype/course/course.json | 181 +++++ erpnext/schools/doctype/course/course.py | 28 + erpnext/schools/doctype/course/test_course.py | 12 + .../schools/doctype/course/test_records.json | 14 + .../doctype/course_schedule/__init__.py | 0 .../course_schedule/course_schedule.js | 137 ++++ .../course_schedule/course_schedule.json | 402 ++++++++++ .../course_schedule/course_schedule.py | 37 + .../course_schedule_calendar.js | 38 + .../course_schedule/test_course_schedule.py | 69 ++ .../schools/doctype/discussion/__init__.py | 0 .../schools/doctype/discussion/discussion.js | 8 + .../doctype/discussion/discussion.json | 160 ++++ .../schools/doctype/discussion/discussion.py | 37 + .../doctype/discussion/test_discussion.py | 12 + .../schools/doctype/examination/__init__.py | 0 .../doctype/examination/examination.js | 28 + .../doctype/examination/examination.json | 497 +++++++++++++ .../doctype/examination/examination.py | 46 ++ .../doctype/examination/test_examination.py | 12 + .../doctype/examination_result/__init__.py | 0 .../examination_result.json | 118 +++ .../examination_result/examination_result.py | 10 + .../schools/doctype/fee_amount/__init__.py | 0 .../doctype/fee_amount/fee_amount.json | 120 +++ .../schools/doctype/fee_amount/fee_amount.py | 10 + .../schools/doctype/fee_category/__init__.py | 0 .../doctype/fee_category/fee_category.json | 129 ++++ .../doctype/fee_category/fee_category.py | 10 + .../doctype/fee_category/test_fee_category.py | 12 + .../schools/doctype/fee_structure/__init__.py | 0 .../doctype/fee_structure/fee_structure.js | 9 + .../doctype/fee_structure/fee_structure.json | 288 ++++++++ .../doctype/fee_structure/fee_structure.py | 18 + .../fee_structure/test_fee_structure.py | 12 + erpnext/schools/doctype/fees/__init__.py | 0 erpnext/schools/doctype/fees/fees.js | 79 ++ erpnext/schools/doctype/fees/fees.json | 556 ++++++++++++++ erpnext/schools/doctype/fees/fees.py | 37 + erpnext/schools/doctype/fees/fees_list.js | 14 + erpnext/schools/doctype/fees/test_fees.py | 12 + .../schools/doctype/instructor/__init__.py | 0 .../schools/doctype/instructor/instructor.js | 13 + .../doctype/instructor/instructor.json | 232 ++++++ .../schools/doctype/instructor/instructor.py | 10 + .../doctype/instructor/test_instructor.py | 12 + .../doctype/instructor/test_records.json | 12 + erpnext/schools/doctype/program/__init__.py | 0 erpnext/schools/doctype/program/program.js | 44 ++ erpnext/schools/doctype/program/program.json | 281 +++++++ erpnext/schools/doctype/program/program.py | 16 + .../schools/doctype/program/test_program.py | 12 + .../schools/doctype/program/test_records.json | 8 + .../doctype/program_course/__init__.py | 0 .../program_course/program_course.json | 150 ++++ .../doctype/program_course/program_course.py | 10 + .../doctype/program_enrollment/__init__.py | 0 .../program_enrollment/program_enrollment.js | 22 + .../program_enrollment.json | 289 ++++++++ .../program_enrollment/program_enrollment.py | 54 ++ .../test_program_enrollment.py | 12 + .../program_enrollment_fee/__init__.py | 0 .../program_enrollment_fee.json | 161 ++++ .../program_enrollment_fee.py | 10 + .../program_enrollment_tool/__init__.py | 0 .../program_enrollment_tool.js | 33 + .../program_enrollment_tool.json | 331 +++++++++ .../program_enrollment_tool.py | 39 + .../__init__.py | 0 .../program_enrollment_tool_student.json | 138 ++++ .../program_enrollment_tool_student.py | 10 + .../schools/doctype/program_fee/__init__.py | 0 .../doctype/program_fee/program_fee.json | 162 ++++ .../doctype/program_fee/program_fee.py | 10 + erpnext/schools/doctype/room/__init__.py | 0 erpnext/schools/doctype/room/room.js | 10 + erpnext/schools/doctype/room/room.json | 146 ++++ erpnext/schools/doctype/room/room.py | 10 + .../schools/doctype/room/test_records.json | 17 + erpnext/schools/doctype/room/test_room.py | 12 + .../doctype/scheduling_tool/__init__.py | 0 .../scheduling_tool/scheduling_tool.js | 14 + .../scheduling_tool/scheduling_tool.json | 539 ++++++++++++++ .../scheduling_tool/scheduling_tool.py | 95 +++ .../scheduling_tool/test_scheduling_tool.py | 12 + .../sg_creation_tool_course/__init__.py | 0 .../sg_creation_tool_course.json | 153 ++++ .../sg_creation_tool_course.py | 10 + erpnext/schools/doctype/student/__init__.py | 0 erpnext/schools/doctype/student/student.js | 0 erpnext/schools/doctype/student/student.json | 614 ++++++++++++++++ erpnext/schools/doctype/student/student.py | 37 + .../doctype/student/student_dashboard.py | 15 + .../schools/doctype/student/test_records.json | 32 + .../schools/doctype/student/test_student.py | 12 + .../doctype/student_applicant/__init__.py | 0 .../student_applicant/student_applicant.js | 29 + .../student_applicant/student_applicant.json | 691 ++++++++++++++++++ .../student_applicant/student_applicant.py | 17 + .../student_applicant_list.js | 17 + .../test_student_applicant.py | 12 + .../doctype/student_attendance/__init__.py | 0 .../student_attendance.json | 209 ++++++ .../student_attendance/student_attendance.py | 21 + .../student_attendance_list.js | 11 + .../test_student_attendance.py | 12 + .../doctype/student_attendance/untitled.txt | 20 + .../schools/doctype/student_group/__init__.py | 0 .../doctype/student_group/student_group.js | 19 + .../doctype/student_group/student_group.json | 324 ++++++++ .../doctype/student_group/student_group.py | 21 + .../doctype/student_group/test_records.json | 16 + .../student_group/test_student_group.py | 12 + .../student_group_creation_tool/__init__.py | 0 .../student_group_creation_tool.js | 23 + .../student_group_creation_tool.json | 252 +++++++ .../student_group_creation_tool.py | 48 ++ .../doctype/student_group_student/__init__.py | 0 .../student_group_student.json | 96 +++ .../student_group_student.py | 10 + erpnext/schools/doctype/topic/__init__.py | 0 erpnext/schools/doctype/topic/test_topic.py | 12 + erpnext/schools/doctype/topic/topic.js | 8 + erpnext/schools/doctype/topic/topic.json | 160 ++++ erpnext/schools/doctype/topic/topic.py | 49 ++ erpnext/schools/report/__init__.py | 0 .../report/student_fee_collection/__init__.py | 0 .../student_fee_collection.json | 19 + erpnext/schools/utils.py | 44 ++ erpnext/schools/web_form/__init__.py | 0 .../schools/web_form/discussion/__init__.py | 0 .../schools/web_form/discussion/discussion.js | 4 + .../web_form/discussion/discussion.json | 49 ++ .../schools/web_form/discussion/discussion.py | 9 + .../announcement/announcement_row.html | 34 + .../templates/includes/course/course_row.html | 18 + erpnext/templates/includes/course/macros.html | 1 + .../includes/discussion/discussion_row.html | 9 + .../includes/examination/examination_row.html | 19 + erpnext/templates/includes/fee/fee_row.html | 18 + .../templates/includes/topic/topic_row.html | 9 + erpnext/templates/pages/announcements.html | 20 + erpnext/templates/pages/announcements.py | 18 + erpnext/templates/pages/courses.html | 11 + erpnext/templates/pages/courses.py | 28 + erpnext/templates/pages/discussions.html | 15 + erpnext/templates/pages/discussions.py | 21 + erpnext/templates/pages/topics.html | 12 + erpnext/templates/pages/topics.py | 15 + 178 files changed, 10454 insertions(+), 3 deletions(-) create mode 100644 erpnext/patches/v7_0/migrate_schools_to_erpnext.py create mode 100644 erpnext/schools/__init__.py create mode 100644 erpnext/schools/api.py create mode 100644 erpnext/schools/doctype/__init__.py create mode 100644 erpnext/schools/doctype/academic_term/__init__.py create mode 100644 erpnext/schools/doctype/academic_term/academic_term.json create mode 100644 erpnext/schools/doctype/academic_term/academic_term.py create mode 100644 erpnext/schools/doctype/academic_term/test_academic_term.py create mode 100644 erpnext/schools/doctype/academic_term/test_records.json create mode 100644 erpnext/schools/doctype/academic_year/__init__.py create mode 100644 erpnext/schools/doctype/academic_year/academic_year.js create mode 100644 erpnext/schools/doctype/academic_year/academic_year.json create mode 100644 erpnext/schools/doctype/academic_year/academic_year.py create mode 100644 erpnext/schools/doctype/academic_year/test_academic_year.py create mode 100644 erpnext/schools/doctype/academic_year/test_records.json create mode 100644 erpnext/schools/doctype/announcement/__init__.py create mode 100644 erpnext/schools/doctype/announcement/announcement.js create mode 100644 erpnext/schools/doctype/announcement/announcement.json create mode 100644 erpnext/schools/doctype/announcement/announcement.py create mode 100644 erpnext/schools/doctype/announcement/test_announcement.py create mode 100644 erpnext/schools/doctype/attendance_tool_student/__init__.py create mode 100644 erpnext/schools/doctype/attendance_tool_student/attendance_tool_student.json create mode 100644 erpnext/schools/doctype/attendance_tool_student/attendance_tool_student.py create mode 100644 erpnext/schools/doctype/course/.txt create mode 100644 erpnext/schools/doctype/course/__init__.py create mode 100644 erpnext/schools/doctype/course/course.js create mode 100644 erpnext/schools/doctype/course/course.json create mode 100644 erpnext/schools/doctype/course/course.py create mode 100644 erpnext/schools/doctype/course/test_course.py create mode 100644 erpnext/schools/doctype/course/test_records.json create mode 100644 erpnext/schools/doctype/course_schedule/__init__.py create mode 100644 erpnext/schools/doctype/course_schedule/course_schedule.js create mode 100644 erpnext/schools/doctype/course_schedule/course_schedule.json create mode 100644 erpnext/schools/doctype/course_schedule/course_schedule.py create mode 100644 erpnext/schools/doctype/course_schedule/course_schedule_calendar.js create mode 100644 erpnext/schools/doctype/course_schedule/test_course_schedule.py create mode 100644 erpnext/schools/doctype/discussion/__init__.py create mode 100644 erpnext/schools/doctype/discussion/discussion.js create mode 100644 erpnext/schools/doctype/discussion/discussion.json create mode 100644 erpnext/schools/doctype/discussion/discussion.py create mode 100644 erpnext/schools/doctype/discussion/test_discussion.py create mode 100644 erpnext/schools/doctype/examination/__init__.py create mode 100644 erpnext/schools/doctype/examination/examination.js create mode 100644 erpnext/schools/doctype/examination/examination.json create mode 100644 erpnext/schools/doctype/examination/examination.py create mode 100644 erpnext/schools/doctype/examination/test_examination.py create mode 100644 erpnext/schools/doctype/examination_result/__init__.py create mode 100644 erpnext/schools/doctype/examination_result/examination_result.json create mode 100644 erpnext/schools/doctype/examination_result/examination_result.py create mode 100644 erpnext/schools/doctype/fee_amount/__init__.py create mode 100644 erpnext/schools/doctype/fee_amount/fee_amount.json create mode 100644 erpnext/schools/doctype/fee_amount/fee_amount.py create mode 100644 erpnext/schools/doctype/fee_category/__init__.py create mode 100644 erpnext/schools/doctype/fee_category/fee_category.json create mode 100644 erpnext/schools/doctype/fee_category/fee_category.py create mode 100644 erpnext/schools/doctype/fee_category/test_fee_category.py create mode 100644 erpnext/schools/doctype/fee_structure/__init__.py create mode 100644 erpnext/schools/doctype/fee_structure/fee_structure.js create mode 100644 erpnext/schools/doctype/fee_structure/fee_structure.json create mode 100644 erpnext/schools/doctype/fee_structure/fee_structure.py create mode 100644 erpnext/schools/doctype/fee_structure/test_fee_structure.py create mode 100644 erpnext/schools/doctype/fees/__init__.py create mode 100644 erpnext/schools/doctype/fees/fees.js create mode 100644 erpnext/schools/doctype/fees/fees.json create mode 100644 erpnext/schools/doctype/fees/fees.py create mode 100644 erpnext/schools/doctype/fees/fees_list.js create mode 100644 erpnext/schools/doctype/fees/test_fees.py create mode 100644 erpnext/schools/doctype/instructor/__init__.py create mode 100644 erpnext/schools/doctype/instructor/instructor.js create mode 100644 erpnext/schools/doctype/instructor/instructor.json create mode 100644 erpnext/schools/doctype/instructor/instructor.py create mode 100644 erpnext/schools/doctype/instructor/test_instructor.py create mode 100644 erpnext/schools/doctype/instructor/test_records.json create mode 100644 erpnext/schools/doctype/program/__init__.py create mode 100644 erpnext/schools/doctype/program/program.js create mode 100644 erpnext/schools/doctype/program/program.json create mode 100644 erpnext/schools/doctype/program/program.py create mode 100644 erpnext/schools/doctype/program/test_program.py create mode 100644 erpnext/schools/doctype/program/test_records.json create mode 100644 erpnext/schools/doctype/program_course/__init__.py create mode 100644 erpnext/schools/doctype/program_course/program_course.json create mode 100644 erpnext/schools/doctype/program_course/program_course.py create mode 100644 erpnext/schools/doctype/program_enrollment/__init__.py create mode 100644 erpnext/schools/doctype/program_enrollment/program_enrollment.js create mode 100644 erpnext/schools/doctype/program_enrollment/program_enrollment.json create mode 100644 erpnext/schools/doctype/program_enrollment/program_enrollment.py create mode 100644 erpnext/schools/doctype/program_enrollment/test_program_enrollment.py create mode 100644 erpnext/schools/doctype/program_enrollment_fee/__init__.py create mode 100644 erpnext/schools/doctype/program_enrollment_fee/program_enrollment_fee.json create mode 100644 erpnext/schools/doctype/program_enrollment_fee/program_enrollment_fee.py create mode 100644 erpnext/schools/doctype/program_enrollment_tool/__init__.py create mode 100644 erpnext/schools/doctype/program_enrollment_tool/program_enrollment_tool.js create mode 100644 erpnext/schools/doctype/program_enrollment_tool/program_enrollment_tool.json create mode 100644 erpnext/schools/doctype/program_enrollment_tool/program_enrollment_tool.py create mode 100644 erpnext/schools/doctype/program_enrollment_tool_student/__init__.py create mode 100644 erpnext/schools/doctype/program_enrollment_tool_student/program_enrollment_tool_student.json create mode 100644 erpnext/schools/doctype/program_enrollment_tool_student/program_enrollment_tool_student.py create mode 100644 erpnext/schools/doctype/program_fee/__init__.py create mode 100644 erpnext/schools/doctype/program_fee/program_fee.json create mode 100644 erpnext/schools/doctype/program_fee/program_fee.py create mode 100644 erpnext/schools/doctype/room/__init__.py create mode 100644 erpnext/schools/doctype/room/room.js create mode 100644 erpnext/schools/doctype/room/room.json create mode 100644 erpnext/schools/doctype/room/room.py create mode 100644 erpnext/schools/doctype/room/test_records.json create mode 100644 erpnext/schools/doctype/room/test_room.py create mode 100644 erpnext/schools/doctype/scheduling_tool/__init__.py create mode 100644 erpnext/schools/doctype/scheduling_tool/scheduling_tool.js create mode 100644 erpnext/schools/doctype/scheduling_tool/scheduling_tool.json create mode 100644 erpnext/schools/doctype/scheduling_tool/scheduling_tool.py create mode 100644 erpnext/schools/doctype/scheduling_tool/test_scheduling_tool.py create mode 100644 erpnext/schools/doctype/sg_creation_tool_course/__init__.py create mode 100644 erpnext/schools/doctype/sg_creation_tool_course/sg_creation_tool_course.json create mode 100644 erpnext/schools/doctype/sg_creation_tool_course/sg_creation_tool_course.py create mode 100644 erpnext/schools/doctype/student/__init__.py create mode 100644 erpnext/schools/doctype/student/student.js create mode 100644 erpnext/schools/doctype/student/student.json create mode 100644 erpnext/schools/doctype/student/student.py create mode 100644 erpnext/schools/doctype/student/student_dashboard.py create mode 100644 erpnext/schools/doctype/student/test_records.json create mode 100644 erpnext/schools/doctype/student/test_student.py create mode 100644 erpnext/schools/doctype/student_applicant/__init__.py create mode 100644 erpnext/schools/doctype/student_applicant/student_applicant.js create mode 100644 erpnext/schools/doctype/student_applicant/student_applicant.json create mode 100644 erpnext/schools/doctype/student_applicant/student_applicant.py create mode 100644 erpnext/schools/doctype/student_applicant/student_applicant_list.js create mode 100644 erpnext/schools/doctype/student_applicant/test_student_applicant.py create mode 100644 erpnext/schools/doctype/student_attendance/__init__.py create mode 100644 erpnext/schools/doctype/student_attendance/student_attendance.json create mode 100644 erpnext/schools/doctype/student_attendance/student_attendance.py create mode 100644 erpnext/schools/doctype/student_attendance/student_attendance_list.js create mode 100644 erpnext/schools/doctype/student_attendance/test_student_attendance.py create mode 100644 erpnext/schools/doctype/student_attendance/untitled.txt create mode 100644 erpnext/schools/doctype/student_group/__init__.py create mode 100644 erpnext/schools/doctype/student_group/student_group.js create mode 100644 erpnext/schools/doctype/student_group/student_group.json create mode 100644 erpnext/schools/doctype/student_group/student_group.py create mode 100644 erpnext/schools/doctype/student_group/test_records.json create mode 100644 erpnext/schools/doctype/student_group/test_student_group.py create mode 100644 erpnext/schools/doctype/student_group_creation_tool/__init__.py create mode 100644 erpnext/schools/doctype/student_group_creation_tool/student_group_creation_tool.js create mode 100644 erpnext/schools/doctype/student_group_creation_tool/student_group_creation_tool.json create mode 100644 erpnext/schools/doctype/student_group_creation_tool/student_group_creation_tool.py create mode 100644 erpnext/schools/doctype/student_group_student/__init__.py create mode 100644 erpnext/schools/doctype/student_group_student/student_group_student.json create mode 100644 erpnext/schools/doctype/student_group_student/student_group_student.py create mode 100644 erpnext/schools/doctype/topic/__init__.py create mode 100644 erpnext/schools/doctype/topic/test_topic.py create mode 100644 erpnext/schools/doctype/topic/topic.js create mode 100644 erpnext/schools/doctype/topic/topic.json create mode 100644 erpnext/schools/doctype/topic/topic.py create mode 100644 erpnext/schools/report/__init__.py create mode 100644 erpnext/schools/report/student_fee_collection/__init__.py create mode 100644 erpnext/schools/report/student_fee_collection/student_fee_collection.json create mode 100644 erpnext/schools/utils.py create mode 100644 erpnext/schools/web_form/__init__.py create mode 100644 erpnext/schools/web_form/discussion/__init__.py create mode 100644 erpnext/schools/web_form/discussion/discussion.js create mode 100644 erpnext/schools/web_form/discussion/discussion.json create mode 100644 erpnext/schools/web_form/discussion/discussion.py create mode 100644 erpnext/templates/includes/announcement/announcement_row.html create mode 100644 erpnext/templates/includes/course/course_row.html create mode 100644 erpnext/templates/includes/course/macros.html create mode 100644 erpnext/templates/includes/discussion/discussion_row.html create mode 100644 erpnext/templates/includes/examination/examination_row.html create mode 100644 erpnext/templates/includes/fee/fee_row.html create mode 100644 erpnext/templates/includes/topic/topic_row.html create mode 100644 erpnext/templates/pages/announcements.html create mode 100644 erpnext/templates/pages/announcements.py create mode 100644 erpnext/templates/pages/courses.html create mode 100644 erpnext/templates/pages/courses.py create mode 100644 erpnext/templates/pages/discussions.html create mode 100644 erpnext/templates/pages/discussions.py create mode 100644 erpnext/templates/pages/topics.html create mode 100644 erpnext/templates/pages/topics.py diff --git a/erpnext/hooks.py b/erpnext/hooks.py index d58d3dd927..fd188bc83e 100644 --- a/erpnext/hooks.py +++ b/erpnext/hooks.py @@ -98,7 +98,11 @@ portal_menu_items = [ {"title": _("Invoices"), "route": "/invoices", "reference_doctype": "Sales Invoice"}, {"title": _("Shipments"), "route": "/shipments", "reference_doctype": "Delivery Note"}, {"title": _("Issues"), "route": "/issues", "reference_doctype": "Issue", "show_always": True}, - {"title": _("Addresses"), "route": "/addresses", "reference_doctype": "Address"} + {"title": _("Addresses"), "route": "/addresses", "reference_doctype": "Address"}, + {"title": _("Announcements"), "route": "/announcement", "reference_doctype": "Announcement"}, + {"title": _("Courses"), "route": "/course", "reference_doctype": "Course"}, + {"title": _("Examination Schedule"), "route": "/examination", "reference_doctype": "Examination"}, + {"title": _("Fees"), "route": "/fees", "reference_doctype": "Fees"} ] has_website_permission = { @@ -106,7 +110,8 @@ has_website_permission = { "Sales Invoice": "erpnext.controllers.website_list_for_contact.has_website_permission", "Delivery Note": "erpnext.controllers.website_list_for_contact.has_website_permission", "Issue": "erpnext.support.doctype.issue.issue.has_website_permission", - "Address": "erpnext.utilities.doctype.address.address.has_website_permission" + "Address": "erpnext.utilities.doctype.address.address.has_website_permission", + "Discussion": "erpnext.schools.web_form.discussion.discussion.has_website_permission" } permission_query_conditions = { diff --git a/erpnext/modules.txt b/erpnext/modules.txt index 11a1ebe5c6..609a3fe556 100644 --- a/erpnext/modules.txt +++ b/erpnext/modules.txt @@ -12,4 +12,5 @@ Utilities Shopping Cart Hub Node Portal -Maintenance \ No newline at end of file +Maintenance +Schools \ No newline at end of file diff --git a/erpnext/patches/v7_0/migrate_schools_to_erpnext.py b/erpnext/patches/v7_0/migrate_schools_to_erpnext.py new file mode 100644 index 0000000000..95ab16c97a --- /dev/null +++ b/erpnext/patches/v7_0/migrate_schools_to_erpnext.py @@ -0,0 +1,7 @@ +from __future__ import unicode_literals +import frappe + +def execute(): + frappe.db.sql("""update `tabDoctype` set module='Schools' where module='Academics'""") + from frappe.installer import remove_from_installed_apps + remove_from_installed_apps("schools") \ No newline at end of file diff --git a/erpnext/public/js/setup_wizard.js b/erpnext/public/js/setup_wizard.js index 0228fa1939..9954ae03ce 100644 --- a/erpnext/public/js/setup_wizard.js +++ b/erpnext/public/js/setup_wizard.js @@ -28,6 +28,7 @@ function load_erpnext_slides() { {"label": __("Manufacturing"), "value": "Manufacturing"}, {"label": __("Retail"), "value": "Retail"}, {"label": __("Services"), "value": "Services"}, + {"label": __("Education"), "value": "Education"}, {"label": __("Other"), "value": "Other"}, ], reqd:1}, {fieldname:'chart_of_accounts', label: __('Chart of Accounts'), diff --git a/erpnext/schools/__init__.py b/erpnext/schools/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/erpnext/schools/api.py b/erpnext/schools/api.py new file mode 100644 index 0000000000..26577b4adb --- /dev/null +++ b/erpnext/schools/api.py @@ -0,0 +1,146 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2015, Frappe Technologies and contributors +# For license information, please see license.txt + +from __future__ import unicode_literals +import frappe +import json +from frappe import _ +from frappe.model.mapper import get_mapped_doc +from frappe.utils import flt + +@frappe.whitelist() +def enroll_student(source_name): + """Creates a Student Record and returns a Program Enrollment. + + :param source_name: Student Applicant. + """ + student = get_mapped_doc("Student Applicant", source_name, + {"Student Applicant": { + "doctype": "Student", + "field_map": { + "name": "student_applicant" + } + }}) + student.save() + + program_enrollment = frappe.new_doc("Program Enrollment") + program_enrollment.student = student.name + program_enrollment.student_name = student.title + program_enrollment.program = frappe.db.get_value("Student Applicant", source_name, "program") + return program_enrollment + +@frappe.whitelist() +def check_attendance_records_exist(course_schedule): + """Check if Attendance Records are made against the specified Course Schedule. + + :param course_schedule: Course Schedule. + """ + return frappe.get_list("Student Attendance", filters={"course_schedule": course_schedule}) + +@frappe.whitelist() +def mark_attendance(students_present, students_absent, course_schedule): + """Creates Multiple Attendance Records. + + :param students_present: Students Present JSON. + :param students_absent: Students Absent JSON. + :param course_schedule: Course Schedule. + """ + present = json.loads(students_present) + absent = json.loads(students_absent) + + for d in present: + make_attendance_records(d["student"], d["student_name"], course_schedule, "Present") + + for d in absent: + make_attendance_records(d["student"], d["student_name"], course_schedule, "Absent") + + frappe.msgprint(_("Attendance has been marked successfully.")) + +def make_attendance_records(student, student_name, course_schedule, status): + """Creates Attendance Record. + + :param student: Student. + :param student_name: Student Name. + :param course_schedule: Course Schedule. + :param status: Status (Present/Absent) + """ + student_attendance = frappe.new_doc("Student Attendance") + student_attendance.student = student + student_attendance.student_name = student_name + student_attendance.course_schedule = course_schedule + student_attendance.status = status + student_attendance.submit() + frappe.db.commit() + +@frappe.whitelist() +def get_student_group_students(student_group): + """Returns List of student, student_name in Student Group. + + :param student_group: Student Group. + """ + students = frappe.get_list("Student Group Student", fields=["student", "student_name"] , filters={"parent": student_group}, order_by= "idx") + return students + +@frappe.whitelist() +def get_fee_structure(program, academic_term=None): + """Returns Fee Structure. + + :param program: Program. + :param academic_term: Academic Term. + """ + fee_structure = frappe.db.get_values("Fee Structure", {"program": program, + "academic_term": academic_term}, 'name', as_dict=True) + return fee_structure[0].name if fee_structure else None + +@frappe.whitelist() +def get_fee_amount(fee_structure): + """Returns Fee Amount. + + :param fee_structure: Fee Structure. + """ + if fee_structure: + fs = frappe.get_list("Fee Amount", fields=["fees_category", "amount"] , filters={"parent": fee_structure}, order_by= "idx") + return fs + +@frappe.whitelist() +def get_fee_schedule(program): + """Returns Fee Schedule. + + :param program: Program. + """ + fs = frappe.get_list("Program Fee", fields=["academic_term", "fee_structure", "due_date", "amount"] , + filters={"parent": program}, order_by= "idx") + return fs + +@frappe.whitelist() +def collect_fees(fees, amt): + paid_amount = flt(amt) + flt(frappe.db.get_value("Fees", fees, "paid_amount")) + total_amount = flt(frappe.db.get_value("Fees", fees, "total_amount")) + frappe.db.set_value("Fees", fees, "paid_amount", paid_amount) + frappe.db.set_value("Fees", fees, "outstanding_amount", (total_amount - paid_amount)) + return paid_amount + +@frappe.whitelist() +def get_course_schedule_events(start, end, filters=None): + """Returns events for Course Schedule Calendar view rendering. + + :param start: Start date-time. + :param end: End date-time. + :param filters: Filters (JSON). + """ + from frappe.desk.calendar import get_event_conditions + conditions = get_event_conditions("Course Schedule", filters) + + data = frappe.db.sql("""select name, course, + timestamp(schedule_date, from_time) as from_datetime, + timestamp(schedule_date, to_time) as to_datetime, + room, student_group, 0 as 'allDay' + from `tabCourse Schedule` + where ( schedule_date between %(start)s and %(end)s ) + {conditions}""".format(conditions=conditions), { + "start": start, + "end": end + }, as_dict=True, update={"allDay": 0}) + + return data diff --git a/erpnext/schools/doctype/__init__.py b/erpnext/schools/doctype/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/erpnext/schools/doctype/academic_term/__init__.py b/erpnext/schools/doctype/academic_term/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/erpnext/schools/doctype/academic_term/academic_term.json b/erpnext/schools/doctype/academic_term/academic_term.json new file mode 100644 index 0000000000..1e788e247a --- /dev/null +++ b/erpnext/schools/doctype/academic_term/academic_term.json @@ -0,0 +1,94 @@ +{ + "allow_copy": 0, + "allow_import": 1, + "allow_rename": 1, + "autoname": "field:term_name", + "creation": "2015-09-08 17:19:19.158228", + "custom": 0, + "docstatus": 0, + "doctype": "DocType", + "document_type": "Setup", + "fields": [ + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "fieldname": "term_name", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, + "label": "Term Name", + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + } + ], + "hide_heading": 0, + "hide_toolbar": 0, + "in_create": 0, + "in_dialog": 0, + "is_submittable": 0, + "issingle": 0, + "istable": 0, + "modified": "2016-07-18 10:30:50.243271", + "modified_by": "Administrator", + "module": "Schools", + "name": "Academic Term", + "name_case": "", + "owner": "Administrator", + "permissions": [ + { + "amend": 0, + "apply_user_permissions": 0, + "cancel": 0, + "create": 1, + "delete": 1, + "email": 1, + "export": 1, + "if_owner": 0, + "import": 0, + "permlevel": 0, + "print": 1, + "read": 1, + "report": 1, + "role": "Academics User", + "set_user_permissions": 0, + "share": 1, + "submit": 0, + "write": 1 + }, + { + "amend": 0, + "apply_user_permissions": 0, + "cancel": 0, + "create": 1, + "delete": 1, + "email": 1, + "export": 1, + "if_owner": 0, + "import": 0, + "permlevel": 0, + "print": 1, + "read": 1, + "report": 1, + "role": "Administrator", + "set_user_permissions": 0, + "share": 1, + "submit": 0, + "write": 1 + } + ], + "read_only": 0, + "read_only_onload": 0, + "sort_field": "modified", + "sort_order": "DESC" +} \ No newline at end of file diff --git a/erpnext/schools/doctype/academic_term/academic_term.py b/erpnext/schools/doctype/academic_term/academic_term.py new file mode 100644 index 0000000000..1a4526b3eb --- /dev/null +++ b/erpnext/schools/doctype/academic_term/academic_term.py @@ -0,0 +1,10 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2015, Frappe Technologies and contributors +# For license information, please see license.txt + +from __future__ import unicode_literals +import frappe +from frappe.model.document import Document + +class AcademicTerm(Document): + pass diff --git a/erpnext/schools/doctype/academic_term/test_academic_term.py b/erpnext/schools/doctype/academic_term/test_academic_term.py new file mode 100644 index 0000000000..0964a56454 --- /dev/null +++ b/erpnext/schools/doctype/academic_term/test_academic_term.py @@ -0,0 +1,12 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2015, Frappe Technologies and Contributors +# See license.txt +from __future__ import unicode_literals + +import frappe +import unittest + +# test_records = frappe.get_test_records('Academic Term') + +class TestAcademicTerm(unittest.TestCase): + pass diff --git a/erpnext/schools/doctype/academic_term/test_records.json b/erpnext/schools/doctype/academic_term/test_records.json new file mode 100644 index 0000000000..9807221053 --- /dev/null +++ b/erpnext/schools/doctype/academic_term/test_records.json @@ -0,0 +1,11 @@ +[ + { + "term_name": "_Test Academic Term" + }, + { + "term_name": "_Test Academic Term 1" + }, + { + "term_name": "_Test Academic Term 2" + } +] \ No newline at end of file diff --git a/erpnext/schools/doctype/academic_year/__init__.py b/erpnext/schools/doctype/academic_year/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/erpnext/schools/doctype/academic_year/academic_year.js b/erpnext/schools/doctype/academic_year/academic_year.js new file mode 100644 index 0000000000..21caa63369 --- /dev/null +++ b/erpnext/schools/doctype/academic_year/academic_year.js @@ -0,0 +1,10 @@ +frappe.ui.form.on("Academic Year", "refresh", function(frm) { + if(!frm.doc.__islocal) { + frm.add_custom_button(__("Student Group"), function() { + frappe.route_options = { + academic_year: frm.doc.name + } + frappe.set_route("List", "Student Group"); + }); + } +}); \ No newline at end of file diff --git a/erpnext/schools/doctype/academic_year/academic_year.json b/erpnext/schools/doctype/academic_year/academic_year.json new file mode 100644 index 0000000000..8f69d7f697 --- /dev/null +++ b/erpnext/schools/doctype/academic_year/academic_year.json @@ -0,0 +1,139 @@ +{ + "allow_copy": 0, + "allow_import": 1, + "allow_rename": 0, + "autoname": "field:academic_year_name", + "creation": "2015-09-07 12:49:51.303026", + "custom": 0, + "docstatus": 0, + "doctype": "DocType", + "document_type": "", + "fields": [ + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "fieldname": "academic_year_name", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, + "label": "Academic Year Name", + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 1, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "fieldname": "year_start_date", + "fieldtype": "Date", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 1, + "label": "Year Start Date", + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "fieldname": "year_end_date", + "fieldtype": "Date", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 1, + "label": "Year End Date", + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + } + ], + "hide_heading": 0, + "hide_toolbar": 0, + "in_create": 0, + "in_dialog": 0, + "is_submittable": 0, + "issingle": 0, + "istable": 0, + "modified": "2016-07-18 10:30:50.243271", + "modified_by": "Administrator", + "module": "Schools", + "name": "Academic Year", + "name_case": "", + "owner": "Administrator", + "permissions": [ + { + "amend": 0, + "apply_user_permissions": 0, + "cancel": 0, + "create": 1, + "delete": 1, + "email": 1, + "export": 1, + "if_owner": 0, + "import": 0, + "permlevel": 0, + "print": 1, + "read": 1, + "report": 1, + "role": "Academics User", + "set_user_permissions": 0, + "share": 1, + "submit": 0, + "write": 1 + }, + { + "amend": 0, + "apply_user_permissions": 0, + "cancel": 0, + "create": 1, + "delete": 1, + "email": 1, + "export": 1, + "if_owner": 0, + "import": 0, + "permlevel": 0, + "print": 1, + "read": 1, + "report": 1, + "role": "Administrator", + "set_user_permissions": 0, + "share": 1, + "submit": 0, + "write": 1 + } + ], + "read_only": 0, + "read_only_onload": 0, + "sort_field": "modified", + "sort_order": "DESC", + "title_field": "" +} \ No newline at end of file diff --git a/erpnext/schools/doctype/academic_year/academic_year.py b/erpnext/schools/doctype/academic_year/academic_year.py new file mode 100644 index 0000000000..4b955de5c7 --- /dev/null +++ b/erpnext/schools/doctype/academic_year/academic_year.py @@ -0,0 +1,10 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2015, Frappe Technologies and contributors +# For license information, please see license.txt + +from __future__ import unicode_literals +import frappe +from frappe.model.document import Document + +class AcademicYear(Document): + pass diff --git a/erpnext/schools/doctype/academic_year/test_academic_year.py b/erpnext/schools/doctype/academic_year/test_academic_year.py new file mode 100644 index 0000000000..9da75a7214 --- /dev/null +++ b/erpnext/schools/doctype/academic_year/test_academic_year.py @@ -0,0 +1,12 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2015, Frappe Technologies and Contributors +# See license.txt +from __future__ import unicode_literals + +import frappe +import unittest + +# test_records = frappe.get_test_records('Academic Year') + +class TestAcademicYear(unittest.TestCase): + pass diff --git a/erpnext/schools/doctype/academic_year/test_records.json b/erpnext/schools/doctype/academic_year/test_records.json new file mode 100644 index 0000000000..dba4f1285d --- /dev/null +++ b/erpnext/schools/doctype/academic_year/test_records.json @@ -0,0 +1,11 @@ +[ + { + "academic_year_name": "2014-2015" + }, + { + "academic_year_name": "2015-2016" + }, + { + "academic_year_name": "2016-2017" + } +] \ No newline at end of file diff --git a/erpnext/schools/doctype/announcement/__init__.py b/erpnext/schools/doctype/announcement/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/erpnext/schools/doctype/announcement/announcement.js b/erpnext/schools/doctype/announcement/announcement.js new file mode 100644 index 0000000000..5b1d1c0898 --- /dev/null +++ b/erpnext/schools/doctype/announcement/announcement.js @@ -0,0 +1,9 @@ +// Copyright (c) 2016, Frappe and contributors +// For license information, please see license.txt + +frappe.ui.form.on('Announcement', { + onload: function(frm) { + frm.add_fetch('instructor', 'instructor_name' , 'posted_by'); + } +}); + diff --git a/erpnext/schools/doctype/announcement/announcement.json b/erpnext/schools/doctype/announcement/announcement.json new file mode 100644 index 0000000000..c965da516c --- /dev/null +++ b/erpnext/schools/doctype/announcement/announcement.json @@ -0,0 +1,334 @@ +{ + "allow_copy": 0, + "allow_import": 0, + "allow_rename": 0, + "autoname": "announcement.#####", + "beta": 0, + "creation": "2016-06-23 05:37:33.996289", + "custom": 0, + "docstatus": 0, + "doctype": "DocType", + "document_type": "Document", + "fields": [ + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "default": "", + "fieldname": "receiver", + "fieldtype": "Select", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 1, + "label": "Receiver", + "length": 0, + "no_copy": 0, + "options": "Student\nStudent Group\nAll Students", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 1, + "search_index": 1, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "fieldname": "instructor", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 0, + "label": "Instructor", + "length": 0, + "no_copy": 0, + "options": "Instructor", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "fieldname": "column_break_3", + "fieldtype": "Column Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 0, + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "depends_on": "eval: doc.receiver == \"Student\"", + "fieldname": "student", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 1, + "label": "Student", + "length": 0, + "no_copy": 0, + "options": "Student", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 1, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "depends_on": "eval: doc.receiver == \"Student Group\"", + "fieldname": "student_group", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 1, + "label": "Student Group", + "length": 0, + "no_copy": 0, + "options": "Student Group", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 1, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "fieldname": "posted_by", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 0, + "label": "Posted By", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 1, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "fieldname": "section_break_5", + "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 0, + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "fieldname": "subject", + "fieldtype": "Small Text", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 0, + "label": "Subject", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 1, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "fieldname": "description", + "fieldtype": "Text Editor", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 0, + "label": "Description", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 1, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "fieldname": "amended_from", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 0, + "label": "Amended From", + "length": 0, + "no_copy": 1, + "options": "Announcement", + "permlevel": 0, + "print_hide": 1, + "print_hide_if_no_value": 0, + "read_only": 1, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + } + ], + "hide_heading": 0, + "hide_toolbar": 0, + "idx": 0, + "image_view": 0, + "in_create": 0, + "in_dialog": 0, + "is_submittable": 1, + "issingle": 0, + "istable": 0, + "max_attachments": 0, + "modified": "2016-07-18 10:30:50.243271", + "modified_by": "Administrator", + "module": "Schools", + "name": "Announcement", + "name_case": "", + "owner": "demo@erpnext.com", + "permissions": [ + { + "amend": 1, + "apply_user_permissions": 0, + "cancel": 1, + "create": 1, + "delete": 1, + "email": 1, + "export": 1, + "if_owner": 0, + "import": 0, + "permlevel": 0, + "print": 1, + "read": 1, + "report": 1, + "role": "Academics User", + "set_user_permissions": 0, + "share": 1, + "submit": 1, + "write": 1 + }, + { + "amend": 0, + "apply_user_permissions": 0, + "cancel": 0, + "create": 1, + "delete": 0, + "email": 1, + "export": 1, + "if_owner": 0, + "import": 0, + "permlevel": 0, + "print": 1, + "read": 1, + "report": 1, + "role": "Guest", + "set_user_permissions": 0, + "share": 1, + "submit": 0, + "write": 1 + } + ], + "quick_entry": 0, + "read_only": 0, + "read_only_onload": 0, + "sort_field": "modified", + "sort_order": "DESC", + "title_field": "subject", + "track_seen": 1 +} \ No newline at end of file diff --git a/erpnext/schools/doctype/announcement/announcement.py b/erpnext/schools/doctype/announcement/announcement.py new file mode 100644 index 0000000000..1a3fe75d82 --- /dev/null +++ b/erpnext/schools/doctype/announcement/announcement.py @@ -0,0 +1,75 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2015, Frappe and contributors +# For license information, please see license.txt + +from __future__ import unicode_literals +import frappe +from frappe.model.document import Document +from frappe import _ + +class Announcement(Document): + def validate(self): + self.validate_receiver() + self.set_posted_by() + + def validate_receiver(self): + if self.receiver == "Student": + if not self.student: + frappe.throw(_("Please select a Student")) + self.student_group = None + elif self.receiver == "Student Group": + if not self.student_group: + frappe.throw(_("Please select a Student Group")) + self.student = None + else: + self.student_group = None + self.student = None + + def set_posted_by(self): + if self.instructor: + self.posted_by = frappe.db.get_value("Instructor", self.instructor, "instructor_name") + else: + self.posted_by = frappe.session.user + + + + +def get_message_list(doctype, txt, filters, limit_start, limit_page_length=20): + user = frappe.session.user + student = frappe.db.sql("select name from `tabStudent` where student_email_id= %s", user) + if student: + sg_list = frappe.db.sql("""select parent from `tabStudent Group Student` as sgs + where sgs.student = %s """,(student)) + + data = frappe.db.sql("""select name, receiver, subject, description, posted_by, modified, + student, student_group + from `tabAnnouncement` as announce + where (announce.receiver = "Student" and announce.student = %s) + or (announce.receiver = "Student Group" and announce.student_group in %s) + or announce.receiver = "All Students" + and announce.docstatus = 1 + order by announce.idx asc limit {0} , {1}""" + .format(limit_start, limit_page_length), (student,sg_list), as_dict = True) + + for announcement in data: + try: + num_attachments = frappe.db.sql(""" select count(file_url) from tabFile as file + where file.attached_to_name=%s + and file.attached_to_doctype=%s""",(announcement.name,"Announcement")) + + except IOError or frappe.DoesNotExistError: + pass + frappe.local.message_log.pop() + + announcement.num_attachments = num_attachments[0][0] + + return data + +def get_list_context(context=None): + return { + "show_sidebar": True, + 'no_breadcrumbs': True, + "title": _("Announcements"), + "get_list": get_message_list, + "row_template": "templates/includes/announcement/announcement_row.html" + } \ No newline at end of file diff --git a/erpnext/schools/doctype/announcement/test_announcement.py b/erpnext/schools/doctype/announcement/test_announcement.py new file mode 100644 index 0000000000..b0200a238c --- /dev/null +++ b/erpnext/schools/doctype/announcement/test_announcement.py @@ -0,0 +1,12 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2015, Frappe and Contributors +# See license.txt +from __future__ import unicode_literals + +import frappe +import unittest + +# test_records = frappe.get_test_records('Announcement') + +class TestAnnouncement(unittest.TestCase): + pass diff --git a/erpnext/schools/doctype/attendance_tool_student/__init__.py b/erpnext/schools/doctype/attendance_tool_student/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/erpnext/schools/doctype/attendance_tool_student/attendance_tool_student.json b/erpnext/schools/doctype/attendance_tool_student/attendance_tool_student.json new file mode 100644 index 0000000000..47a71f053e --- /dev/null +++ b/erpnext/schools/doctype/attendance_tool_student/attendance_tool_student.json @@ -0,0 +1,98 @@ +{ + "allow_copy": 0, + "allow_import": 0, + "allow_rename": 0, + "creation": "2015-11-10 16:28:51.366668", + "custom": 0, + "docstatus": 0, + "doctype": "DocType", + "document_type": "", + "fields": [ + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "fieldname": "student", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 1, + "label": "Student", + "no_copy": 0, + "options": "Student", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 1, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "fieldname": "student_name", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 1, + "label": "Student Name", + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "read_only": 1, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "fieldname": "status", + "fieldtype": "Select", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, + "label": "Status", + "no_copy": 0, + "options": "Absent\nPresent\n", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + } + ], + "hide_heading": 0, + "hide_toolbar": 0, + "in_create": 0, + "in_dialog": 0, + "is_submittable": 0, + "issingle": 1, + "istable": 1, + "modified": "2016-07-18 10:30:50.243271", + "modified_by": "Administrator", + "module": "Schools", + "name": "Attendance Tool Student", + "name_case": "", + "owner": "Administrator", + "permissions": [], + "read_only": 0, + "read_only_onload": 0, + "sort_field": "modified", + "sort_order": "DESC" +} \ No newline at end of file diff --git a/erpnext/schools/doctype/attendance_tool_student/attendance_tool_student.py b/erpnext/schools/doctype/attendance_tool_student/attendance_tool_student.py new file mode 100644 index 0000000000..99a89d987b --- /dev/null +++ b/erpnext/schools/doctype/attendance_tool_student/attendance_tool_student.py @@ -0,0 +1,10 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2015, Frappe Technologies and contributors +# For license information, please see license.txt + +from __future__ import unicode_literals +import frappe +from frappe.model.document import Document + +class AttendanceToolStudent(Document): + pass diff --git a/erpnext/schools/doctype/course/.txt b/erpnext/schools/doctype/course/.txt new file mode 100644 index 0000000000..e69de29bb2 diff --git a/erpnext/schools/doctype/course/__init__.py b/erpnext/schools/doctype/course/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/erpnext/schools/doctype/course/course.js b/erpnext/schools/doctype/course/course.js new file mode 100644 index 0000000000..75cf4f8d2b --- /dev/null +++ b/erpnext/schools/doctype/course/course.js @@ -0,0 +1,31 @@ +frappe.ui.form.on("Course", "refresh", function(frm) { + if(!cur_frm.doc.__islocal) { + frm.add_custom_button(__("Program"), function() { + frappe.route_options = { + "Program Course.course": frm.doc.name + } + frappe.set_route("List", "Program"); + }); + + frm.add_custom_button(__("Student Group"), function() { + frappe.route_options = { + course: frm.doc.name + } + frappe.set_route("List", "Student Group"); + }); + + frm.add_custom_button(__("Course Schedule"), function() { + frappe.route_options = { + course: frm.doc.name + } + frappe.set_route("List", "Course Schedule"); + }); + + frm.add_custom_button(__("Examination"), function() { + frappe.route_options = { + course: frm.doc.name + } + frappe.set_route("List", "Examination"); + }); + } +}); \ No newline at end of file diff --git a/erpnext/schools/doctype/course/course.json b/erpnext/schools/doctype/course/course.json new file mode 100644 index 0000000000..f3d82e6814 --- /dev/null +++ b/erpnext/schools/doctype/course/course.json @@ -0,0 +1,181 @@ +{ + "allow_copy": 0, + "allow_import": 1, + "allow_rename": 1, + "autoname": "field:course_name", + "beta": 0, + "creation": "2015-09-07 12:39:55.181893", + "custom": 0, + "docstatus": 0, + "doctype": "DocType", + "document_type": "", + "fields": [ + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "fieldname": "course_name", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 0, + "label": "Course Name", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 1, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "fieldname": "course_code", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 1, + "label": "Course Code", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "fieldname": "department", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 1, + "label": "Department", + "length": 0, + "no_copy": 0, + "options": "Department", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "fieldname": "course_intro", + "fieldtype": "Text Editor", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 0, + "label": "Course Intro", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + } + ], + "hide_heading": 0, + "hide_toolbar": 0, + "idx": 0, + "image_view": 0, + "in_create": 0, + "in_dialog": 0, + "is_submittable": 0, + "issingle": 0, + "istable": 0, + "max_attachments": 0, + "menu_index": 0, + "modified": "2016-07-18 10:30:50.243271", + "modified_by": "Administrator", + "module": "Schools", + "name": "Course", + "name_case": "", + "owner": "Administrator", + "permissions": [ + { + "amend": 0, + "apply_user_permissions": 0, + "cancel": 0, + "create": 1, + "delete": 1, + "email": 1, + "export": 1, + "if_owner": 0, + "import": 0, + "permlevel": 0, + "print": 1, + "read": 1, + "report": 1, + "role": "Administrator", + "set_user_permissions": 0, + "share": 1, + "submit": 0, + "write": 1 + }, + { + "amend": 0, + "apply_user_permissions": 0, + "cancel": 0, + "create": 1, + "delete": 1, + "email": 1, + "export": 1, + "if_owner": 0, + "import": 0, + "permlevel": 0, + "print": 1, + "read": 1, + "report": 1, + "role": "Academics User", + "set_user_permissions": 0, + "share": 1, + "submit": 0, + "write": 1 + } + ], + "quick_entry": 0, + "read_only": 0, + "read_only_onload": 0, + "search_fields": "department", + "sort_field": "modified", + "sort_order": "DESC", + "track_seen": 0 +} \ No newline at end of file diff --git a/erpnext/schools/doctype/course/course.py b/erpnext/schools/doctype/course/course.py new file mode 100644 index 0000000000..beeb6ec39c --- /dev/null +++ b/erpnext/schools/doctype/course/course.py @@ -0,0 +1,28 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2015, Frappe Technologies and contributors +# For license information, please see license.txt + +from __future__ import unicode_literals +import frappe +from frappe.model.document import Document +from frappe import _ + +class Course(Document): + pass + +def get_sg_list(doctype, txt, filters, limit_start, limit_page_length=20): + user = frappe.session.user + student = frappe.db.sql("select name from `tabStudent` where student_email_id= %s", user) + if student: + return frappe.db.sql('''select group_name, course, academic_term, academic_year, SG.name from `tabStudent Group` + as SG, `tabStudent Group Student` as SGS where SG.group_name = SGS.parent and SGS.student = %s + order by SG.group_name asc limit {0} , {1}'''.format(limit_start, limit_page_length), student, as_dict=True) + +def get_list_context(context=None): + return { + "show_sidebar": True, + 'no_breadcrumbs': True, + "title": _("Courses"), + "get_list": get_sg_list, + "row_template": "templates/includes/course/course_row.html" + } \ No newline at end of file diff --git a/erpnext/schools/doctype/course/test_course.py b/erpnext/schools/doctype/course/test_course.py new file mode 100644 index 0000000000..b18f4a94be --- /dev/null +++ b/erpnext/schools/doctype/course/test_course.py @@ -0,0 +1,12 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2015, Frappe Technologies and Contributors +# See license.txt +from __future__ import unicode_literals + +import frappe +import unittest + +# test_records = frappe.get_test_records('Course') + +class TestCourse(unittest.TestCase): + pass diff --git a/erpnext/schools/doctype/course/test_records.json b/erpnext/schools/doctype/course/test_records.json new file mode 100644 index 0000000000..5dc981a639 --- /dev/null +++ b/erpnext/schools/doctype/course/test_records.json @@ -0,0 +1,14 @@ +[ + { + "course_name": "_Test Course", + "course_code": "TC100" + }, + { + "course_name": "_Test Course 1", + "course_code": "TC101" + }, + { + "course_name": "_Test Course 2", + "course_code": "TC102" + } +] \ No newline at end of file diff --git a/erpnext/schools/doctype/course_schedule/__init__.py b/erpnext/schools/doctype/course_schedule/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/erpnext/schools/doctype/course_schedule/course_schedule.js b/erpnext/schools/doctype/course_schedule/course_schedule.js new file mode 100644 index 0000000000..2defbd5df6 --- /dev/null +++ b/erpnext/schools/doctype/course_schedule/course_schedule.js @@ -0,0 +1,137 @@ +frappe.provide("schools") + +frappe.ui.form.on("Course Schedule" ,{ + onload: function(frm) { + if (frm.doc.from_datetime && frm.doc.to_datetime) { + var from_datetime = moment(frm.doc.from_datetime); + var to_datetime = moment(frm.doc.to_datetime); + frm.doc.schedule_date = from_datetime.format(moment.defaultFormat); + frm.doc.from_time = from_datetime.format("HH:mm:ss"); + frm.doc.to_time = to_datetime.format("HH:mm:ss"); + } + }, + + refresh :function(frm) { + if(!frm.doc.__islocal) { + frappe.call({ + method: "erpnext.schools.api.check_attendance_records_exist", + args: { + "course_schedule": frm.doc.name + }, + callback: function(r) { + if(r.message) { + hide_field('attendance'); + frm.events.view_attendance(frm) + } + else { + frappe.call({ + method: "erpnext.schools.api.get_student_group_students", + args: { + "student_group": frm.doc.student_group + }, + callback: function(r) { + if (r.message) { + frm.events.get_students(frm, r.message) + } + } + }); + } + } + }); + } + else { + hide_field('attendance'); + } + }, + + view_attendance: function(frm) { + hide_field('attendance'); + frm.add_custom_button(__("View attendance"), function() { + frappe.route_options = { + course_schedule: frm.doc.name + } + frappe.set_route("List", "Student Attendance"); + }); + }, + + get_students: function(frm, students) { + if(!frm.students_area) { + frm.students_area = $('
') + .appendTo(frm.fields_dict.students_html.wrapper); + } + frm.students_editor = new schools.StudentsEditor(frm, frm.students_area, students) + } +}); + + +schools.StudentsEditor = Class.extend({ + init: function(frm, wrapper, students) { + this.wrapper = wrapper; + this.frm = frm; + this.make(frm, students); + }, + make: function(frm, students) { + var me = this; + + $(this.wrapper).empty(); + var student_toolbar = $('

\ + \ + \ +

').appendTo($(this.wrapper)); + + student_toolbar.find(".btn-add") + .html(__('Check all')) + .on("click", function() { + $(me.wrapper).find('input[type="checkbox"]').each(function(i, check) { + if(!$(check).is(":checked")) { + check.checked = true; + } + }); + }); + + student_toolbar.find(".btn-remove") + .html(__('Uncheck all')) + .on("click", function() { + $(me.wrapper).find('input[type="checkbox"]').each(function(i, check) { + if($(check).is(":checked")) { + check.checked = false; + } + }); + }); + + student_toolbar.find(".btn-mark-att") + .html(__('Mark Attendence')) + .on("click", function() { + var students_present = []; + var students_absent = []; + $(me.wrapper).find('input[type="checkbox"]').each(function(i, check) { + if($(check).is(":checked")) { + students_present.push(students[i]); + } + else { + students_absent.push(students[i]); + } + }); + frappe.call({ + method: "erpnext.schools.api.mark_attendance", + args: { + "students_present": students_present, + "students_absent": students_absent, + "course_schedule": frm.doc.name + }, + callback: function(r) { + frm.events.view_attendance(frm) + } + }); + }); + + + $.each(students, function(i, m) { + $(repl('
\ +
\ + \ +
', {student: m.student_name})).appendTo(me.wrapper); + }); + } +}) \ No newline at end of file diff --git a/erpnext/schools/doctype/course_schedule/course_schedule.json b/erpnext/schools/doctype/course_schedule/course_schedule.json new file mode 100644 index 0000000000..137c589619 --- /dev/null +++ b/erpnext/schools/doctype/course_schedule/course_schedule.json @@ -0,0 +1,402 @@ +{ + "allow_copy": 0, + "allow_import": 1, + "allow_rename": 0, + "autoname": "SH.####", + "creation": "2015-09-09 16:34:04.960369", + "custom": 0, + "docstatus": 0, + "doctype": "DocType", + "document_type": "Document", + "fields": [ + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "fieldname": "student_group", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, + "label": "Student Group", + "length": 0, + "no_copy": 0, + "options": "Student Group", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 1, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "fieldname": "instructor", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, + "label": "Instructor", + "length": 0, + "no_copy": 0, + "options": "Instructor", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 1, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "fieldname": "column_break_2", + "fieldtype": "Column Break", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "fieldname": "course", + "fieldtype": "Read Only", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, + "label": "Course", + "length": 0, + "no_copy": 0, + "options": "student_group.course", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "read_only": 1, + "report_hide": 0, + "reqd": 1, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "fieldname": "instructor_name", + "fieldtype": "Read Only", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, + "label": "Instructor Name", + "length": 0, + "no_copy": 0, + "options": "instructor.Instructor_name", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "read_only": 1, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "fieldname": "section_break_6", + "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "default": "Today", + "fieldname": "schedule_date", + "fieldtype": "Date", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, + "label": "Schedule Date", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "fieldname": "room", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, + "label": "Room", + "length": 0, + "no_copy": 0, + "options": "Room", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 1, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "fieldname": "column_break_9", + "fieldtype": "Column Break", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "fieldname": "from_time", + "fieldtype": "Time", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 1, + "label": "From Time", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 1, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "fieldname": "to_time", + "fieldtype": "Time", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 1, + "label": "To Time", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 1, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 1, + "fieldname": "attendance", + "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, + "label": "Attendance", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "fieldname": "students_html", + "fieldtype": "HTML", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, + "label": "Students HTML", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "read_only": 1, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "fieldname": "title", + "fieldtype": "Data", + "hidden": 1, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, + "label": "Title", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + } + ], + "hide_heading": 0, + "hide_toolbar": 0, + "idx": 0, + "in_create": 0, + "in_dialog": 0, + "is_submittable": 0, + "issingle": 0, + "istable": 0, + "max_attachments": 0, + "menu_index": 0, + "modified": "2016-07-18 10:30:50.243271", + "modified_by": "Administrator", + "module": "Schools", + "name": "Course Schedule", + "name_case": "", + "owner": "Administrator", + "permissions": [ + { + "amend": 0, + "apply_user_permissions": 0, + "cancel": 0, + "create": 1, + "delete": 1, + "email": 1, + "export": 1, + "if_owner": 0, + "import": 0, + "permlevel": 0, + "print": 1, + "read": 1, + "report": 1, + "role": "Administrator", + "set_user_permissions": 0, + "share": 1, + "submit": 0, + "write": 1 + }, + { + "amend": 0, + "apply_user_permissions": 0, + "cancel": 0, + "create": 1, + "delete": 1, + "email": 1, + "export": 1, + "if_owner": 0, + "import": 0, + "permlevel": 0, + "print": 1, + "read": 1, + "report": 1, + "role": "Academics User", + "set_user_permissions": 0, + "share": 1, + "submit": 0, + "write": 1 + } + ], + "read_only": 0, + "read_only_onload": 0, + "sort_field": "schedule_date", + "sort_order": "DESC", + "title_field": "title", + "version": 0 +} \ No newline at end of file diff --git a/erpnext/schools/doctype/course_schedule/course_schedule.py b/erpnext/schools/doctype/course_schedule/course_schedule.py new file mode 100644 index 0000000000..36ad29beb4 --- /dev/null +++ b/erpnext/schools/doctype/course_schedule/course_schedule.py @@ -0,0 +1,37 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2015, Frappe Technologies and contributors +# For license information, please see license.txt + +from __future__ import unicode_literals +import frappe +from frappe.model.document import Document + +class CourseSchedule(Document): + def validate(self): + self.instructor_name = frappe.db.get_value("Instructor", self.instructor, "instructor_name") + self.set_title() + self.validate_date() + self.validate_overlap() + + def set_title(self): + """Set document Title""" + self.title = self.course + " by " + (self.instructor_name if self.instructor_name else self.instructor) + + def validate_date(self): + """Validates if from_time is greater than to_time""" + if self.from_time > self.to_time: + frappe.throw("From Time cannot be greater than To Time.") + + def validate_overlap(self): + """Validates overlap for Student Group, Instructor, Room""" + + from erpnext.schools.utils import validate_overlap_for + + validate_overlap_for(self, "Course Schedule", "student_group" ) + validate_overlap_for(self, "Course Schedule", "instructor") + validate_overlap_for(self, "Course Schedule", "room") + + validate_overlap_for(self, "Examination", "student_group") + validate_overlap_for(self, "Examination", "room") + validate_overlap_for(self, "Examination", "supervisor", self.instructor) + diff --git a/erpnext/schools/doctype/course_schedule/course_schedule_calendar.js b/erpnext/schools/doctype/course_schedule/course_schedule_calendar.js new file mode 100644 index 0000000000..94ce720894 --- /dev/null +++ b/erpnext/schools/doctype/course_schedule/course_schedule_calendar.js @@ -0,0 +1,38 @@ +frappe.views.calendar["Course Schedule"] = { + field_map: { + // from_datetime and to_datetime don't exist as docfields but are used in onload + "start": "from_datetime", + "end": "to_datetime", + "id": "name", + "title": "course", + "allDay": "allDay" + }, + gantt: false, + filters: [ + { + "fieldtype": "Link", + "fieldname": "student_group", + "options": "Student Group", + "label": __("Student Group") + }, + { + "fieldtype": "Link", + "fieldname": "course", + "options": "Course", + "label": __("Course") + }, + { + "fieldtype": "Link", + "fieldname": "instructor", + "options": "Instructor", + "label": __("Instructor") + }, + { + "fieldtype": "Link", + "fieldname": "room", + "options": "Room", + "label": __("Room") + } + ], + get_events_method: "erpnext.schools.api.get_course_schedule_events" +} diff --git a/erpnext/schools/doctype/course_schedule/test_course_schedule.py b/erpnext/schools/doctype/course_schedule/test_course_schedule.py new file mode 100644 index 0000000000..f5e17f2235 --- /dev/null +++ b/erpnext/schools/doctype/course_schedule/test_course_schedule.py @@ -0,0 +1,69 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2015, Frappe Technologies and Contributors +# See license.txt +from __future__ import unicode_literals + +import frappe +import unittest + +import datetime +from frappe.utils import today, to_timedelta +from erpnext.schools.utils import OverlapError + +# test_records = frappe.get_test_records('Course Schedule') + +class TestCourseSchedule(unittest.TestCase): + def test_student_group_conflict(self): + cs1 = make_course_schedule_test_record(simulate= True) + + cs2 = make_course_schedule_test_record(schedule_date=cs1.schedule_date, from_time= cs1.from_time, + to_time= cs1.to_time, instructor="_T-Instructor-00002", room="RM0002", do_not_save= 1) + self.assertRaises(OverlapError, cs2.save) + + def test_instructor_conflict(self): + cs1 = make_course_schedule_test_record(simulate= True) + + cs2 = make_course_schedule_test_record(from_time= cs1.from_time, to_time= cs1.to_time, + student_group="_Test Student Group 1", room="RM0002", do_not_save= 1) + self.assertRaises(OverlapError, cs2.save) + + def test_room_conflict(self): + cs1 = make_course_schedule_test_record(simulate= True) + + cs2 = make_course_schedule_test_record(from_time= cs1.from_time, to_time= cs1.to_time, + student_group="_Test Student Group 1", instructor="_T-Instructor-00002", do_not_save= 1) + self.assertRaises(OverlapError, cs2.save) + + def test_no_conflict(self): + cs1 = make_course_schedule_test_record(simulate= True) + + make_course_schedule_test_record(from_time= cs1.from_time, to_time= cs1.to_time, + student_group="_Test Student Group 1", instructor="_T-Instructor-00002", room="RM0002") + +def make_course_schedule_test_record(**args): + args = frappe._dict(args) + + course_schedule = frappe.new_doc("Course Schedule") + course_schedule.student_group = args.student_group or "_Test Student Group" + course_schedule.course = args.course or "_Test Course" + course_schedule.instructor = args.instructor or "_T-Instructor-00001" + course_schedule.room = args.room or "RM0001" + + course_schedule.schedule_date = args.schedule_date or today() + course_schedule.from_time = args.from_time or to_timedelta("01:00:00") + course_schedule.to_time = args.to_time or course_schedule.from_time + datetime.timedelta(hours= 1) + + + if not args.do_not_save: + if args.simulate: + while True: + try: + course_schedule.save() + break + except OverlapError: + course_schedule.from_time = course_schedule.from_time + datetime.timedelta(minutes=10) + course_schedule.to_time = course_schedule.from_time + datetime.timedelta(hours= 1) + else: + course_schedule.save() + + return course_schedule diff --git a/erpnext/schools/doctype/discussion/__init__.py b/erpnext/schools/doctype/discussion/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/erpnext/schools/doctype/discussion/discussion.js b/erpnext/schools/doctype/discussion/discussion.js new file mode 100644 index 0000000000..df3c2b8a29 --- /dev/null +++ b/erpnext/schools/doctype/discussion/discussion.js @@ -0,0 +1,8 @@ +// Copyright (c) 2016, Frappe and contributors +// For license information, please see license.txt + +frappe.ui.form.on('Discussion', { + refresh: function(frm) { + + } +}); diff --git a/erpnext/schools/doctype/discussion/discussion.json b/erpnext/schools/doctype/discussion/discussion.json new file mode 100644 index 0000000000..ad58831459 --- /dev/null +++ b/erpnext/schools/doctype/discussion/discussion.json @@ -0,0 +1,160 @@ +{ + "allow_copy": 0, + "allow_import": 1, + "allow_rename": 0, + "autoname": "Discussion.####", + "beta": 0, + "creation": "2016-06-13 07:57:38.326925", + "custom": 0, + "docstatus": 0, + "doctype": "DocType", + "document_type": "Document", + "fields": [ + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "fieldname": "subject", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 0, + "label": "Subject", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 1, + "search_index": 1, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "fieldname": "course", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 1, + "label": "Course", + "length": 0, + "no_copy": 0, + "options": "Course", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 1, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "fieldname": "description", + "fieldtype": "Text", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 0, + "label": "Description", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "fieldname": "amended_from", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 0, + "label": "Amended From", + "length": 0, + "no_copy": 1, + "options": "Discussion", + "permlevel": 0, + "print_hide": 1, + "print_hide_if_no_value": 0, + "read_only": 1, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + } + ], + "hide_heading": 0, + "hide_toolbar": 0, + "idx": 0, + "image_view": 0, + "in_create": 0, + "in_dialog": 0, + "is_submittable": 1, + "issingle": 0, + "istable": 0, + "max_attachments": 0, + "modified": "2016-07-18 10:30:50.243271", + "modified_by": "Administrator", + "module": "Schools", + "name": "Discussion", + "name_case": "", + "owner": "Administrator", + "permissions": [ + { + "amend": 0, + "apply_user_permissions": 0, + "cancel": 0, + "create": 1, + "delete": 1, + "email": 1, + "export": 1, + "if_owner": 0, + "import": 0, + "permlevel": 0, + "print": 1, + "read": 1, + "report": 1, + "role": "Academics User", + "set_user_permissions": 0, + "share": 1, + "submit": 1, + "write": 1 + } + ], + "quick_entry": 0, + "read_only": 0, + "read_only_onload": 0, + "sort_field": "modified", + "sort_order": "DESC", + "title_field": "subject", + "track_seen": 1 +} \ No newline at end of file diff --git a/erpnext/schools/doctype/discussion/discussion.py b/erpnext/schools/doctype/discussion/discussion.py new file mode 100644 index 0000000000..96732e3b40 --- /dev/null +++ b/erpnext/schools/doctype/discussion/discussion.py @@ -0,0 +1,37 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2015, Frappe and contributors +# For license information, please see license.txt + +from __future__ import unicode_literals +import frappe +from frappe import _ +from frappe.model.document import Document + +class Discussion(Document): + def validate(self): + if not self.owner== frappe.session.user: + frappe.throw(_("Not Permitted")) + +def get_discussions(doctype, txt, filters, limit_start, limit_page_length=20): + from frappe.www.list import get_list + if not filters: + filters = [] + filters.append(("Discussion", "course", "=", frappe.form_dict.course)) + return get_list(doctype, txt, filters, limit_start, limit_page_length, ignore_permissions=True) + +def get_list_context(context=None): + course_name = frappe.form_dict.course + portal_items = [{'reference_doctype': u'Topic', 'route': u"/topic?course=" + str(course_name), 'show_always': 0L, 'title': u'Topics'}, + {'reference_doctype': u'Discussion', 'route': u"/discussion?course=" + str(course_name), 'show_always': 0L, 'title': u'Discussions'}, + + ] + sidebar_title = course_name + return { + "show_sidebar": True, + 'no_breadcrumbs': True, + "get_list" : get_discussions, + "title": _("Discussions"), + "sidebar_items" : portal_items, + "sidebar_title" : sidebar_title, + "row_template": "templates/includes/discussion/discussion_row.html" + } \ No newline at end of file diff --git a/erpnext/schools/doctype/discussion/test_discussion.py b/erpnext/schools/doctype/discussion/test_discussion.py new file mode 100644 index 0000000000..31799f06e1 --- /dev/null +++ b/erpnext/schools/doctype/discussion/test_discussion.py @@ -0,0 +1,12 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2015, Frappe and Contributors +# See license.txt +from __future__ import unicode_literals + +import frappe +import unittest + +# test_records = frappe.get_test_records('Discussion') + +class TestDiscussion(unittest.TestCase): + pass diff --git a/erpnext/schools/doctype/examination/__init__.py b/erpnext/schools/doctype/examination/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/erpnext/schools/doctype/examination/examination.js b/erpnext/schools/doctype/examination/examination.js new file mode 100644 index 0000000000..b1091f3080 --- /dev/null +++ b/erpnext/schools/doctype/examination/examination.js @@ -0,0 +1,28 @@ +cur_frm.add_fetch("student_group", "course", "course"); +cur_frm.add_fetch("examiner", "instructor_name", "examiner_name"); +cur_frm.add_fetch("supervisor", "instructor_name", "supervisor_name"); +cur_frm.add_fetch("student", "title", "student_name"); + +frappe.ui.form.on("Examination" ,{ + student_group : function(frm) { + frm.set_value("results" ,""); + if (frm.doc.student_group) { + frappe.call({ + method: "erpnext.schools.api.get_student_group_students", + args: { + "student_group": frm.doc.student_group + }, + callback: function(r) { + if (r.message) { + $.each(r.message, function(i, d) { + var row = frappe.model.add_child(cur_frm.doc, "Examination Result", "results"); + row.student = d.student; + row.student_name = d.student_name; + }); + } + refresh_field("results"); + } + }); + } + } +}); \ No newline at end of file diff --git a/erpnext/schools/doctype/examination/examination.json b/erpnext/schools/doctype/examination/examination.json new file mode 100644 index 0000000000..f882289772 --- /dev/null +++ b/erpnext/schools/doctype/examination/examination.json @@ -0,0 +1,497 @@ +{ + "allow_copy": 0, + "allow_import": 0, + "allow_rename": 0, + "autoname": "field:exam_name", + "creation": "2015-11-12 16:34:34.658092", + "custom": 0, + "docstatus": 0, + "doctype": "DocType", + "document_type": "Setup", + "fields": [ + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "fieldname": "exam_name", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, + "label": "Exam Name", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 1, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "fieldname": "exam_code", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, + "label": "Exam Code", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 1, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "fieldname": "student_group", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 1, + "label": "Student Group", + "length": 0, + "no_copy": 0, + "options": "Student Group", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 1, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "fieldname": "course", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, + "label": "Course", + "length": 0, + "no_copy": 0, + "options": "Course", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "read_only": 1, + "report_hide": 0, + "reqd": 1, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "fieldname": "column_break_2", + "fieldtype": "Column Break", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "fieldname": "supervisor", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, + "label": "Supervisor", + "length": 0, + "no_copy": 0, + "options": "Instructor", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "fieldname": "supervisor_name", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, + "label": "Supervisor Name", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "read_only": 1, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "fieldname": "examiner", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, + "label": "Examiner", + "length": 0, + "no_copy": 0, + "options": "Instructor", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "fieldname": "examiner_name", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, + "label": "Examiner Name", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "read_only": 1, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 1, + "collapsible_depends_on": "", + "depends_on": "", + "fieldname": "section_break_5", + "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, + "label": "Schedule", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "default": "Today", + "fieldname": "schedule_date", + "fieldtype": "Date", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 1, + "label": "Schedule Date", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 1, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "fieldname": "room", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, + "label": "Room", + "length": 0, + "no_copy": 0, + "options": "Room", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "fieldname": "column_break_4", + "fieldtype": "Column Break", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "fieldname": "from_time", + "fieldtype": "Time", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, + "label": "From Time", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 1, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "fieldname": "to_time", + "fieldtype": "Time", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, + "label": "To Time", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 1, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 1, + "fieldname": "section_break_11", + "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, + "label": "Results", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "fieldname": "results", + "fieldtype": "Table", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, + "label": "results", + "length": 0, + "no_copy": 0, + "options": "Examination Result", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "fieldname": "amended_from", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, + "label": "Amended From", + "length": 0, + "no_copy": 1, + "options": "Examination", + "permlevel": 0, + "print_hide": 1, + "read_only": 1, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + } + ], + "hide_heading": 0, + "hide_toolbar": 0, + "idx": 0, + "in_create": 0, + "in_dialog": 0, + "is_submittable": 1, + "issingle": 0, + "istable": 0, + "max_attachments": 0, + "menu_index": 0, + "modified": "2016-07-18 10:30:50.243271", + "modified_by": "Administrator", + "module": "Schools", + "name": "Examination", + "name_case": "", + "owner": "Administrator", + "permissions": [ + { + "amend": 1, + "apply_user_permissions": 0, + "cancel": 1, + "create": 1, + "delete": 1, + "email": 1, + "export": 1, + "if_owner": 0, + "import": 0, + "permlevel": 0, + "print": 1, + "read": 1, + "report": 1, + "role": "Administrator", + "set_user_permissions": 0, + "share": 1, + "submit": 1, + "write": 1 + }, + { + "amend": 1, + "apply_user_permissions": 0, + "cancel": 1, + "create": 1, + "delete": 1, + "email": 1, + "export": 1, + "if_owner": 0, + "import": 0, + "permlevel": 0, + "print": 1, + "read": 1, + "report": 1, + "role": "Academics User", + "set_user_permissions": 0, + "share": 1, + "submit": 1, + "write": 1 + } + ], + "read_only": 0, + "read_only_onload": 0, + "sort_field": "modified", + "sort_order": "DESC", + "version": 0 +} \ No newline at end of file diff --git a/erpnext/schools/doctype/examination/examination.py b/erpnext/schools/doctype/examination/examination.py new file mode 100644 index 0000000000..c1a3d1ac12 --- /dev/null +++ b/erpnext/schools/doctype/examination/examination.py @@ -0,0 +1,46 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2015, Frappe Technologies and contributors +# For license information, please see license.txt + +from __future__ import unicode_literals +from frappe.model.document import Document +import frappe +from frappe import _ + +class Examination(Document): + def validate(self): + self.validate_overlap() + + def validate_overlap(self): + """Validates overlap for Student Group, Supervisor, Room""" + + from erpnext.schools.utils import validate_overlap_for + + validate_overlap_for(self, "Examination", "student_group") + validate_overlap_for(self, "Course Schedule", "student_group" ) + + if self.room: + validate_overlap_for(self, "Examination", "room") + validate_overlap_for(self, "Course Schedule", "room") + + if self.supervisor: + validate_overlap_for(self, "Examination", "supervisor") + validate_overlap_for(self, "Course Schedule", "instructor", self.supervisor) + +def get_examination_list(doctype, txt, filters, limit_start, limit_page_length=20): + user = frappe.session.user + student = frappe.db.sql("select name from `tabStudent` where student_email_id= %s", user) + if student: + return frappe. db.sql('''select course, schedule_date, from_time, to_time, sgs.name from `tabExamination` as exam, + `tabStudent Group Student` as sgs where exam.student_group = sgs.parent and sgs.student = %s and exam.docstatus=1 + order by exam.name asc limit {0} , {1}''' + .format(limit_start, limit_page_length), student, as_dict = True) + +def get_list_context(context=None): + return { + "show_sidebar": True, + 'no_breadcrumbs': True, + "title": _("Examination Schedule"), + "get_list": get_examination_list, + "row_template": "templates/includes/examination/examination_row.html" + } diff --git a/erpnext/schools/doctype/examination/test_examination.py b/erpnext/schools/doctype/examination/test_examination.py new file mode 100644 index 0000000000..be276f941c --- /dev/null +++ b/erpnext/schools/doctype/examination/test_examination.py @@ -0,0 +1,12 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2015, Frappe Technologies and Contributors +# See license.txt +from __future__ import unicode_literals + +import frappe +import unittest + +# test_records = frappe.get_test_records('Examination') + +class TestExamination(unittest.TestCase): + pass diff --git a/erpnext/schools/doctype/examination_result/__init__.py b/erpnext/schools/doctype/examination_result/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/erpnext/schools/doctype/examination_result/examination_result.json b/erpnext/schools/doctype/examination_result/examination_result.json new file mode 100644 index 0000000000..4758c297e4 --- /dev/null +++ b/erpnext/schools/doctype/examination_result/examination_result.json @@ -0,0 +1,118 @@ +{ + "allow_copy": 0, + "allow_import": 0, + "allow_rename": 0, + "creation": "2015-11-13 17:18:06.468332", + "custom": 0, + "docstatus": 0, + "doctype": "DocType", + "document_type": "", + "fields": [ + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "fieldname": "student", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 1, + "label": "Student", + "no_copy": 0, + "options": "Student", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 1, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "fieldname": "student_name", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 1, + "label": "Student Name", + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "read_only": 1, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "fieldname": "column_break_3", + "fieldtype": "Column Break", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "fieldname": "result", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 1, + "label": "Result", + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + } + ], + "hide_heading": 0, + "hide_toolbar": 0, + "in_create": 0, + "in_dialog": 0, + "is_submittable": 0, + "issingle": 0, + "istable": 1, + "modified": "2016-07-18 10:30:50.243271", + "modified_by": "Administrator", + "module": "Schools", + "name": "Examination Result", + "name_case": "", + "owner": "Administrator", + "permissions": [], + "read_only": 0, + "read_only_onload": 0, + "sort_field": "modified", + "sort_order": "DESC" +} \ No newline at end of file diff --git a/erpnext/schools/doctype/examination_result/examination_result.py b/erpnext/schools/doctype/examination_result/examination_result.py new file mode 100644 index 0000000000..0d7a435f36 --- /dev/null +++ b/erpnext/schools/doctype/examination_result/examination_result.py @@ -0,0 +1,10 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2015, Frappe Technologies and contributors +# For license information, please see license.txt + +from __future__ import unicode_literals +import frappe +from frappe.model.document import Document + +class ExaminationResult(Document): + pass diff --git a/erpnext/schools/doctype/fee_amount/__init__.py b/erpnext/schools/doctype/fee_amount/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/erpnext/schools/doctype/fee_amount/fee_amount.json b/erpnext/schools/doctype/fee_amount/fee_amount.json new file mode 100644 index 0000000000..d7156cba80 --- /dev/null +++ b/erpnext/schools/doctype/fee_amount/fee_amount.json @@ -0,0 +1,120 @@ +{ + "allow_copy": 0, + "allow_import": 0, + "allow_rename": 1, + "autoname": "", + "beta": 0, + "creation": "2015-09-16 13:07:27.675453", + "custom": 0, + "docstatus": 0, + "doctype": "DocType", + "document_type": "Setup", + "editable_grid": 0, + "fields": [ + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "fieldname": "fees_category", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 1, + "label": "Fees Category", + "length": 0, + "no_copy": 0, + "oldfieldname": "earning_name", + "oldfieldtype": "Data", + "options": "Fee Category", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 1, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 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, + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "fieldname": "amount", + "fieldtype": "Currency", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 1, + "label": "Amount", + "length": 0, + "no_copy": 0, + "oldfieldname": "description", + "oldfieldtype": "Small Text", + "options": "", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 1, + "search_index": 0, + "set_only_once": 0, + "unique": 0, + "width": "300px" + } + ], + "hide_heading": 0, + "hide_toolbar": 0, + "icon": "icon-flag", + "idx": 0, + "image_view": 0, + "in_create": 0, + "in_dialog": 0, + "is_submittable": 0, + "issingle": 0, + "istable": 1, + "max_attachments": 0, + "modified": "2016-07-18 10:30:50.243271", + "modified_by": "Administrator", + "module": "Schools", + "name": "Fee Amount", + "name_case": "", + "owner": "Administrator", + "permissions": [], + "quick_entry": 0, + "read_only": 0, + "read_only_onload": 0, + "sort_field": "modified", + "sort_order": "DESC", + "track_seen": 0 +} \ No newline at end of file diff --git a/erpnext/schools/doctype/fee_amount/fee_amount.py b/erpnext/schools/doctype/fee_amount/fee_amount.py new file mode 100644 index 0000000000..a26e1d9303 --- /dev/null +++ b/erpnext/schools/doctype/fee_amount/fee_amount.py @@ -0,0 +1,10 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2015, Frappe Technologies and contributors +# For license information, please see license.txt + +from __future__ import unicode_literals +import frappe +from frappe.model.document import Document + +class FeeAmount(Document): + pass diff --git a/erpnext/schools/doctype/fee_category/__init__.py b/erpnext/schools/doctype/fee_category/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/erpnext/schools/doctype/fee_category/fee_category.json b/erpnext/schools/doctype/fee_category/fee_category.json new file mode 100644 index 0000000000..33b0dab99d --- /dev/null +++ b/erpnext/schools/doctype/fee_category/fee_category.json @@ -0,0 +1,129 @@ +{ + "allow_copy": 0, + "allow_import": 1, + "allow_rename": 1, + "autoname": "field:category_name", + "creation": "2015-09-16 13:01:10.448734", + "custom": 0, + "docstatus": 0, + "doctype": "DocType", + "document_type": "Setup", + "fields": [ + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "fieldname": "category_name", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 1, + "label": "Name", + "length": 0, + "no_copy": 0, + "oldfieldname": "earning_name", + "oldfieldtype": "Data", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 1, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "fieldname": "description", + "fieldtype": "Small Text", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 1, + "label": "Description", + "length": 0, + "no_copy": 0, + "oldfieldname": "description", + "oldfieldtype": "Small Text", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0, + "width": "300px" + } + ], + "hide_heading": 0, + "hide_toolbar": 0, + "icon": "icon-flag", + "idx": 0, + "in_create": 0, + "in_dialog": 0, + "is_submittable": 0, + "issingle": 0, + "istable": 0, + "max_attachments": 0, + "menu_index": 0, + "modified": "2016-07-18 10:30:50.243271", + "modified_by": "Administrator", + "module": "Schools", + "name": "Fee Category", + "name_case": "", + "owner": "Administrator", + "permissions": [ + { + "amend": 0, + "apply_user_permissions": 0, + "cancel": 0, + "create": 1, + "delete": 1, + "email": 1, + "export": 0, + "if_owner": 0, + "import": 0, + "permlevel": 0, + "print": 1, + "read": 1, + "report": 1, + "role": "Administrator", + "set_user_permissions": 0, + "share": 1, + "submit": 0, + "write": 1 + }, + { + "amend": 0, + "apply_user_permissions": 0, + "cancel": 0, + "create": 1, + "delete": 1, + "email": 1, + "export": 1, + "if_owner": 0, + "import": 0, + "permlevel": 0, + "print": 1, + "read": 1, + "report": 1, + "role": "Academics User", + "set_user_permissions": 0, + "share": 1, + "submit": 0, + "write": 1 + } + ], + "read_only": 0, + "read_only_onload": 0, + "search_fields": "description", + "sort_field": "modified", + "sort_order": "DESC", + "version": 0 +} \ No newline at end of file diff --git a/erpnext/schools/doctype/fee_category/fee_category.py b/erpnext/schools/doctype/fee_category/fee_category.py new file mode 100644 index 0000000000..55234442ba --- /dev/null +++ b/erpnext/schools/doctype/fee_category/fee_category.py @@ -0,0 +1,10 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2015, Frappe Technologies and contributors +# For license information, please see license.txt + +from __future__ import unicode_literals +import frappe +from frappe.model.document import Document + +class FeeCategory(Document): + pass diff --git a/erpnext/schools/doctype/fee_category/test_fee_category.py b/erpnext/schools/doctype/fee_category/test_fee_category.py new file mode 100644 index 0000000000..48e7589a0c --- /dev/null +++ b/erpnext/schools/doctype/fee_category/test_fee_category.py @@ -0,0 +1,12 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2015, Frappe Technologies and Contributors +# See license.txt +from __future__ import unicode_literals + +import frappe +import unittest + +# test_records = frappe.get_test_records('Fee Category') + +class TestFeeCategory(unittest.TestCase): + pass diff --git a/erpnext/schools/doctype/fee_structure/__init__.py b/erpnext/schools/doctype/fee_structure/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/erpnext/schools/doctype/fee_structure/fee_structure.js b/erpnext/schools/doctype/fee_structure/fee_structure.js new file mode 100644 index 0000000000..e3d4544870 --- /dev/null +++ b/erpnext/schools/doctype/fee_structure/fee_structure.js @@ -0,0 +1,9 @@ +frappe.ui.form.on("Fee Amount", { + amount: function(frm) { + total_amount = 0; + for(var i=0;i frm.doc.paid_amount)) { + frm.add_custom_button(__("Collect Fees"), function() { + frappe.prompt({fieldtype:"Float", label: __("Amount Paid"), fieldname:"amt"}, + function(data) { + frappe.call({ + method:"erpnext.schools.api.collect_fees", + args: { + "fees": frm.doc.name, + "amt": data.amt + }, + callback: function(r) { + frm.doc.paid_amount = r.message + frm.doc.outstanding_amount = frm.doc.total_amount - r.message + frm.refresh() + } + }); + }, __("Enter Paid Amount"), __("Collect")); + }); + } + }, + + program: function(frm) { + if (frm.doc.program && frm.doc.academic_term) { + frappe.call({ + method: "erpnext.schools.api.get_fee_structure", + args: { + "program": frm.doc.program, + "academic_term": frm.doc.academic_term + }, + callback: function(r) { + if(r.message) { + frm.set_value("fee_structure" ,r.message); + } + } + }); + } + }, + + academic_term: function() { + frappe.ui.form.trigger("Fees", "program"); + }, + + fee_structure: function(frm) { + frm.set_value("amount" ,""); + if (frm.doc.fee_structure) { + frappe.call({ + method: "erpnext.schools.api.get_fee_amount", + args: { + "fee_structure": frm.doc.fee_structure + }, + callback: function(r) { + if (r.message) { + $.each(r.message, function(i, d) { + var row = frappe.model.add_child(frm.doc, "Fee Amount", "amount"); + row.fees_category = d.fees_category; + row.amount = d.amount; + }); + } + refresh_field("amount"); + } + }); + } + } +}); + +frappe.ui.form.on("Fee Amount", { + amount: function(frm) { + total_amount = 0; + for(var i=0;i doc.paid_amount) && doc.due_date < get_today()) { + return [__("Overdue"), "red", ["due_date,<,"+get_today()], ["due_date,<,"+get_today()]]; + } + else if (doc.total_amount > doc.paid_amount) { + return [__("Pending"), "orange"]; + } + else { + return [__("Paid"), "green"]; + } + } +}; \ No newline at end of file diff --git a/erpnext/schools/doctype/fees/test_fees.py b/erpnext/schools/doctype/fees/test_fees.py new file mode 100644 index 0000000000..3ea83ee039 --- /dev/null +++ b/erpnext/schools/doctype/fees/test_fees.py @@ -0,0 +1,12 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2015, Frappe Technologies and Contributors +# See license.txt +from __future__ import unicode_literals + +import frappe +import unittest + +# test_records = frappe.get_test_records('Fees') + +class TestFees(unittest.TestCase): + pass diff --git a/erpnext/schools/doctype/instructor/__init__.py b/erpnext/schools/doctype/instructor/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/erpnext/schools/doctype/instructor/instructor.js b/erpnext/schools/doctype/instructor/instructor.js new file mode 100644 index 0000000000..51d28860b0 --- /dev/null +++ b/erpnext/schools/doctype/instructor/instructor.js @@ -0,0 +1,13 @@ +cur_frm.add_fetch("employee", "department", "department"); +cur_frm.add_fetch("employee", "image", "image"); + +frappe.ui.form.on("Instructor", "refresh", function(frm) { + if(!frm.doc.__islocal) { + frm.add_custom_button(__("Course Schedule"), function() { + frappe.route_options = { + instructor: frm.doc.name + } + frappe.set_route("List", "Course Schedule"); + }); + } +}); diff --git a/erpnext/schools/doctype/instructor/instructor.json b/erpnext/schools/doctype/instructor/instructor.json new file mode 100644 index 0000000000..922e1757bf --- /dev/null +++ b/erpnext/schools/doctype/instructor/instructor.json @@ -0,0 +1,232 @@ +{ + "allow_copy": 0, + "allow_import": 0, + "allow_rename": 0, + "autoname": "naming_series:", + "beta": 0, + "creation": "2015-11-04 15:56:30.004034", + "custom": 0, + "docstatus": 0, + "doctype": "DocType", + "document_type": "Other", + "fields": [ + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "fieldname": "instructor_name", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 0, + "label": "Instructor Name", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 1, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "fieldname": "employee", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 1, + "label": "Employee", + "length": 0, + "no_copy": 0, + "options": "Employee", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "fieldname": "column_break_5", + "fieldtype": "Column Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 0, + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "fieldname": "naming_series", + "fieldtype": "Select", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 0, + "label": "Naming Series", + "length": 0, + "no_copy": 0, + "options": "INS/", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "fieldname": "department", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 1, + "label": "Department", + "length": 0, + "no_copy": 0, + "options": "Department", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "fieldname": "image", + "fieldtype": "Attach Image", + "hidden": 1, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 0, + "label": "Image", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + } + ], + "hide_heading": 0, + "hide_toolbar": 0, + "idx": 0, + "image_field": "image", + "in_create": 0, + "in_dialog": 0, + "is_submittable": 0, + "issingle": 0, + "istable": 0, + "max_attachments": 0, + "menu_index": 0, + "modified": "2016-07-18 10:30:50.243271", + "modified_by": "demo@erpnext.com", + "module": "Schools", + "name": "Instructor", + "name_case": "", + "owner": "Administrator", + "permissions": [ + { + "amend": 0, + "apply_user_permissions": 0, + "cancel": 0, + "create": 1, + "delete": 1, + "email": 1, + "export": 1, + "if_owner": 0, + "import": 0, + "permlevel": 0, + "print": 1, + "read": 1, + "report": 1, + "role": "Academics User", + "set_user_permissions": 0, + "share": 1, + "submit": 0, + "write": 1 + }, + { + "amend": 0, + "apply_user_permissions": 0, + "cancel": 0, + "create": 1, + "delete": 1, + "email": 1, + "export": 1, + "if_owner": 0, + "import": 0, + "permlevel": 0, + "print": 1, + "read": 1, + "report": 1, + "role": "Administrator", + "set_user_permissions": 0, + "share": 1, + "submit": 0, + "write": 1 + } + ], + "quick_entry": 0, + "read_only": 0, + "read_only_onload": 0, + "sort_field": "modified", + "sort_order": "DESC", + "title_field": "instructor_name", + "track_seen": 0 +} \ No newline at end of file diff --git a/erpnext/schools/doctype/instructor/instructor.py b/erpnext/schools/doctype/instructor/instructor.py new file mode 100644 index 0000000000..4331b91610 --- /dev/null +++ b/erpnext/schools/doctype/instructor/instructor.py @@ -0,0 +1,10 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2015, Frappe Technologies and contributors +# For license information, please see license.txt + +from __future__ import unicode_literals +import frappe +from frappe.model.document import Document + +class Instructor(Document): + pass diff --git a/erpnext/schools/doctype/instructor/test_instructor.py b/erpnext/schools/doctype/instructor/test_instructor.py new file mode 100644 index 0000000000..4061422a74 --- /dev/null +++ b/erpnext/schools/doctype/instructor/test_instructor.py @@ -0,0 +1,12 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2015, Frappe Technologies and Contributors +# See license.txt +from __future__ import unicode_literals + +import frappe +import unittest + +# test_records = frappe.get_test_records('Instructor') + +class TestInstructor(unittest.TestCase): + pass diff --git a/erpnext/schools/doctype/instructor/test_records.json b/erpnext/schools/doctype/instructor/test_records.json new file mode 100644 index 0000000000..3747c0d21b --- /dev/null +++ b/erpnext/schools/doctype/instructor/test_records.json @@ -0,0 +1,12 @@ +[ + { + "naming_series": "_T-Instructor-", + "employee": "_T-Employee-0001", + "instructor_name": "_Test Instructor" + }, + { + "naming_series": "_T-Instructor-", + "employee": "_T-Employee-0002", + "instructor_name": "_Test Instructor 2" + } +] diff --git a/erpnext/schools/doctype/program/__init__.py b/erpnext/schools/doctype/program/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/erpnext/schools/doctype/program/program.js b/erpnext/schools/doctype/program/program.js new file mode 100644 index 0000000000..7b9f92042e --- /dev/null +++ b/erpnext/schools/doctype/program/program.js @@ -0,0 +1,44 @@ +// Copyright (c) 2015, Frappe Technologies and contributors +// For license information, please see license.txt + +cur_frm.add_fetch("course", "course_code", "course_code"); +cur_frm.add_fetch('fee_structure', 'total_amount', 'amount'); + +frappe.ui.form.on("Program", "refresh", function(frm) { + if(!frm.doc.__islocal) { + frm.add_custom_button(__("Student Applicant"), function() { + frappe.route_options = { + program: frm.doc.name + } + frappe.set_route("List", "Student Applicant"); + }); + + frm.add_custom_button(__("Program Enrollment"), function() { + frappe.route_options = { + program: frm.doc.name + } + frappe.set_route("List", "Program Enrollment"); + }); + + frm.add_custom_button(__("Student Group"), function() { + frappe.route_options = { + program: frm.doc.name + } + frappe.set_route("List", "Student Group"); + }); + + frm.add_custom_button(__("Fee Structure"), function() { + frappe.route_options = { + program: frm.doc.name + } + frappe.set_route("List", "Fee Structure"); + }); + + frm.add_custom_button(__("Fees"), function() { + frappe.route_options = { + program: frm.doc.name + } + frappe.set_route("List", "Fees"); + }); + } +}); \ No newline at end of file diff --git a/erpnext/schools/doctype/program/program.json b/erpnext/schools/doctype/program/program.json new file mode 100644 index 0000000000..8041f61e7a --- /dev/null +++ b/erpnext/schools/doctype/program/program.json @@ -0,0 +1,281 @@ +{ + "allow_copy": 0, + "allow_import": 1, + "allow_rename": 0, + "autoname": "field:program_name", + "beta": 0, + "creation": "2015-09-07 12:54:03.609282", + "custom": 0, + "docstatus": 0, + "doctype": "DocType", + "document_type": "", + "fields": [ + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "fieldname": "program_name", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 0, + "label": "Program Name", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 1, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "fieldname": "program_code", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 1, + "label": "Program Code", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "fieldname": "column_break_3", + "fieldtype": "Column Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 0, + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "fieldname": "department", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 1, + "label": "Department", + "length": 0, + "no_copy": 0, + "options": "Department", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "fieldname": "section_break_5", + "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 0, + "label": "Course", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "fieldname": "courses", + "fieldtype": "Table", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 0, + "label": "Courses", + "length": 0, + "no_copy": 0, + "options": "Program Course", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "fieldname": "fee_schedule", + "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 0, + "label": "Fee Schedule", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "fieldname": "fees", + "fieldtype": "Table", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 0, + "label": "Fees", + "length": 0, + "no_copy": 0, + "options": "Program Fee", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + } + ], + "hide_heading": 0, + "hide_toolbar": 0, + "idx": 0, + "in_create": 0, + "in_dialog": 0, + "is_submittable": 0, + "issingle": 0, + "istable": 0, + "max_attachments": 0, + "menu_index": 0, + "modified": "2016-07-18 10:30:50.243271", + "modified_by": "Administrator", + "module": "Schools", + "name": "Program", + "name_case": "", + "owner": "Administrator", + "permissions": [ + { + "amend": 0, + "apply_user_permissions": 0, + "cancel": 0, + "create": 1, + "delete": 1, + "email": 1, + "export": 1, + "if_owner": 0, + "import": 0, + "permlevel": 0, + "print": 1, + "read": 1, + "report": 1, + "role": "Administrator", + "set_user_permissions": 0, + "share": 1, + "submit": 0, + "write": 1 + }, + { + "amend": 0, + "apply_user_permissions": 0, + "cancel": 0, + "create": 1, + "delete": 1, + "email": 1, + "export": 1, + "if_owner": 0, + "import": 0, + "permlevel": 0, + "print": 1, + "read": 1, + "report": 1, + "role": "Academics User", + "set_user_permissions": 0, + "share": 1, + "submit": 0, + "write": 1 + } + ], + "quick_entry": 0, + "read_only": 0, + "read_only_onload": 0, + "search_fields": "department", + "sort_field": "modified", + "sort_order": "DESC", + "track_seen": 0 +} \ No newline at end of file diff --git a/erpnext/schools/doctype/program/program.py b/erpnext/schools/doctype/program/program.py new file mode 100644 index 0000000000..0ece961cba --- /dev/null +++ b/erpnext/schools/doctype/program/program.py @@ -0,0 +1,16 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2015, Frappe Technologies and contributors +# For license information, please see license.txt + +from __future__ import unicode_literals +import frappe +from frappe.model.document import Document + +class Program(Document): + def validate(self): + self.validate_course() + + def validate_course(self): + for d in self.courses: + if not d.course_code: + d.course_code = frappe.db.get_value("Course", d.course, "course_code") diff --git a/erpnext/schools/doctype/program/test_program.py b/erpnext/schools/doctype/program/test_program.py new file mode 100644 index 0000000000..a4accdaaf7 --- /dev/null +++ b/erpnext/schools/doctype/program/test_program.py @@ -0,0 +1,12 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2015, Frappe Technologies and Contributors +# See license.txt +from __future__ import unicode_literals + +import frappe +import unittest + +# test_records = frappe.get_test_records('Program') + +class TestProgram(unittest.TestCase): + pass diff --git a/erpnext/schools/doctype/program/test_records.json b/erpnext/schools/doctype/program/test_records.json new file mode 100644 index 0000000000..c0f8231126 --- /dev/null +++ b/erpnext/schools/doctype/program/test_records.json @@ -0,0 +1,8 @@ +[ + { + "program_name": "_Test Program" + }, + { + "program_name": "_Test Program 2" + } +] diff --git a/erpnext/schools/doctype/program_course/__init__.py b/erpnext/schools/doctype/program_course/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/erpnext/schools/doctype/program_course/program_course.json b/erpnext/schools/doctype/program_course/program_course.json new file mode 100644 index 0000000000..81aad68d0d --- /dev/null +++ b/erpnext/schools/doctype/program_course/program_course.json @@ -0,0 +1,150 @@ +{ + "allow_copy": 0, + "allow_import": 0, + "allow_rename": 0, + "creation": "2015-09-07 14:37:01.886859", + "custom": 0, + "docstatus": 0, + "doctype": "DocType", + "document_type": "", + "fields": [ + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "fieldname": "course", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 1, + "label": "Course", + "length": 0, + "no_copy": 0, + "options": "Course", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 1, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "fieldname": "academic_term", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 1, + "label": "Academic Term", + "length": 0, + "no_copy": 0, + "options": "Academic Term", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "fieldname": "column_break_3", + "fieldtype": "Column Break", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "fieldname": "course_code", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 1, + "label": "Course Code", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "read_only": 1, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "fieldname": "required", + "fieldtype": "Check", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, + "label": "Required", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + } + ], + "hide_heading": 0, + "hide_toolbar": 0, + "idx": 0, + "in_create": 0, + "in_dialog": 0, + "is_submittable": 0, + "issingle": 0, + "istable": 1, + "max_attachments": 0, + "menu_index": 0, + "modified": "2016-07-18 10:30:50.243271", + "modified_by": "Administrator", + "module": "Schools", + "name": "Program Course", + "name_case": "", + "owner": "Administrator", + "permissions": [], + "read_only": 0, + "read_only_onload": 0, + "sort_field": "modified", + "sort_order": "DESC", + "version": 0 +} \ No newline at end of file diff --git a/erpnext/schools/doctype/program_course/program_course.py b/erpnext/schools/doctype/program_course/program_course.py new file mode 100644 index 0000000000..684b6fade7 --- /dev/null +++ b/erpnext/schools/doctype/program_course/program_course.py @@ -0,0 +1,10 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2015, Frappe and contributors +# For license information, please see license.txt + +from __future__ import unicode_literals +import frappe +from frappe.model.document import Document + +class ProgramCourse(Document): + pass diff --git a/erpnext/schools/doctype/program_enrollment/__init__.py b/erpnext/schools/doctype/program_enrollment/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/erpnext/schools/doctype/program_enrollment/program_enrollment.js b/erpnext/schools/doctype/program_enrollment/program_enrollment.js new file mode 100644 index 0000000000..038afd9886 --- /dev/null +++ b/erpnext/schools/doctype/program_enrollment/program_enrollment.js @@ -0,0 +1,22 @@ +// Copyright (c) 2016, Frappe and contributors +// For license information, please see license.txt + +cur_frm.add_fetch('fee_structure', 'total_amount', 'amount'); + +frappe.ui.form.on("Program Enrollment", { + program: function(frm) { + if (frm.doc.program) { + frappe.call({ + method: "erpnext.schools.api.get_fee_schedule", + args: { + "program": frm.doc.program + }, + callback: function(r) { + if(r.message) { + frm.set_value("fees" ,r.message); + } + } + }); + } + } +}); diff --git a/erpnext/schools/doctype/program_enrollment/program_enrollment.json b/erpnext/schools/doctype/program_enrollment/program_enrollment.json new file mode 100644 index 0000000000..6977a24e85 --- /dev/null +++ b/erpnext/schools/doctype/program_enrollment/program_enrollment.json @@ -0,0 +1,289 @@ +{ + "allow_copy": 0, + "allow_import": 0, + "allow_rename": 0, + "autoname": "PE.#####", + "beta": 0, + "creation": "2015-12-02 12:58:32.916080", + "custom": 0, + "docstatus": 0, + "doctype": "DocType", + "document_type": "Document", + "fields": [ + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "fieldname": "student", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 0, + "label": "Student", + "length": 0, + "no_copy": 0, + "options": "Student", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 1, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "fieldname": "student_name", + "fieldtype": "Read Only", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 0, + "label": "Student Name", + "length": 0, + "no_copy": 0, + "options": "student.title", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 1, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "fieldname": "column_break_4", + "fieldtype": "Column Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 0, + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "fieldname": "program", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 1, + "label": "Program", + "length": 0, + "no_copy": 0, + "options": "Program", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 1, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "fieldname": "academic_year", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 1, + "label": "Academic Year", + "length": 0, + "no_copy": 0, + "options": "Academic Year", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 1, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "default": "Today", + "fieldname": "enrollment_date", + "fieldtype": "Date", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 0, + "label": "Enrollment Date", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 1, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "fieldname": "section_break_7", + "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 0, + "label": "", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "fieldname": "fees", + "fieldtype": "Table", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 0, + "label": "Fees", + "length": 0, + "no_copy": 0, + "options": "Program Fee", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "fieldname": "amended_from", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 0, + "label": "Amended From", + "length": 0, + "no_copy": 1, + "options": "Program Enrollment", + "permlevel": 0, + "print_hide": 1, + "print_hide_if_no_value": 0, + "read_only": 1, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + } + ], + "hide_heading": 0, + "hide_toolbar": 0, + "idx": 0, + "in_create": 0, + "in_dialog": 0, + "is_submittable": 1, + "issingle": 0, + "istable": 0, + "max_attachments": 0, + "menu_index": 0, + "modified": "2016-07-18 10:30:50.243271", + "modified_by": "Administrator", + "module": "Schools", + "name": "Program Enrollment", + "name_case": "", + "owner": "Administrator", + "permissions": [ + { + "amend": 1, + "apply_user_permissions": 0, + "cancel": 1, + "create": 1, + "delete": 1, + "email": 1, + "export": 1, + "if_owner": 0, + "import": 0, + "permlevel": 0, + "print": 1, + "read": 1, + "report": 1, + "role": "Academics User", + "set_user_permissions": 0, + "share": 1, + "submit": 1, + "write": 1 + } + ], + "quick_entry": 0, + "read_only": 0, + "read_only_onload": 0, + "sort_field": "modified", + "sort_order": "DESC", + "title_field": "student_name", + "track_seen": 0 +} \ No newline at end of file diff --git a/erpnext/schools/doctype/program_enrollment/program_enrollment.py b/erpnext/schools/doctype/program_enrollment/program_enrollment.py new file mode 100644 index 0000000000..ca193dd9af --- /dev/null +++ b/erpnext/schools/doctype/program_enrollment/program_enrollment.py @@ -0,0 +1,54 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2015, Frappe and contributors +# For license information, please see license.txt + +from __future__ import unicode_literals +import frappe +from frappe import msgprint, _ +from frappe.model.document import Document +from frappe.utils import comma_and + +class ProgramEnrollment(Document): + def validate(self): + self.validate_duplication() + + def on_submit(self): + self.update_student_joining_date() + self.make_fee_records() + + def validate_duplication(self): + enrollment = frappe.db.sql("""select name from `tabProgram Enrollment` where student= %s and program= %s + and academic_year= %s and docstatus<2 and name != %s""", (self.student, self.program, self.academic_year, self.name)) + if enrollment: + frappe.throw(_("Student is already enrolled.")) + + def update_student_joining_date(self): + date = frappe.db.sql("select min(enrollment_date) from `tabProgram Enrollment` where student= %s", self.student) + frappe.db.set_value("Student", self.student, "joining_date", date) + + def make_fee_records(self): + from erpnext.schools.api import get_fee_amount + fee_list = [] + for d in self.fees: + fee_amount = get_fee_amount(d.fee_structure) + if fee_amount: + fees = frappe.new_doc("Fees") + fees.update({ + "student": self.student, + "academic_year": self.academic_year, + "academic_term": d.academic_term, + "fee_structure": d.fee_structure, + "program": self.program, + "due_date": d.due_date, + "student_name": self.student_name, + "program_enrollment": self.name, + "amount": fee_amount + }) + + fees.save() + fees.submit() + fee_list.append(fees.name) + if fee_list: + fee_list = ["""%s""" % \ + (fee, fee) for fee in fee_list] + msgprint(_("Fee Records Created - {0}").format(comma_and(fee_list))) \ No newline at end of file diff --git a/erpnext/schools/doctype/program_enrollment/test_program_enrollment.py b/erpnext/schools/doctype/program_enrollment/test_program_enrollment.py new file mode 100644 index 0000000000..c26e89920b --- /dev/null +++ b/erpnext/schools/doctype/program_enrollment/test_program_enrollment.py @@ -0,0 +1,12 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2015, Frappe and Contributors +# See license.txt +from __future__ import unicode_literals + +import frappe +import unittest + +# test_records = frappe.get_test_records('Program Enrollment') + +class TestProgramEnrollment(unittest.TestCase): + pass diff --git a/erpnext/schools/doctype/program_enrollment_fee/__init__.py b/erpnext/schools/doctype/program_enrollment_fee/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/erpnext/schools/doctype/program_enrollment_fee/program_enrollment_fee.json b/erpnext/schools/doctype/program_enrollment_fee/program_enrollment_fee.json new file mode 100644 index 0000000000..3ed340d441 --- /dev/null +++ b/erpnext/schools/doctype/program_enrollment_fee/program_enrollment_fee.json @@ -0,0 +1,161 @@ +{ + "allow_copy": 0, + "allow_import": 0, + "allow_rename": 0, + "beta": 0, + "creation": "2016-05-19 05:52:56.322125", + "custom": 0, + "docstatus": 0, + "doctype": "DocType", + "document_type": "", + "fields": [ + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "fieldname": "academic_term", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 1, + "label": "Academic Term", + "length": 0, + "no_copy": 0, + "options": "Academic Term", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "fieldname": "fee_structure", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 0, + "label": "Fee Structure", + "length": 0, + "no_copy": 0, + "options": "Fee Structure", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "fieldname": "column_break_3", + "fieldtype": "Column Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 0, + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "fieldname": "due_date", + "fieldtype": "Date", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 1, + "label": "Due Date", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "fieldname": "amount", + "fieldtype": "Currency", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 1, + "label": "Amount", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 1, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + } + ], + "hide_heading": 0, + "hide_toolbar": 0, + "idx": 0, + "in_create": 0, + "in_dialog": 0, + "is_submittable": 0, + "issingle": 0, + "istable": 1, + "max_attachments": 0, + "modified": "2016-07-18 10:30:50.243271", + "modified_by": "Administrator", + "module": "Schools", + "name": "Program Enrollment Fee", + "name_case": "", + "owner": "Administrator", + "permissions": [], + "quick_entry": 1, + "read_only": 0, + "read_only_onload": 0, + "sort_field": "modified", + "sort_order": "DESC", + "track_seen": 0 +} \ No newline at end of file diff --git a/erpnext/schools/doctype/program_enrollment_fee/program_enrollment_fee.py b/erpnext/schools/doctype/program_enrollment_fee/program_enrollment_fee.py new file mode 100644 index 0000000000..03a311e164 --- /dev/null +++ b/erpnext/schools/doctype/program_enrollment_fee/program_enrollment_fee.py @@ -0,0 +1,10 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2015, Frappe and contributors +# For license information, please see license.txt + +from __future__ import unicode_literals +import frappe +from frappe.model.document import Document + +class ProgramEnrollmentFee(Document): + pass diff --git a/erpnext/schools/doctype/program_enrollment_tool/__init__.py b/erpnext/schools/doctype/program_enrollment_tool/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/erpnext/schools/doctype/program_enrollment_tool/program_enrollment_tool.js b/erpnext/schools/doctype/program_enrollment_tool/program_enrollment_tool.js new file mode 100644 index 0000000000..3dd00c0644 --- /dev/null +++ b/erpnext/schools/doctype/program_enrollment_tool/program_enrollment_tool.js @@ -0,0 +1,33 @@ +// Copyright (c) 2016, Frappe and contributors +// For license information, please see license.txt +cur_frm.add_fetch("student", "title", "student_name"); +cur_frm.add_fetch("student_applicant", "title", "student_name"); + +frappe.ui.form.on("Program Enrollment Tool", { + "refresh": function(frm) { + frm.disable_save(); + }, + + "get_students": function(frm) { + frm.set_value("students",[]); + frappe.call({ + method: "get_students", + doc:frm.doc, + callback: function(r) { + if(r.message) { + frm.set_value("students", r.message); + } + } + }) + }, + + "enroll_students": function(frm) { + frappe.call({ + method: "enroll_students", + doc:frm.doc, + callback: function(r) { + frm.set_value("students", []); + } + }) + } +}); diff --git a/erpnext/schools/doctype/program_enrollment_tool/program_enrollment_tool.json b/erpnext/schools/doctype/program_enrollment_tool/program_enrollment_tool.json new file mode 100644 index 0000000000..0b0cd7b2f1 --- /dev/null +++ b/erpnext/schools/doctype/program_enrollment_tool/program_enrollment_tool.json @@ -0,0 +1,331 @@ +{ + "allow_copy": 1, + "allow_import": 0, + "allow_rename": 0, + "beta": 0, + "creation": "2016-06-10 03:01:05.178956", + "custom": 0, + "docstatus": 0, + "doctype": "DocType", + "document_type": "", + "fields": [ + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "fieldname": "get_students_from", + "fieldtype": "Select", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 0, + "label": "Get Students From", + "length": 0, + "no_copy": 0, + "options": "\nStudent Applicants\nProgram Enrollments", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 1, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "fieldname": "program", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 0, + "label": "Program", + "length": 0, + "no_copy": 0, + "options": "Program", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 1, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "fieldname": "academic_year", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 0, + "label": "Academic Year", + "length": 0, + "no_copy": 0, + "options": "Academic Year", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 1, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "fieldname": "get_students", + "fieldtype": "Button", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 0, + "label": "Get Students", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "fieldname": "section_break_5", + "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 0, + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "fieldname": "students", + "fieldtype": "Table", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 0, + "label": "Students", + "length": 0, + "no_copy": 0, + "options": "Program Enrollment Tool Student", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "fieldname": "section_break_7", + "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 0, + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "fieldname": "new_program", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 0, + "label": "New Program", + "length": 0, + "no_copy": 0, + "options": "Program", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "fieldname": "new_academic_year", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 0, + "label": "New Academic Year", + "length": 0, + "no_copy": 0, + "options": "Academic Year", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "fieldname": "enroll_students", + "fieldtype": "Button", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 0, + "label": "Enroll Students", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + } + ], + "hide_heading": 1, + "hide_toolbar": 1, + "idx": 0, + "image_view": 0, + "in_create": 0, + "in_dialog": 0, + "is_submittable": 0, + "issingle": 1, + "istable": 0, + "max_attachments": 0, + "modified": "2016-07-18 10:30:50.243271", + "modified_by": "demo@erpnext.com", + "module": "Schools", + "name": "Program Enrollment Tool", + "name_case": "", + "owner": "Administrator", + "permissions": [ + { + "amend": 0, + "apply_user_permissions": 0, + "cancel": 0, + "create": 1, + "delete": 0, + "email": 0, + "export": 0, + "if_owner": 0, + "import": 0, + "permlevel": 0, + "print": 0, + "read": 1, + "report": 0, + "role": "Administrator", + "set_user_permissions": 0, + "share": 0, + "submit": 0, + "write": 1 + }, + { + "amend": 0, + "apply_user_permissions": 0, + "cancel": 0, + "create": 1, + "delete": 0, + "email": 0, + "export": 0, + "if_owner": 0, + "import": 0, + "permlevel": 0, + "print": 0, + "read": 1, + "report": 0, + "role": "Academics User", + "set_user_permissions": 0, + "share": 0, + "submit": 0, + "write": 1 + } + ], + "quick_entry": 0, + "read_only": 0, + "read_only_onload": 0, + "sort_field": "modified", + "sort_order": "DESC", + "track_seen": 0 +} \ No newline at end of file diff --git a/erpnext/schools/doctype/program_enrollment_tool/program_enrollment_tool.py b/erpnext/schools/doctype/program_enrollment_tool/program_enrollment_tool.py new file mode 100644 index 0000000000..b483ef5a69 --- /dev/null +++ b/erpnext/schools/doctype/program_enrollment_tool/program_enrollment_tool.py @@ -0,0 +1,39 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2015, Frappe and contributors +# For license information, please see license.txt + +from __future__ import unicode_literals +import frappe +from frappe import _ +from frappe.model.document import Document + +class ProgramEnrollmentTool(Document): + def get_students(self): + if not self.get_students_from: + frappe.throw(_("Mandatory feild - Get Students From")) + elif not self.program: + frappe.throw(_("Mandatory feild - Program")) + elif not self.academic_year: + frappe.throw(_("Mandatory feild - Academic Year")) + else: + if self.get_students_from == "Student Applicants": + students = frappe.db.sql("select name as student_applicant, title as student_name from \ + `tabStudent Applicant` where program = %s and academic_year = %s",(self.program, self.academic_year), as_dict=1) + else: + students = frappe.db.sql("select student, student_name from \ + `tabProgram Enrollment` where program = %s and academic_year = %s",(self.program, self.academic_year), as_dict=1) + if students: + return students + else: + frappe.throw(_("No students Found")) + + def enroll_students(self): + for stud in self.students: + prog_enrollment = frappe.new_doc("Program Enrollment") + prog_enrollment.student = stud.student + prog_enrollment.student_name = stud.student_name + prog_enrollment.program = self.new_program + prog_enrollment.academic_year = self.new_academic_year + prog_enrollment.save() + frappe.msgprint("Students have been enrolled.") + \ No newline at end of file diff --git a/erpnext/schools/doctype/program_enrollment_tool_student/__init__.py b/erpnext/schools/doctype/program_enrollment_tool_student/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/erpnext/schools/doctype/program_enrollment_tool_student/program_enrollment_tool_student.json b/erpnext/schools/doctype/program_enrollment_tool_student/program_enrollment_tool_student.json new file mode 100644 index 0000000000..a72feb4043 --- /dev/null +++ b/erpnext/schools/doctype/program_enrollment_tool_student/program_enrollment_tool_student.json @@ -0,0 +1,138 @@ +{ + "allow_copy": 0, + "allow_import": 0, + "allow_rename": 0, + "beta": 0, + "creation": "2016-06-10 03:29:02.539914", + "custom": 0, + "docstatus": 0, + "doctype": "DocType", + "document_type": "", + "fields": [ + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "depends_on": "", + "fieldname": "student_applicant", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 1, + "label": "Student Applicant", + "length": 0, + "no_copy": 0, + "options": "Student Applicant", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "depends_on": "", + "fieldname": "student", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 1, + "label": "Student", + "length": 0, + "no_copy": 0, + "options": "Student", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "fieldname": "column_break_3", + "fieldtype": "Column Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 0, + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "fieldname": "student_name", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 1, + "label": "Student Name", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 1, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + } + ], + "hide_heading": 0, + "hide_toolbar": 0, + "idx": 0, + "in_create": 0, + "in_dialog": 0, + "is_submittable": 0, + "issingle": 0, + "istable": 1, + "max_attachments": 0, + "modified": "2016-07-18 10:30:50.243271", + "modified_by": "Administrator", + "module": "Schools", + "name": "Program Enrollment Tool Student", + "name_case": "", + "owner": "Administrator", + "permissions": [], + "quick_entry": 1, + "read_only": 0, + "read_only_onload": 0, + "sort_field": "modified", + "sort_order": "DESC", + "track_seen": 0 +} \ No newline at end of file diff --git a/erpnext/schools/doctype/program_enrollment_tool_student/program_enrollment_tool_student.py b/erpnext/schools/doctype/program_enrollment_tool_student/program_enrollment_tool_student.py new file mode 100644 index 0000000000..38dc1c8437 --- /dev/null +++ b/erpnext/schools/doctype/program_enrollment_tool_student/program_enrollment_tool_student.py @@ -0,0 +1,10 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2015, Frappe and contributors +# For license information, please see license.txt + +from __future__ import unicode_literals +import frappe +from frappe.model.document import Document + +class ProgramEnrollmentToolStudent(Document): + pass diff --git a/erpnext/schools/doctype/program_fee/__init__.py b/erpnext/schools/doctype/program_fee/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/erpnext/schools/doctype/program_fee/program_fee.json b/erpnext/schools/doctype/program_fee/program_fee.json new file mode 100644 index 0000000000..ef3b9a6547 --- /dev/null +++ b/erpnext/schools/doctype/program_fee/program_fee.json @@ -0,0 +1,162 @@ +{ + "allow_copy": 0, + "allow_import": 0, + "allow_rename": 0, + "beta": 0, + "creation": "2016-05-19 05:52:56.322125", + "custom": 0, + "docstatus": 0, + "doctype": "DocType", + "document_type": "", + "fields": [ + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "fieldname": "academic_term", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 1, + "label": "Academic Term", + "length": 0, + "no_copy": 0, + "options": "Academic Term", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "fieldname": "fee_structure", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 0, + "label": "Fee Structure", + "length": 0, + "no_copy": 0, + "options": "Fee Structure", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 1, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "fieldname": "column_break_3", + "fieldtype": "Column Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 0, + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "fieldname": "due_date", + "fieldtype": "Date", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 1, + "label": "Due Date", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "fieldname": "amount", + "fieldtype": "Currency", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 1, + "label": "Amount", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 1, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + } + ], + "hide_heading": 0, + "hide_toolbar": 0, + "idx": 0, + "image_view": 0, + "in_create": 0, + "in_dialog": 0, + "is_submittable": 0, + "issingle": 0, + "istable": 1, + "max_attachments": 0, + "modified": "2016-07-18 10:30:50.243271", + "modified_by": "Administrator", + "module": "Schools", + "name": "Program Fee", + "name_case": "", + "owner": "Administrator", + "permissions": [], + "quick_entry": 1, + "read_only": 0, + "read_only_onload": 0, + "sort_field": "modified", + "sort_order": "DESC", + "track_seen": 0 +} \ No newline at end of file diff --git a/erpnext/schools/doctype/program_fee/program_fee.py b/erpnext/schools/doctype/program_fee/program_fee.py new file mode 100644 index 0000000000..cadcc4eeb8 --- /dev/null +++ b/erpnext/schools/doctype/program_fee/program_fee.py @@ -0,0 +1,10 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2015, Frappe and contributors +# For license information, please see license.txt + +from __future__ import unicode_literals +import frappe +from frappe.model.document import Document + +class ProgramFee(Document): + pass diff --git a/erpnext/schools/doctype/room/__init__.py b/erpnext/schools/doctype/room/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/erpnext/schools/doctype/room/room.js b/erpnext/schools/doctype/room/room.js new file mode 100644 index 0000000000..032db9835b --- /dev/null +++ b/erpnext/schools/doctype/room/room.js @@ -0,0 +1,10 @@ +frappe.ui.form.on("Room", "refresh", function(frm) { + if(!cur_frm.doc.__islocal) { + frm.add_custom_button(__("Course Schedule"), function() { + frappe.route_options = { + room: frm.doc.name + } + frappe.set_route("List", "Course Schedule"); + }); + } +}); \ No newline at end of file diff --git a/erpnext/schools/doctype/room/room.json b/erpnext/schools/doctype/room/room.json new file mode 100644 index 0000000000..b7a6d945bc --- /dev/null +++ b/erpnext/schools/doctype/room/room.json @@ -0,0 +1,146 @@ +{ + "allow_copy": 0, + "allow_import": 1, + "allow_rename": 0, + "autoname": "RM.####", + "creation": "2015-09-09 16:20:14.613061", + "custom": 0, + "docstatus": 0, + "doctype": "DocType", + "document_type": "", + "fields": [ + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "fieldname": "room_name", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, + "label": "Room Name", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 1, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "fieldname": "room_number", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 1, + "label": "Room Number", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "fieldname": "seating_capacity", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 1, + "label": "Seating Capacity", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + } + ], + "hide_heading": 0, + "hide_toolbar": 0, + "idx": 0, + "in_create": 0, + "in_dialog": 0, + "is_submittable": 0, + "issingle": 0, + "istable": 0, + "max_attachments": 0, + "menu_index": 0, + "modified": "2016-07-18 10:30:50.243271", + "modified_by": "Administrator", + "module": "Schools", + "name": "Room", + "name_case": "", + "owner": "Administrator", + "permissions": [ + { + "amend": 0, + "apply_user_permissions": 0, + "cancel": 0, + "create": 1, + "delete": 1, + "email": 1, + "export": 1, + "if_owner": 0, + "import": 0, + "permlevel": 0, + "print": 1, + "read": 1, + "report": 1, + "role": "Academics User", + "set_user_permissions": 0, + "share": 1, + "submit": 0, + "write": 1 + }, + { + "amend": 0, + "apply_user_permissions": 0, + "cancel": 0, + "create": 1, + "delete": 1, + "email": 1, + "export": 1, + "if_owner": 0, + "import": 0, + "permlevel": 0, + "print": 1, + "read": 1, + "report": 1, + "role": "Administrator", + "set_user_permissions": 0, + "share": 1, + "submit": 0, + "write": 1 + } + ], + "read_only": 0, + "read_only_onload": 0, + "sort_field": "modified", + "sort_order": "DESC", + "title_field": "room_name", + "version": 0 +} \ No newline at end of file diff --git a/erpnext/schools/doctype/room/room.py b/erpnext/schools/doctype/room/room.py new file mode 100644 index 0000000000..f26e9c4b45 --- /dev/null +++ b/erpnext/schools/doctype/room/room.py @@ -0,0 +1,10 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2015, Frappe Technologies and contributors +# For license information, please see license.txt + +from __future__ import unicode_literals +import frappe +from frappe.model.document import Document + +class Room(Document): + pass diff --git a/erpnext/schools/doctype/room/test_records.json b/erpnext/schools/doctype/room/test_records.json new file mode 100644 index 0000000000..6edf076808 --- /dev/null +++ b/erpnext/schools/doctype/room/test_records.json @@ -0,0 +1,17 @@ +[ + { + "room_name": "_Test Room", + "room_number": "1001", + "seating_capacity": 100 + }, + { + "room_name": "_Test Room 1", + "room_number": "1002", + "seating_capacity": 100 + }, + { + "room_name": "_Test Room 2", + "room_number": "1003", + "seating_capacity": 100 + } +] \ No newline at end of file diff --git a/erpnext/schools/doctype/room/test_room.py b/erpnext/schools/doctype/room/test_room.py new file mode 100644 index 0000000000..33ffd9173e --- /dev/null +++ b/erpnext/schools/doctype/room/test_room.py @@ -0,0 +1,12 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2015, Frappe Technologies and Contributors +# See license.txt +from __future__ import unicode_literals + +import frappe +import unittest + +# test_records = frappe.get_test_records('Room') + +class TestRoom(unittest.TestCase): + pass diff --git a/erpnext/schools/doctype/scheduling_tool/__init__.py b/erpnext/schools/doctype/scheduling_tool/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/erpnext/schools/doctype/scheduling_tool/scheduling_tool.js b/erpnext/schools/doctype/scheduling_tool/scheduling_tool.js new file mode 100644 index 0000000000..7109771a6e --- /dev/null +++ b/erpnext/schools/doctype/scheduling_tool/scheduling_tool.js @@ -0,0 +1,14 @@ +cur_frm.add_fetch("student_group", "program", "program"); +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("Scheduling Tool", "refresh", function(frm) { + frm.disable_save(); + frm.page.set_primary_action(__("Schedule Course"), function() { + frappe.call({ + method: "schedule_course", + doc:frm.doc + }) + }); +}); \ No newline at end of file diff --git a/erpnext/schools/doctype/scheduling_tool/scheduling_tool.json b/erpnext/schools/doctype/scheduling_tool/scheduling_tool.json new file mode 100644 index 0000000000..0143c8b299 --- /dev/null +++ b/erpnext/schools/doctype/scheduling_tool/scheduling_tool.json @@ -0,0 +1,539 @@ +{ + "allow_copy": 1, + "allow_import": 0, + "allow_rename": 0, + "creation": "2015-09-23 15:37:38.108475", + "custom": 0, + "docstatus": 0, + "doctype": "DocType", + "document_type": "Setup", + "fields": [ + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "fieldname": "student_group", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, + "label": "Student Group", + "length": 0, + "no_copy": 0, + "options": "Student Group", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 1, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "fieldname": "academic_year", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, + "label": "Academic Year", + "length": 0, + "no_copy": 0, + "options": "Academic Year", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 1, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "fieldname": "academic_term", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, + "label": "Academic Term", + "length": 0, + "no_copy": 0, + "options": "Academic Term", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 1, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "fieldname": "column_break_3", + "fieldtype": "Column Break", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "fieldname": "program", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, + "label": "Program", + "length": 0, + "no_copy": 0, + "options": "Program", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 1, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "fieldname": "course", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, + "label": "Course", + "length": 0, + "no_copy": 0, + "options": "Course", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 1, + "report_hide": 0, + "reqd": 1, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "fieldname": "section_break_6", + "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "fieldname": "room", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, + "label": "Room", + "length": 0, + "no_copy": 0, + "options": "Room", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 1, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "fieldname": "column_break_9", + "fieldtype": "Column Break", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "fieldname": "instructor", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, + "label": "Instructor", + "length": 0, + "no_copy": 0, + "options": "Instructor", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 1, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "fieldname": "instructor_name", + "fieldtype": "Read Only", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, + "label": "Instructor Name", + "length": 0, + "no_copy": 0, + "options": "instructor.instructor_name", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 1, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "fieldname": "section_break_7", + "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "default": "", + "fieldname": "from_time", + "fieldtype": "Time", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, + "label": "From Time", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 1, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "default": "", + "fieldname": "course_start_date", + "fieldtype": "Date", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, + "label": "Course Start Date", + "length": 0, + "no_copy": 0, + "options": "", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 1, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "fieldname": "day", + "fieldtype": "Select", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, + "label": "Day", + "length": 0, + "no_copy": 0, + "options": "\nMonday\nTuesday\nWednesday\nThursday\nFriday\nSaturday\nSunday", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 1, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "fieldname": "rechedule", + "fieldtype": "Check", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, + "label": "Rechedule", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "fieldname": "column_break_15", + "fieldtype": "Column Break", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "fieldname": "to_time", + "fieldtype": "Time", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, + "label": "To TIme", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 1, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "default": "", + "fieldname": "course_end_date", + "fieldtype": "Date", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, + "label": "Course End Date", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 1, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + } + ], + "hide_heading": 1, + "hide_toolbar": 1, + "idx": 0, + "in_create": 0, + "in_dialog": 0, + "is_submittable": 0, + "issingle": 1, + "istable": 0, + "max_attachments": 0, + "menu_index": 0, + "modified": "2016-07-18 10:30:50.243271", + "modified_by": "Administrator", + "module": "Schools", + "name": "Scheduling Tool", + "name_case": "", + "owner": "Administrator", + "permissions": [ + { + "amend": 0, + "apply_user_permissions": 0, + "cancel": 0, + "create": 1, + "delete": 0, + "email": 0, + "export": 0, + "if_owner": 0, + "import": 0, + "permlevel": 0, + "print": 0, + "read": 1, + "report": 0, + "role": "Academics User", + "set_user_permissions": 0, + "share": 0, + "submit": 0, + "write": 1 + }, + { + "amend": 0, + "apply_user_permissions": 0, + "cancel": 0, + "create": 1, + "delete": 0, + "email": 0, + "export": 0, + "if_owner": 0, + "import": 0, + "permlevel": 0, + "print": 0, + "read": 1, + "report": 0, + "role": "Administrator", + "set_user_permissions": 0, + "share": 0, + "submit": 0, + "write": 1 + } + ], + "read_only": 0, + "read_only_onload": 0, + "sort_field": "modified", + "sort_order": "DESC", + "version": 0 +} \ No newline at end of file diff --git a/erpnext/schools/doctype/scheduling_tool/scheduling_tool.py b/erpnext/schools/doctype/scheduling_tool/scheduling_tool.py new file mode 100644 index 0000000000..4a62a74323 --- /dev/null +++ b/erpnext/schools/doctype/scheduling_tool/scheduling_tool.py @@ -0,0 +1,95 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2015, Frappe Technologies and contributors +# For license information, please see license.txt + +from __future__ import unicode_literals +import frappe +import calendar +from frappe import _ +from frappe.model.document import Document +from frappe.utils import add_days, getdate +from erpnext.schools.utils import OverlapError + +class SchedulingTool(Document): + def schedule_course(self): + """Creates course schedules as per specified parametes""" + + course_schedules= [] + course_schedules_errors= [] + rescheduled= [] + reschedule_errors= [] + + self.validate_mandatory() + self.validate_date() + self.instructor_name= frappe.db.get_value("Instructor", self.instructor, "instructor_name") + self.course= frappe.db.get_value("Student Group", self.student_group, "course") + + if self.rechedule: + rescheduled, reschedule_errors = self.delete_course_schedule(rescheduled, reschedule_errors) + + date = self.course_start_date + while(date < self.course_end_date): + if self.day == calendar.day_name[getdate(date).weekday()]: + course_schedule = self.make_course_schedule(date) + try: + course_schedule.save() + except OverlapError: + course_schedules_errors.append(date) + else: + course_schedules.append(course_schedule.name + " on " + date) + + date = add_days(date, 7) + else: + date = add_days(date, 1) + + frappe.local.message_log = [] + if course_schedules: + frappe.msgprint(_("Course Schedules created:") + "\n" + "\n".join(course_schedules)) + if course_schedules_errors: + frappe.msgprint(_("There were errors while scheduling course on :") + "\n" + "\n".join(course_schedules_errors)) + if rescheduled: + frappe.msgprint(_("Course Schedules deleted:") + "\n" + "\n".join(rescheduled)) + if reschedule_errors: + frappe.msgprint(_("There were errors while deleting following schedules:") + "\n" + "\n".join(reschedule_errors)) + + def validate_mandatory(self): + """Validates all mandatory fields""" + fields = ['student_group', 'room', 'instructor', 'from_time', 'to_time', 'course_start_date', 'course_end_date', 'day'] + for d in fields: + if not self.get(d): + frappe.throw(_("{0} is mandatory").format(self.meta.get_label(d))) + + def validate_date(self): + """Validates if Course Start Date is greater than Course End Date""" + if self.course_start_date > self.course_end_date: + frappe.throw("Course Start Date cannot be greater than Course End Date.") + + def delete_course_schedule(self, rescheduled, reschedule_errors): + """Delete all course schedule within the Date range and specified filters""" + schedules = frappe.get_list("Course Schedule", fields=["name", "schedule_date"], filters = + [["student_group", "=", self.student_group], + ["schedule_date", ">=", self.course_start_date], + ["schedule_date", "<=", self.course_end_date]]) + for d in schedules: + try: + if self.day == calendar.day_name[getdate(d.schedule_date).weekday()]: + frappe.delete_doc("Course Schedule", d.name) + rescheduled.append(d.name) + except: + reschedule_errors.append(d.name) + return rescheduled, reschedule_errors + + def make_course_schedule(self, date): + """Makes a new Course Schedule. + :param date: Date on which Course Schedule will be created.""" + + course_schedule = frappe.new_doc("Course Schedule") + course_schedule.student_group = self.student_group + course_schedule.course = self.course + course_schedule.instructor = self.instructor + course_schedule.instructor_name = self.instructor_name + course_schedule.room = self.room + course_schedule.schedule_date= date + course_schedule.from_time= self.from_time + course_schedule.to_time= self.to_time + return course_schedule diff --git a/erpnext/schools/doctype/scheduling_tool/test_scheduling_tool.py b/erpnext/schools/doctype/scheduling_tool/test_scheduling_tool.py new file mode 100644 index 0000000000..4ec3747b80 --- /dev/null +++ b/erpnext/schools/doctype/scheduling_tool/test_scheduling_tool.py @@ -0,0 +1,12 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2015, Frappe and Contributors +# See license.txt +from __future__ import unicode_literals + +import frappe +import unittest + +# test_records = frappe.get_test_records('Scheduling Tool') + +class TestSchedulingTool(unittest.TestCase): + pass diff --git a/erpnext/schools/doctype/sg_creation_tool_course/__init__.py b/erpnext/schools/doctype/sg_creation_tool_course/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/erpnext/schools/doctype/sg_creation_tool_course/sg_creation_tool_course.json b/erpnext/schools/doctype/sg_creation_tool_course/sg_creation_tool_course.json new file mode 100644 index 0000000000..872b1dc3bc --- /dev/null +++ b/erpnext/schools/doctype/sg_creation_tool_course/sg_creation_tool_course.json @@ -0,0 +1,153 @@ +{ + "allow_copy": 0, + "allow_import": 0, + "allow_rename": 0, + "creation": "2016-01-04 15:03:57.940079", + "custom": 0, + "docstatus": 0, + "doctype": "DocType", + "document_type": "", + "fields": [ + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "fieldname": "course", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 1, + "label": "Course", + "length": 0, + "no_copy": 0, + "options": "Course", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 1, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "fieldname": "course_code", + "fieldtype": "Read Only", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, + "label": "Course Code", + "length": 0, + "no_copy": 0, + "options": "course.course_code", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 1, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "fieldname": "column_break_3", + "fieldtype": "Column Break", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "fieldname": "student_group_name", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 1, + "label": "Student Group Name", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 1, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "fieldname": "max_strength", + "fieldtype": "Int", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 1, + "label": "Max Strength", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + } + ], + "hide_heading": 0, + "hide_toolbar": 0, + "idx": 0, + "in_create": 0, + "in_dialog": 0, + "is_submittable": 0, + "issingle": 1, + "istable": 1, + "max_attachments": 0, + "modified": "2016-07-18 10:30:50.243271", + "modified_by": "Administrator", + "module": "Schools", + "name": "SG Creation Tool Course", + "name_case": "", + "owner": "Administrator", + "permissions": [], + "read_only": 0, + "read_only_onload": 0, + "sort_field": "modified", + "sort_order": "DESC" +} \ No newline at end of file diff --git a/erpnext/schools/doctype/sg_creation_tool_course/sg_creation_tool_course.py b/erpnext/schools/doctype/sg_creation_tool_course/sg_creation_tool_course.py new file mode 100644 index 0000000000..4024c69f1c --- /dev/null +++ b/erpnext/schools/doctype/sg_creation_tool_course/sg_creation_tool_course.py @@ -0,0 +1,10 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2015, Frappe and contributors +# For license information, please see license.txt + +from __future__ import unicode_literals +import frappe +from frappe.model.document import Document + +class SGCreationToolCourse(Document): + pass diff --git a/erpnext/schools/doctype/student/__init__.py b/erpnext/schools/doctype/student/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/erpnext/schools/doctype/student/student.js b/erpnext/schools/doctype/student/student.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/erpnext/schools/doctype/student/student.json b/erpnext/schools/doctype/student/student.json new file mode 100644 index 0000000000..70648c2c1f --- /dev/null +++ b/erpnext/schools/doctype/student/student.json @@ -0,0 +1,614 @@ +{ + "allow_copy": 0, + "allow_import": 1, + "allow_rename": 0, + "autoname": "naming_series:", + "beta": 0, + "creation": "2015-09-07 13:00:55.938280", + "custom": 0, + "docstatus": 0, + "doctype": "DocType", + "document_type": "Document", + "editable_grid": 0, + "fields": [ + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "fieldname": "first_name", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 0, + "label": "First Name", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 1, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "fieldname": "middle_name", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 0, + "label": "Middle Name", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "fieldname": "last_name", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 0, + "label": "Last Name", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "fieldname": "column_break_4", + "fieldtype": "Column Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 0, + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "fieldname": "naming_series", + "fieldtype": "Select", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 0, + "label": "Naming Series", + "length": 0, + "no_copy": 0, + "options": "STUD.", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "default": "Today", + "fieldname": "joining_date", + "fieldtype": "Date", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 1, + "label": "Joining Date", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 1, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "fieldname": "image", + "fieldtype": "Attach Image", + "hidden": 1, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 0, + "label": "Image", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0, + "width": "10" + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 1, + "collapsible_depends_on": "!doc.__islocal", + "fieldname": "section_break_7", + "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 0, + "label": "Personal Details", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "fieldname": "mother_name", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 0, + "label": "Mother's Name", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "fieldname": "mother_email_id", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 0, + "label": "Mother's / Guardian 1 Email ID", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "fieldname": "father_name", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 0, + "label": "Father's Name", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "fieldname": "father_email_id", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 0, + "label": "Father's/ Guardian 2 Email ID", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "fieldname": "contact", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 0, + "label": "Contact", + "length": 0, + "no_copy": 0, + "options": "Contact", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "fieldname": "student_applicant", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 0, + "label": "Student Applicant", + "length": 0, + "no_copy": 0, + "options": "Student Applicant", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 1, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "fieldname": "column_break_3", + "fieldtype": "Column Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 0, + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "fieldname": "date_of_birth", + "fieldtype": "Date", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 0, + "label": "Date of Birth", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "fieldname": "gender", + "fieldtype": "Select", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 0, + "label": "Gender", + "length": 0, + "no_copy": 0, + "options": "\nMale\nFemale", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "fieldname": "blood_group", + "fieldtype": "Select", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 0, + "label": "Blood Group", + "length": 0, + "no_copy": 0, + "options": "\nA+\nA-\nB+\nB-\nO+\nO-\nAB+\nAB-", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "fieldname": "nationality", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 0, + "label": "Nationality", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "fieldname": "student_email_id", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 0, + "label": "Student Email ID", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 1 + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "default": "", + "fieldname": "title", + "fieldtype": "Data", + "hidden": 1, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 0, + "label": "Title", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + } + ], + "hide_heading": 0, + "hide_toolbar": 0, + "idx": 0, + "image_field": "image", + "image_view": 0, + "in_create": 0, + "in_dialog": 0, + "is_submittable": 0, + "issingle": 0, + "istable": 0, + "max_attachments": 0, + "menu_index": 0, + "modified": "2016-07-18 10:30:50.243271", + "modified_by": "Administrator", + "module": "Schools", + "name": "Student", + "name_case": "", + "owner": "Administrator", + "permissions": [ + { + "amend": 0, + "apply_user_permissions": 0, + "cancel": 0, + "create": 1, + "delete": 1, + "email": 1, + "export": 1, + "if_owner": 0, + "import": 0, + "permlevel": 0, + "print": 1, + "read": 1, + "report": 1, + "role": "Administrator", + "set_user_permissions": 0, + "share": 1, + "submit": 0, + "write": 1 + }, + { + "amend": 0, + "apply_user_permissions": 0, + "cancel": 0, + "create": 1, + "delete": 1, + "email": 1, + "export": 1, + "if_owner": 0, + "import": 0, + "permlevel": 0, + "print": 1, + "read": 1, + "report": 1, + "role": "Academics User", + "set_user_permissions": 0, + "share": 1, + "submit": 0, + "write": 1 + } + ], + "quick_entry": 0, + "read_only": 0, + "read_only_onload": 0, + "sort_field": "modified", + "sort_order": "DESC", + "title_field": "title", + "track_seen": 0 +} \ No newline at end of file diff --git a/erpnext/schools/doctype/student/student.py b/erpnext/schools/doctype/student/student.py new file mode 100644 index 0000000000..a34bb6a599 --- /dev/null +++ b/erpnext/schools/doctype/student/student.py @@ -0,0 +1,37 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2015, Frappe Technologies and contributors +# For license information, please see license.txt + +from __future__ import unicode_literals +import frappe +from frappe.model.document import Document + +class Student(Document): + + def validate(self): + self.title = " ".join(filter(None, [self.first_name, self.middle_name, self.last_name])) + + if self.student_applicant: + self.check_unique() + self.update_applicant_status() + + def check_unique(self): + """Validates if the Student Applicant is Unique""" + student = frappe.db.sql("select name from `tabStudent` where student_applicant=%s and name!=%s", (self.student_applicant, self.name)) + if student: + frappe.throw("Student {0} exist against student applicant {1}".format(student[0][0], self.student_applicant)) + + def update_applicant_status(self): + """Updates Student Applicant status to Admitted""" + if self.student_applicant: + frappe.db.set_value("Student Applicant", self.student_applicant, "application_status", "Admitted") + +def get_timeline_data(doctype, name): + '''Return timeline for attendance''' + return dict(frappe.db.sql('''select unix_timestamp(cs.schedule_date), count(*) + from `tabCourse Schedule` as cs , `tabStudent Attendance` as sa where + sa.course_schedule = cs.name + and sa.student=%s + and cs.schedule_date > date_sub(curdate(), interval 1 year) + and status = 'Present' + group by cs.schedule_date''', name)) diff --git a/erpnext/schools/doctype/student/student_dashboard.py b/erpnext/schools/doctype/student/student_dashboard.py new file mode 100644 index 0000000000..0c22c7b60f --- /dev/null +++ b/erpnext/schools/doctype/student/student_dashboard.py @@ -0,0 +1,15 @@ +from frappe import _ + +data = { + 'heatmap': True, + 'heatmap_message': _('This is based on the attendance of this Student'), + 'fieldname': 'student', + 'transactions': [ + { + 'items': ['Student Group', 'Student Attendance', 'Program Enrollment' ] + }, + { + 'items': ['Fees', 'Examination'] + } + ] +} \ No newline at end of file diff --git a/erpnext/schools/doctype/student/test_records.json b/erpnext/schools/doctype/student/test_records.json new file mode 100644 index 0000000000..e280794ce6 --- /dev/null +++ b/erpnext/schools/doctype/student/test_records.json @@ -0,0 +1,32 @@ +[ + { + "first_name": "_Test", + "middle_name": "Student", + "last_name": "Name", + "program": "_Test Program", + "date_of_birth": "2000-01-01", + "gender": "Male", + "blood_group": "A+" + + }, + { + "first_name": "_Test", + "middle_name": "Student", + "last_name": "Name 1", + "program": "_Test Program", + "date_of_birth": "2000-01-01", + "gender": "Male", + "blood_group": "A+" + + }, + { + "first_name": "_Test", + "middle_name": "Student", + "last_name": "Name 2", + "program": "_Test Program", + "date_of_birth": "2000-01-01", + "gender": "Male", + "blood_group": "A+" + + } +] \ No newline at end of file diff --git a/erpnext/schools/doctype/student/test_student.py b/erpnext/schools/doctype/student/test_student.py new file mode 100644 index 0000000000..cc6537f865 --- /dev/null +++ b/erpnext/schools/doctype/student/test_student.py @@ -0,0 +1,12 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2015, Frappe Technologies and Contributors +# See license.txt +from __future__ import unicode_literals + +import frappe +import unittest + +# test_records = frappe.get_test_records('Student') + +class TestStudent(unittest.TestCase): + pass diff --git a/erpnext/schools/doctype/student_applicant/__init__.py b/erpnext/schools/doctype/student_applicant/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/erpnext/schools/doctype/student_applicant/student_applicant.js b/erpnext/schools/doctype/student_applicant/student_applicant.js new file mode 100644 index 0000000000..6857a667d7 --- /dev/null +++ b/erpnext/schools/doctype/student_applicant/student_applicant.js @@ -0,0 +1,29 @@ +frappe.ui.form.on("Student Applicant", { + refresh: function(frm) { + if(frm.doc.application_status== "Applied" && frm.doc.docstatus== 1 ) { + frm.add_custom_button(__("Approve"), function() { + frm.set_value("application_status", "Approved"); + frm.save_or_update(); + + }).addClass("btn-primary"); + + frm.add_custom_button(__("Reject"), function() { + frm.set_value("application_status", "Rejected"); + frm.save_or_update(); + }).addClass("btn-danger"); + } + + if(frm.doc.application_status== "Approved" && frm.doc.docstatus== 1 ) { + frm.add_custom_button(__("Enroll"), function() { + frm.events.enroll(frm) + }).addClass("btn-primary"); + } + }, + + enroll: function(frm) { + frappe.model.open_mapped_doc({ + method: "erpnext.schools.api.enroll_student", + frm: frm + }) + } +}); \ No newline at end of file diff --git a/erpnext/schools/doctype/student_applicant/student_applicant.json b/erpnext/schools/doctype/student_applicant/student_applicant.json new file mode 100644 index 0000000000..f2635c8ac8 --- /dev/null +++ b/erpnext/schools/doctype/student_applicant/student_applicant.json @@ -0,0 +1,691 @@ +{ + "allow_copy": 0, + "allow_import": 1, + "allow_rename": 0, + "autoname": "naming_series:", + "beta": 0, + "creation": "2015-09-11 11:50:09.740807", + "custom": 0, + "docstatus": 0, + "doctype": "DocType", + "document_type": "Document", + "editable_grid": 0, + "fields": [ + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "fieldname": "first_name", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 0, + "label": "First Name", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 1, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "fieldname": "middle_name", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 0, + "label": "Middle Name", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "fieldname": "last_name", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 0, + "label": "Last Name", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "fieldname": "program", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 1, + "in_list_view": 1, + "label": "Program", + "length": 0, + "no_copy": 0, + "options": "Program", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 1, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "fieldname": "column_break_8", + "fieldtype": "Column Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 0, + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "fieldname": "naming_series", + "fieldtype": "Select", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 0, + "label": "Naming Series", + "length": 0, + "no_copy": 0, + "options": "AP.", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 1, + "bold": 0, + "collapsible": 0, + "depends_on": "eval:doc.docstatus != 0", + "fieldname": "application_status", + "fieldtype": "Select", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 1, + "in_list_view": 0, + "label": "Application Status", + "length": 0, + "no_copy": 1, + "options": "Applied\nApproved\nRejected\nAdmitted", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "default": "Today", + "fieldname": "application_date", + "fieldtype": "Date", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 0, + "label": "Application Date", + "length": 0, + "no_copy": 0, + "options": "", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "fieldname": "academic_year", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 0, + "label": "Academic Year", + "length": 0, + "no_copy": 0, + "options": "Academic Year", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "fieldname": "image", + "fieldtype": "Attach Image", + "hidden": 1, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 0, + "label": "Image", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 1, + "collapsible_depends_on": "eval: doc.__islocal == 1", + "fieldname": "section_break_4", + "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 0, + "label": "Personal Details", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "fieldname": "mother_name", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 0, + "label": "Mother's Name", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "fieldname": "mother_email_id", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 0, + "label": "Mother's / Guardian 1 Email ID", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "fieldname": "father_name", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 0, + "label": "Father's Name", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "fieldname": "father_email_id", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 0, + "label": "Father's/ Guardian 2 Email ID", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "fieldname": "contact", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 0, + "label": "Contact", + "length": 0, + "no_copy": 0, + "options": "Contact", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "fieldname": "column_break_12", + "fieldtype": "Column Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 0, + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "fieldname": "date_of_birth", + "fieldtype": "Date", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 0, + "label": "Date of Birth", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "fieldname": "gender", + "fieldtype": "Select", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 0, + "label": "Gender", + "length": 0, + "no_copy": 0, + "options": "\nMale\nFemale", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "fieldname": "blood_group", + "fieldtype": "Select", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 0, + "label": "Blood Group", + "length": 0, + "no_copy": 0, + "options": "\nA+\nA-\nB+\nB-\nO+\nO-\nAB+\nAB-", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "fieldname": "nationality", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 0, + "label": "Nationality", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "fieldname": "student_email_id", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 0, + "label": "Student Email ID", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 1 + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "fieldname": "title", + "fieldtype": "Data", + "hidden": 1, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 0, + "label": "Title", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "fieldname": "amended_from", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 0, + "label": "Amended From", + "length": 0, + "no_copy": 1, + "options": "Student Applicant", + "permlevel": 0, + "print_hide": 1, + "print_hide_if_no_value": 0, + "read_only": 1, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + } + ], + "hide_heading": 0, + "hide_toolbar": 0, + "idx": 0, + "image_field": "image", + "image_view": 0, + "in_create": 0, + "in_dialog": 0, + "is_submittable": 1, + "issingle": 0, + "istable": 0, + "max_attachments": 0, + "menu_index": 0, + "modified": "2016-07-18 10:30:50.243271", + "modified_by": "Administrator", + "module": "Schools", + "name": "Student Applicant", + "name_case": "", + "owner": "Administrator", + "permissions": [ + { + "amend": 1, + "apply_user_permissions": 0, + "cancel": 1, + "create": 1, + "delete": 1, + "email": 1, + "export": 1, + "if_owner": 0, + "import": 1, + "permlevel": 0, + "print": 1, + "read": 1, + "report": 1, + "role": "Academics User", + "set_user_permissions": 0, + "share": 1, + "submit": 1, + "write": 1 + }, + { + "amend": 1, + "apply_user_permissions": 0, + "cancel": 1, + "create": 1, + "delete": 1, + "email": 1, + "export": 1, + "if_owner": 0, + "import": 1, + "permlevel": 0, + "print": 1, + "read": 1, + "report": 1, + "role": "Administrator", + "set_user_permissions": 0, + "share": 1, + "submit": 1, + "write": 1 + } + ], + "quick_entry": 1, + "read_only": 0, + "read_only_onload": 0, + "sort_field": "modified", + "sort_order": "DESC", + "title_field": "title", + "track_seen": 0 +} \ No newline at end of file diff --git a/erpnext/schools/doctype/student_applicant/student_applicant.py b/erpnext/schools/doctype/student_applicant/student_applicant.py new file mode 100644 index 0000000000..5ef72cbe3c --- /dev/null +++ b/erpnext/schools/doctype/student_applicant/student_applicant.py @@ -0,0 +1,17 @@ +# -*- coding: utf-8 -*-777777yyy +# Copyright (c) 2015, Frappe Technologies and contributors +# For license information, please see license.txt + +from __future__ import unicode_literals +import frappe +from frappe import _ +from frappe.model.document import Document + +class StudentApplicant(Document): + def validate(self): + self.title = " ".join(filter(None, [self.first_name, self.middle_name, self.last_name])) + + def on_update_after_submit(self): + student = frappe.get_list("Student", filters= {"student_applicant": self.name}) + if student: + frappe.throw(_("Cannot change status as student {0} is linked with student application {1}").format(student[0].name, self.name)) diff --git a/erpnext/schools/doctype/student_applicant/student_applicant_list.js b/erpnext/schools/doctype/student_applicant/student_applicant_list.js new file mode 100644 index 0000000000..43402d848a --- /dev/null +++ b/erpnext/schools/doctype/student_applicant/student_applicant_list.js @@ -0,0 +1,17 @@ +frappe.listview_settings['Student Applicant'] = { + add_fields: [ "application_status"], + get_indicator: function(doc) { + if (doc.application_status=="Applied") { + return [__("Applied"), "orange", "application_status,=,Applied"]; + } + else if (doc.application_status=="Approved") { + return [__("Approved"), "green", "application_status,=,Approved"]; + } + else if (doc.application_status=="Rejected") { + return [__("Rejected"), "red", "application_status,=,Rejected"]; + } + else if (doc.application_status=="Admitted") { + return [__("Admitted"), "blue", "application_status,=,Admitted"]; + } + } +}; \ No newline at end of file diff --git a/erpnext/schools/doctype/student_applicant/test_student_applicant.py b/erpnext/schools/doctype/student_applicant/test_student_applicant.py new file mode 100644 index 0000000000..9734a88b93 --- /dev/null +++ b/erpnext/schools/doctype/student_applicant/test_student_applicant.py @@ -0,0 +1,12 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2015, Frappe Technologies and Contributors +# See license.txt +from __future__ import unicode_literals + +import frappe +import unittest + +# test_records = frappe.get_test_records('Student Applicant') + +class TestStudentApplicant(unittest.TestCase): + pass diff --git a/erpnext/schools/doctype/student_attendance/__init__.py b/erpnext/schools/doctype/student_attendance/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/erpnext/schools/doctype/student_attendance/student_attendance.json b/erpnext/schools/doctype/student_attendance/student_attendance.json new file mode 100644 index 0000000000..bdeac7adc3 --- /dev/null +++ b/erpnext/schools/doctype/student_attendance/student_attendance.json @@ -0,0 +1,209 @@ +{ + "allow_copy": 0, + "allow_import": 1, + "allow_rename": 0, + "autoname": "SA.######", + "creation": "2015-11-05 15:20:23.045996", + "custom": 0, + "docstatus": 0, + "doctype": "DocType", + "document_type": "Document", + "fields": [ + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "fieldname": "student", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, + "label": "Student", + "no_copy": 0, + "options": "Student", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 1, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "fieldname": "student_name", + "fieldtype": "Read Only", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, + "label": "Student Name", + "no_copy": 0, + "options": "student.title", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "fieldname": "column_break_3", + "fieldtype": "Column Break", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "fieldname": "course_schedule", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 1, + "label": "Course Schedule", + "no_copy": 0, + "options": "Course Schedule", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 1, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "default": "Present", + "fieldname": "status", + "fieldtype": "Select", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 1, + "label": "Status", + "no_copy": 0, + "options": "Present\nAbsent", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 1, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "fieldname": "amended_from", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, + "label": "Amended From", + "no_copy": 1, + "options": "Student Attendance", + "permlevel": 0, + "print_hide": 1, + "read_only": 1, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + } + ], + "hide_heading": 0, + "hide_toolbar": 0, + "in_create": 0, + "in_dialog": 0, + "is_submittable": 1, + "issingle": 0, + "istable": 0, + "modified": "2016-07-18 10:30:50.243271", + "modified_by": "Administrator", + "module": "Schools", + "name": "Student Attendance", + "name_case": "", + "owner": "Administrator", + "permissions": [ + { + "amend": 1, + "apply_user_permissions": 0, + "cancel": 1, + "create": 1, + "delete": 1, + "email": 1, + "export": 1, + "if_owner": 0, + "import": 0, + "permlevel": 0, + "print": 1, + "read": 1, + "report": 1, + "role": "Academics User", + "set_user_permissions": 0, + "share": 1, + "submit": 1, + "write": 1 + }, + { + "amend": 1, + "apply_user_permissions": 0, + "cancel": 1, + "create": 1, + "delete": 1, + "email": 1, + "export": 1, + "if_owner": 0, + "import": 0, + "permlevel": 0, + "print": 1, + "read": 1, + "report": 1, + "role": "Administrator", + "set_user_permissions": 0, + "share": 1, + "submit": 1, + "write": 1 + } + ], + "read_only": 0, + "read_only_onload": 0, + "sort_field": "modified", + "sort_order": "DESC", + "title_field": "student_name" +} \ No newline at end of file diff --git a/erpnext/schools/doctype/student_attendance/student_attendance.py b/erpnext/schools/doctype/student_attendance/student_attendance.py new file mode 100644 index 0000000000..65dbd68dbe --- /dev/null +++ b/erpnext/schools/doctype/student_attendance/student_attendance.py @@ -0,0 +1,21 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2015, Frappe Technologies and contributors +# For license information, please see license.txt + +from __future__ import unicode_literals +import frappe +from frappe.model.document import Document +from frappe import _ + +class StudentAttendance(Document): + def validate(self): + self.validate_duplication() + + def validate_duplication(self): + """Check if the Attendance Record is Unique""" + attendance_records= frappe.db.sql("""select name from `tabStudent Attendance` where \ + student= %s and course_schedule= %s and name != %s""", + (self.student, self.course_schedule, self.name)) + if attendance_records: + frappe.throw(_("Attendance Record {0} exists against Student {1} for Course Schedule {2}") + .format(attendance_records[0][0], self.student, self.course_schedule)) diff --git a/erpnext/schools/doctype/student_attendance/student_attendance_list.js b/erpnext/schools/doctype/student_attendance/student_attendance_list.js new file mode 100644 index 0000000000..0d3e7ade15 --- /dev/null +++ b/erpnext/schools/doctype/student_attendance/student_attendance_list.js @@ -0,0 +1,11 @@ +frappe.listview_settings['Student Attendance'] = { + add_fields: [ "status"], + get_indicator: function(doc) { + if (doc.status=="Absent") { + return [__("Absent"), "orange", "status,=,Absent"]; + } + else if (doc.status=="Present") { + return [__("Present"), "green", "status,=,Present"]; + } + } +}; \ No newline at end of file diff --git a/erpnext/schools/doctype/student_attendance/test_student_attendance.py b/erpnext/schools/doctype/student_attendance/test_student_attendance.py new file mode 100644 index 0000000000..9f4153845b --- /dev/null +++ b/erpnext/schools/doctype/student_attendance/test_student_attendance.py @@ -0,0 +1,12 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2015, Frappe Technologies and Contributors +# See license.txt +from __future__ import unicode_literals + +import frappe +import unittest + +# test_records = frappe.get_test_records('Student Attendance') + +class TestStudentAttendance(unittest.TestCase): + pass diff --git a/erpnext/schools/doctype/student_attendance/untitled.txt b/erpnext/schools/doctype/student_attendance/untitled.txt new file mode 100644 index 0000000000..b2f4c36837 --- /dev/null +++ b/erpnext/schools/doctype/student_attendance/untitled.txt @@ -0,0 +1,20 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2015, Frappe Technologies and contributors +# For license information, please see license.txt + +from __future__ import unicode_literals +import frappe +from frappe.model.document import Document +from frappe import _ + +class Studentattendance(Document): + def validate(self): + self.validate_duplication() + + def validate_duplication(self): + attendance_records= frappe.db.sql("""select name from `tabStudent attendance` where \ + student= %s and course_schedule= %s and name != %s""", + (self.student, self.course_schedule, self.name)) + if attendance_records: + frappe.throw(_("attendance Record {0} exists against Student {1} for Course Schedule {2}") + .format(attendance_records[0][0], self.student, self.course_schedule)) diff --git a/erpnext/schools/doctype/student_group/__init__.py b/erpnext/schools/doctype/student_group/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/erpnext/schools/doctype/student_group/student_group.js b/erpnext/schools/doctype/student_group/student_group.js new file mode 100644 index 0000000000..a993ff79c3 --- /dev/null +++ b/erpnext/schools/doctype/student_group/student_group.js @@ -0,0 +1,19 @@ +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"); + }); + + frm.add_custom_button(__("Examination"), function() { + frappe.route_options = { + student_group: frm.doc.name + } + frappe.set_route("List", "Examination"); + }); + } +}); \ No newline at end of file diff --git a/erpnext/schools/doctype/student_group/student_group.json b/erpnext/schools/doctype/student_group/student_group.json new file mode 100644 index 0000000000..38a7747515 --- /dev/null +++ b/erpnext/schools/doctype/student_group/student_group.json @@ -0,0 +1,324 @@ +{ + "allow_copy": 0, + "allow_import": 0, + "allow_rename": 0, + "autoname": "field:group_name", + "creation": "2015-09-07 12:55:52.072792", + "custom": 0, + "docstatus": 0, + "doctype": "DocType", + "document_type": "Document", + "fields": [ + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "fieldname": "group_name", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, + "label": "Group Name", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 1, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "fieldname": "academic_term", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 1, + "label": "Academic Term", + "length": 0, + "no_copy": 0, + "options": "Academic Term", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 1, + "unique": 0 + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "fieldname": "academic_year", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 1, + "label": "Academic Year", + "length": 0, + "no_copy": 0, + "options": "Academic Year", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 1, + "unique": 0 + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "fieldname": "column_break_3", + "fieldtype": "Column Break", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "fieldname": "program", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, + "label": "Program", + "length": 0, + "no_copy": 0, + "options": "Program", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 1, + "unique": 0 + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "fieldname": "course", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 1, + "label": "Course", + "length": 0, + "no_copy": 0, + "options": "Course", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 1, + "search_index": 0, + "set_only_once": 1, + "unique": 0 + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "description": "Set 0 for no limit", + "fieldname": "max_strength", + "fieldtype": "Int", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, + "label": "Max Strength", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 1, + "collapsible_depends_on": "", + "fieldname": "section_break_6", + "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, + "label": "Students", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 1, + "bold": 0, + "collapsible": 0, + "fieldname": "students", + "fieldtype": "Table", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, + "label": "Students", + "length": 0, + "no_copy": 0, + "options": "Student Group Student", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "fieldname": "amended_from", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, + "label": "Amended From", + "length": 0, + "no_copy": 1, + "options": "Student Group", + "permlevel": 0, + "print_hide": 1, + "print_hide_if_no_value": 0, + "read_only": 1, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + } + ], + "hide_heading": 0, + "hide_toolbar": 0, + "idx": 0, + "in_create": 0, + "in_dialog": 0, + "is_submittable": 0, + "issingle": 0, + "istable": 0, + "max_attachments": 0, + "menu_index": 0, + "modified": "2016-07-18 10:30:50.243271", + "modified_by": "Administrator", + "module": "Schools", + "name": "Student Group", + "name_case": "", + "owner": "Administrator", + "permissions": [ + { + "amend": 0, + "apply_user_permissions": 0, + "cancel": 0, + "create": 1, + "delete": 1, + "email": 1, + "export": 1, + "if_owner": 0, + "import": 0, + "permlevel": 0, + "print": 1, + "read": 1, + "report": 1, + "role": "Academics User", + "set_user_permissions": 0, + "share": 1, + "submit": 0, + "write": 1 + }, + { + "amend": 0, + "apply_user_permissions": 0, + "cancel": 0, + "create": 1, + "delete": 1, + "email": 1, + "export": 0, + "if_owner": 0, + "import": 0, + "permlevel": 0, + "print": 1, + "read": 1, + "report": 1, + "role": "Administrator", + "set_user_permissions": 0, + "share": 1, + "submit": 0, + "write": 1 + } + ], + "read_only": 0, + "read_only_onload": 0, + "search_fields": "program, course", + "sort_field": "modified", + "sort_order": "DESC", + "title_field": "group_name", + "version": 0 +} \ No newline at end of file diff --git a/erpnext/schools/doctype/student_group/student_group.py b/erpnext/schools/doctype/student_group/student_group.py new file mode 100644 index 0000000000..0acbed9294 --- /dev/null +++ b/erpnext/schools/doctype/student_group/student_group.py @@ -0,0 +1,21 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2015, Frappe Technologies and contributors +# For license information, please see license.txt + +from __future__ import unicode_literals +import frappe +from frappe.model.document import Document +from frappe import _ + +class StudentGroup(Document): + def validate(self): + self.validate_strength() + self.validate_student_name() + + def validate_strength(self): + if self.max_strength and len(self.students) > self.max_strength: + frappe.throw(_("""Cannot enroll more than {0} students for this student group.""").format(self.max_strength)) + + def validate_student_name(self): + for d in self.students: + d.student_name = frappe.db.get_value("Student", d.student, "title") diff --git a/erpnext/schools/doctype/student_group/test_records.json b/erpnext/schools/doctype/student_group/test_records.json new file mode 100644 index 0000000000..23186caf4d --- /dev/null +++ b/erpnext/schools/doctype/student_group/test_records.json @@ -0,0 +1,16 @@ +[ + { + "group_name": "_Test Student Group", + "program": "_Test Program", + "course": "_Test Course", + "academic_year": "2014-2015", + "academic_term": "_Test Academic Term" + }, + { + "group_name": "_Test Student Group 1", + "program": "_Test Program", + "course": "_Test Course 2", + "academic_year": "2014-2015", + "academic_term": "_Test Academic Term" + } +] \ No newline at end of file diff --git a/erpnext/schools/doctype/student_group/test_student_group.py b/erpnext/schools/doctype/student_group/test_student_group.py new file mode 100644 index 0000000000..6b599aa265 --- /dev/null +++ b/erpnext/schools/doctype/student_group/test_student_group.py @@ -0,0 +1,12 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2015, Frappe Technologies and Contributors +# See license.txt +from __future__ import unicode_literals + +import frappe +import unittest + +# test_records = frappe.get_test_records('Student Group') + +class TestStudentGroup(unittest.TestCase): + pass diff --git a/erpnext/schools/doctype/student_group_creation_tool/__init__.py b/erpnext/schools/doctype/student_group_creation_tool/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/erpnext/schools/doctype/student_group_creation_tool/student_group_creation_tool.js b/erpnext/schools/doctype/student_group_creation_tool/student_group_creation_tool.js new file mode 100644 index 0000000000..056574ca37 --- /dev/null +++ b/erpnext/schools/doctype/student_group_creation_tool/student_group_creation_tool.js @@ -0,0 +1,23 @@ +frappe.ui.form.on("Student Group Creation Tool", "refresh", function(frm) { + frm.disable_save(); + frm.page.set_primary_action(__("Create Student Groups"), function() { + frappe.call({ + method: "create_student_groups", + doc:frm.doc + }) + }); + +}); + +frappe.ui.form.on("Student Group Creation Tool", "get_courses", function(frm) { + frm.set_value("courses",[]); + frappe.call({ + method: "get_courses", + doc:frm.doc, + callback: function(r) { + if(r.message) { + frm.set_value("courses", r.message); + } + } + }) +}); \ No newline at end of file diff --git a/erpnext/schools/doctype/student_group_creation_tool/student_group_creation_tool.json b/erpnext/schools/doctype/student_group_creation_tool/student_group_creation_tool.json new file mode 100644 index 0000000000..2c53b700a4 --- /dev/null +++ b/erpnext/schools/doctype/student_group_creation_tool/student_group_creation_tool.json @@ -0,0 +1,252 @@ +{ + "allow_copy": 1, + "allow_import": 0, + "allow_rename": 0, + "creation": "2016-01-04 14:45:36.576933", + "custom": 0, + "docstatus": 0, + "doctype": "DocType", + "document_type": "", + "fields": [ + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "fieldname": "academic_year", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 0, + "label": "Academic Year", + "length": 0, + "no_copy": 0, + "options": "Academic Year", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 1, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "fieldname": "academic_term", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 0, + "label": "Academic Term", + "length": 0, + "no_copy": 0, + "options": "Academic Term", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 1, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "fieldname": "get_courses", + "fieldtype": "Button", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 0, + "label": "Get Courses", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "fieldname": "column_break_4", + "fieldtype": "Column Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 0, + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "description": "Leave blank if you wish to fetch all courses for selected academic term", + "fieldname": "program", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 0, + "label": "Program", + "length": 0, + "no_copy": 0, + "options": "Program", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "fieldname": "section_break_4", + "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 0, + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "fieldname": "courses", + "fieldtype": "Table", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 0, + "label": "Courses", + "length": 0, + "no_copy": 0, + "options": "SG Creation Tool Course", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 1, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + } + ], + "hide_heading": 1, + "hide_toolbar": 1, + "idx": 0, + "in_create": 0, + "in_dialog": 0, + "is_submittable": 0, + "issingle": 1, + "istable": 0, + "max_attachments": 0, + "modified": "2016-07-18 10:30:50.243271", + "modified_by": "demo@erpnext.com", + "module": "Schools", + "name": "Student Group Creation Tool", + "name_case": "", + "owner": "Administrator", + "permissions": [ + { + "amend": 0, + "apply_user_permissions": 0, + "cancel": 0, + "create": 1, + "delete": 0, + "email": 0, + "export": 0, + "if_owner": 0, + "import": 0, + "permlevel": 0, + "print": 0, + "read": 1, + "report": 0, + "role": "Administrator", + "set_user_permissions": 0, + "share": 0, + "submit": 0, + "write": 1 + }, + { + "amend": 0, + "apply_user_permissions": 0, + "cancel": 0, + "create": 1, + "delete": 0, + "email": 0, + "export": 0, + "if_owner": 0, + "import": 0, + "permlevel": 0, + "print": 0, + "read": 1, + "report": 0, + "role": "Academics User", + "set_user_permissions": 0, + "share": 0, + "submit": 0, + "write": 1 + } + ], + "read_only": 0, + "read_only_onload": 0, + "sort_field": "modified", + "sort_order": "DESC", + "track_seen": 0 +} \ No newline at end of file diff --git a/erpnext/schools/doctype/student_group_creation_tool/student_group_creation_tool.py b/erpnext/schools/doctype/student_group_creation_tool/student_group_creation_tool.py new file mode 100644 index 0000000000..65cf755c61 --- /dev/null +++ b/erpnext/schools/doctype/student_group_creation_tool/student_group_creation_tool.py @@ -0,0 +1,48 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2015, Frappe and contributors +# For license information, please see license.txt + +from __future__ import unicode_literals +import frappe +from frappe import _ +from frappe.model.document import Document + +class StudentGroupCreationTool(Document): + def get_courses(self): + if self.program: + courses = frappe.db.sql("""select course, course_code, parent as program, "student_group_name" + from `tabProgram Course` where academic_term= %s and parent= %s""", + (self.academic_term, self.program), as_dict=1) + else: + courses = frappe.db.sql("""select course, course_code, parent as program, "student_group_name" + from `tabProgram Course` where academic_term= %s""", + self.academic_term, as_dict=1) + + for d in courses: + if d.course_code: + d.student_group_name = d.course_code + "-" + self.academic_year + else: + d.student_group_name = None + + return courses + + def create_student_groups(self): + if not self.courses: + frappe.throw(_("""No Student Groups created.""")) + + for d in self.courses: + if not d.course: + frappe.throw(_("""Course is mandatory in row {0}""".format(d.idx))) + + if not d.student_group_name: + frappe.throw(_("""Student Group Name is mandatory in row {0}""".format(d.idx))) + + student_group = frappe.new_doc("Student Group") + student_group.group_name = d.student_group_name + student_group.course = d.course + student_group.max_strength = d.max_strength + student_group.academic_term = self.academic_term + student_group.academic_year = self.academic_year + student_group.save() + + frappe.msgprint(_("Student Groups created.")) diff --git a/erpnext/schools/doctype/student_group_student/__init__.py b/erpnext/schools/doctype/student_group_student/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/erpnext/schools/doctype/student_group_student/student_group_student.json b/erpnext/schools/doctype/student_group_student/student_group_student.json new file mode 100644 index 0000000000..1d8a9bb013 --- /dev/null +++ b/erpnext/schools/doctype/student_group_student/student_group_student.json @@ -0,0 +1,96 @@ +{ + "allow_copy": 0, + "allow_import": 0, + "allow_rename": 0, + "creation": "2015-09-11 15:14:58.501830", + "custom": 0, + "docstatus": 0, + "doctype": "DocType", + "document_type": "", + "fields": [ + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "fieldname": "student", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 1, + "label": "Student", + "no_copy": 0, + "options": "Student", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 1, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "fieldname": "column_break_2", + "fieldtype": "Column Break", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "fieldname": "student_name", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 1, + "label": "Student Name", + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "read_only": 1, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + } + ], + "hide_heading": 0, + "hide_toolbar": 0, + "in_create": 0, + "in_dialog": 0, + "is_submittable": 0, + "issingle": 0, + "istable": 1, + "modified": "2016-07-18 10:30:50.243271", + "modified_by": "Administrator", + "module": "Schools", + "name": "Student Group Student", + "name_case": "", + "owner": "Administrator", + "permissions": [], + "read_only": 0, + "read_only_onload": 0, + "sort_field": "modified", + "sort_order": "DESC" +} \ No newline at end of file diff --git a/erpnext/schools/doctype/student_group_student/student_group_student.py b/erpnext/schools/doctype/student_group_student/student_group_student.py new file mode 100644 index 0000000000..1fe4ea1dc3 --- /dev/null +++ b/erpnext/schools/doctype/student_group_student/student_group_student.py @@ -0,0 +1,10 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2015, Frappe Technologies and contributors +# For license information, please see license.txt + +from __future__ import unicode_literals +import frappe +from frappe.model.document import Document + +class StudentGroupStudent(Document): + pass diff --git a/erpnext/schools/doctype/topic/__init__.py b/erpnext/schools/doctype/topic/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/erpnext/schools/doctype/topic/test_topic.py b/erpnext/schools/doctype/topic/test_topic.py new file mode 100644 index 0000000000..1d2974ed7f --- /dev/null +++ b/erpnext/schools/doctype/topic/test_topic.py @@ -0,0 +1,12 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2015, Frappe and Contributors +# See license.txt +from __future__ import unicode_literals + +import frappe +import unittest + +# test_records = frappe.get_test_records('Topic') + +class TestTopic(unittest.TestCase): + pass diff --git a/erpnext/schools/doctype/topic/topic.js b/erpnext/schools/doctype/topic/topic.js new file mode 100644 index 0000000000..bd9379dfad --- /dev/null +++ b/erpnext/schools/doctype/topic/topic.js @@ -0,0 +1,8 @@ +// Copyright (c) 2016, Frappe and contributors +// For license information, please see license.txt + +frappe.ui.form.on('Topic', { + refresh: function(frm) { + + } +}); diff --git a/erpnext/schools/doctype/topic/topic.json b/erpnext/schools/doctype/topic/topic.json new file mode 100644 index 0000000000..6aedc1e54e --- /dev/null +++ b/erpnext/schools/doctype/topic/topic.json @@ -0,0 +1,160 @@ +{ + "allow_copy": 0, + "allow_import": 0, + "allow_rename": 1, + "autoname": "Topic.####", + "beta": 0, + "creation": "2016-06-28 07:06:38.749398", + "custom": 0, + "docstatus": 0, + "doctype": "DocType", + "document_type": "Document", + "fields": [ + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "fieldname": "course", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 1, + "label": "Course", + "length": 0, + "no_copy": 0, + "options": "Course", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 1, + "search_index": 1, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "fieldname": "topic_name", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 1, + "label": "Topic Name", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 1, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "fieldname": "introduction", + "fieldtype": "Text", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 0, + "label": "Introduction", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 1, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "fieldname": "content", + "fieldtype": "Text Editor", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 0, + "label": "Content", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 1, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + } + ], + "hide_heading": 0, + "hide_toolbar": 0, + "idx": 0, + "image_view": 0, + "in_create": 0, + "in_dialog": 0, + "is_submittable": 0, + "issingle": 0, + "istable": 0, + "max_attachments": 0, + "modified": "2016-07-18 10:30:50.243271", + "modified_by": "Administrator", + "module": "Schools", + "name": "Topic", + "name_case": "", + "owner": "Administrator", + "permissions": [ + { + "amend": 0, + "apply_user_permissions": 0, + "cancel": 0, + "create": 1, + "delete": 1, + "email": 1, + "export": 1, + "if_owner": 0, + "import": 0, + "permlevel": 0, + "print": 1, + "read": 1, + "report": 1, + "role": "Academics User", + "set_user_permissions": 0, + "share": 1, + "submit": 0, + "write": 1 + } + ], + "quick_entry": 1, + "read_only": 0, + "read_only_onload": 0, + "sort_field": "modified", + "sort_order": "DESC", + "title_field": "course", + "track_seen": 0 +} \ No newline at end of file diff --git a/erpnext/schools/doctype/topic/topic.py b/erpnext/schools/doctype/topic/topic.py new file mode 100644 index 0000000000..5dba561681 --- /dev/null +++ b/erpnext/schools/doctype/topic/topic.py @@ -0,0 +1,49 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2015, Frappe and contributors +# For license information, please see license.txt + +from __future__ import unicode_literals +import frappe +from frappe.model.document import Document +from frappe import _ + +class Topic(Document): + pass + +def get_topic_list(doctype, txt, filters, limit_start, limit_page_length=20): + user = frappe.session.user + student = frappe.db.sql("select name from `tabStudent` where student_email_id= %s", user) + if student: + data = frappe. db.sql('''select name, course, modified,topic_name, introduction, content from `tabTopic` as topic + where topic.course = %s + order by idx asc limit {0} , {1}'''.format(limit_start, limit_page_length),filters.course,as_dict = True) + + for topic in data: + try: + num_attachments = frappe.db.sql(""" select count(file_url) from tabFile as file + where file.attached_to_name=%s + and file.attached_to_doctype=%s""",(topic.name,"Topic")) + + except IOError or frappe.DoesNotExistError: + pass + frappe.local.message_log.pop() + + topic.num_attachments = num_attachments[0][0] + + return data + +def get_list_context(context=None): + course = frappe.get_doc('Course', frappe.form_dict.course) + portal_items = [{'reference_doctype': u'Topic', 'route': u"/topic?course=" + str(course.name), 'show_always': 0L, 'title': u'Topics'}, + {'reference_doctype': u'Discussion', 'route': u"/discussion?course=" + str(course.name), 'show_always': 0L, 'title': u'Discussions'}, + + ] + return { + "show_sidebar": True, + "title": _("Topic"), + 'no_breadcrumbs': True, + "sidebar_items" : portal_items, + "sidebar_title" : course.name, + "get_list": get_topic_list, + "row_template": "templates/includes/topic/topic_row.html" + } \ No newline at end of file diff --git a/erpnext/schools/report/__init__.py b/erpnext/schools/report/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/erpnext/schools/report/student_fee_collection/__init__.py b/erpnext/schools/report/student_fee_collection/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/erpnext/schools/report/student_fee_collection/student_fee_collection.json b/erpnext/schools/report/student_fee_collection/student_fee_collection.json new file mode 100644 index 0000000000..d4afcb94c1 --- /dev/null +++ b/erpnext/schools/report/student_fee_collection/student_fee_collection.json @@ -0,0 +1,19 @@ +{ + "add_total_row": 0, + "apply_user_permissions": 1, + "creation": "2016-06-22 02:58:41.024538", + "disabled": 0, + "docstatus": 0, + "doctype": "Report", + "idx": 0, + "is_standard": "Yes", + "modified": "2016-07-18 02:58:42.727096", + "modified_by": "Administrator", + "module": "Schools", + "name": "Student Fee Collection", + "owner": "Administrator", + "query": "SELECT\n student as \"Student:Link/Student:200\",\n student_name as \"Student Name::200\",\n sum(paid_amount) as \"Paid Amount:Currency:150\",\n sum(outstanding_amount) as \"Outstanding Amount:Currency:150\",\n sum(total_amount) as \"Total Amount:Currency:150\"\nFROM\n `tabFees` \nGROUP BY\n student", + "ref_doctype": "Fees", + "report_name": "Student Fee Collection", + "report_type": "Query Report" +} \ No newline at end of file diff --git a/erpnext/schools/utils.py b/erpnext/schools/utils.py new file mode 100644 index 0000000000..c7e92c2c42 --- /dev/null +++ b/erpnext/schools/utils.py @@ -0,0 +1,44 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2015, Frappe Technologies and contributors +# For lice + +from __future__ import unicode_literals +import frappe +from frappe import _ + +class OverlapError(frappe.ValidationError): pass + +def validate_overlap_for(doc, doctype, fieldname, value=None): + """Checks overlap for specified feild. + + :param fieldname: Checks Overlap for this feild + """ + + existing = get_overlap_for(doc, doctype, fieldname, value) + if existing: + frappe.throw(_("This {0} conflicts with {1} for {2} {3}").format(doc.doctype, existing.name, + doc.meta.get_label(fieldname) if not value else fieldname , value or doc.get(fieldname)), OverlapError) + +def get_overlap_for(doc, doctype, fieldname, value=None): + """Returns overlaping document for specified feild. + + :param fieldname: Checks Overlap for this feild + """ + + existing = frappe.db.sql("""select name, from_time, to_time from `tab{0}` + where `{1}`=%(val)s and schedule_date = %(schedule_date)s and + ( + (from_time > %(from_time)s and from_time < %(to_time)s) or + (to_time > %(from_time)s and to_time < %(to_time)s) or + (%(from_time)s > from_time and %(from_time)s < to_time) or + (%(from_time)s = from_time and %(to_time)s = to_time)) + and name!=%(name)s""".format(doctype, fieldname), + { + "schedule_date": doc.schedule_date, + "val": value or doc.get(fieldname), + "from_time": doc.from_time, + "to_time": doc.to_time, + "name": doc.name or "No Name" + }, as_dict=True) + + return existing[0] if existing else None diff --git a/erpnext/schools/web_form/__init__.py b/erpnext/schools/web_form/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/erpnext/schools/web_form/discussion/__init__.py b/erpnext/schools/web_form/discussion/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/erpnext/schools/web_form/discussion/discussion.js b/erpnext/schools/web_form/discussion/discussion.js new file mode 100644 index 0000000000..4130b0c4bd --- /dev/null +++ b/erpnext/schools/web_form/discussion/discussion.js @@ -0,0 +1,4 @@ +frappe.ready(function() { + var form = $('form[data-web-form="discussion"]'), + owner = form.attr('data-owner'); +}) \ No newline at end of file diff --git a/erpnext/schools/web_form/discussion/discussion.json b/erpnext/schools/web_form/discussion/discussion.json new file mode 100644 index 0000000000..4a781d19d8 --- /dev/null +++ b/erpnext/schools/web_form/discussion/discussion.json @@ -0,0 +1,49 @@ +{ + "allow_comments": 1, + "allow_delete": 1, + "allow_edit": 1, + "allow_multiple": 1, + "creation": "2016-06-26 20:46:09.598755", + "doc_type": "Discussion", + "docstatus": 0, + "doctype": "Web Form", + "idx": 0, + "is_standard": 1, + "login_required": 1, + "modified": "2016-07-19 07:55:37.826664", + "modified_by": "Administrator", + "module": "Schools", + "name": "discussion", + "owner": "Administrator", + "published": 1, + "route": "discussion", + "success_url": "", + "title": "Discussion", + "web_form_fields": [ + { + "fieldname": "course", + "fieldtype": "Data", + "hidden": 0, + "label": "Course", + "options": "Course", + "read_only": 1, + "reqd": 0 + }, + { + "fieldname": "subject", + "fieldtype": "Text", + "hidden": 0, + "label": "Subject", + "read_only": 0, + "reqd": 1 + }, + { + "fieldname": "description", + "fieldtype": "Text", + "hidden": 0, + "label": "Description", + "read_only": 0, + "reqd": 0 + } + ] +} \ No newline at end of file diff --git a/erpnext/schools/web_form/discussion/discussion.py b/erpnext/schools/web_form/discussion/discussion.py new file mode 100644 index 0000000000..23ff05272f --- /dev/null +++ b/erpnext/schools/web_form/discussion/discussion.py @@ -0,0 +1,9 @@ +from __future__ import unicode_literals + +import frappe + +def get_context(context=None): + pass + +def has_website_permission(doc, ptype, user, verbose=False): + return True \ No newline at end of file diff --git a/erpnext/templates/includes/announcement/announcement_row.html b/erpnext/templates/includes/announcement/announcement_row.html new file mode 100644 index 0000000000..d807bfc530 --- /dev/null +++ b/erpnext/templates/includes/announcement/announcement_row.html @@ -0,0 +1,34 @@ + + + diff --git a/erpnext/templates/includes/course/course_row.html b/erpnext/templates/includes/course/course_row.html new file mode 100644 index 0000000000..9b9317b60a --- /dev/null +++ b/erpnext/templates/includes/course/course_row.html @@ -0,0 +1,18 @@ + diff --git a/erpnext/templates/includes/course/macros.html b/erpnext/templates/includes/course/macros.html new file mode 100644 index 0000000000..c80dca4bcc --- /dev/null +++ b/erpnext/templates/includes/course/macros.html @@ -0,0 +1 @@ +{% macro back_link(doc) %}&back-to=/courses?course={{ doc.name }}&back-to-title={{ doc.course_name }}{% endmacro %} \ No newline at end of file diff --git a/erpnext/templates/includes/discussion/discussion_row.html b/erpnext/templates/includes/discussion/discussion_row.html new file mode 100644 index 0000000000..7bec3cc665 --- /dev/null +++ b/erpnext/templates/includes/discussion/discussion_row.html @@ -0,0 +1,9 @@ + diff --git a/erpnext/templates/includes/examination/examination_row.html b/erpnext/templates/includes/examination/examination_row.html new file mode 100644 index 0000000000..a33ccffc36 --- /dev/null +++ b/erpnext/templates/includes/examination/examination_row.html @@ -0,0 +1,19 @@ +
+
+
+ {{ doc.course }} +
+
+ {{ doc.room }} +
+
+ {{doc.schedule_date }} +
+
+ {{ doc.from_time }} +
+
+ {{ doc.to_time }} +
+
+
diff --git a/erpnext/templates/includes/fee/fee_row.html b/erpnext/templates/includes/fee/fee_row.html new file mode 100644 index 0000000000..ac2b1006ad --- /dev/null +++ b/erpnext/templates/includes/fee/fee_row.html @@ -0,0 +1,18 @@ + diff --git a/erpnext/templates/includes/topic/topic_row.html b/erpnext/templates/includes/topic/topic_row.html new file mode 100644 index 0000000000..3401bd3937 --- /dev/null +++ b/erpnext/templates/includes/topic/topic_row.html @@ -0,0 +1,9 @@ + \ No newline at end of file diff --git a/erpnext/templates/pages/announcements.html b/erpnext/templates/pages/announcements.html new file mode 100644 index 0000000000..d6e0d734ca --- /dev/null +++ b/erpnext/templates/pages/announcements.html @@ -0,0 +1,20 @@ +{% extends "templates/web.html" %} + +{% block header %} +

{{doc.subject}}

+{% endblock %} + +{% block page_content %} + +

{{doc.description}}

+

+ {% for file in attached_files%} + {{file.file_name}} +
+ {% endfor %} +
+ {{ doc.posted_by }} + {{ frappe.format_date(doc.modified) }} +

+ +{% endblock %} \ No newline at end of file diff --git a/erpnext/templates/pages/announcements.py b/erpnext/templates/pages/announcements.py new file mode 100644 index 0000000000..4a61fc8ccc --- /dev/null +++ b/erpnext/templates/pages/announcements.py @@ -0,0 +1,18 @@ +# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors +# License: GNU General Public License v3. See license.txt + +from __future__ import unicode_literals +import frappe + +def get_context(context): + announcement = frappe.get_doc('Announcement', frappe.form_dict.announcement) + context.no_cache = 1 + context.show_sidebar = True + announcement.has_permission('read') + context.doc = announcement + attachments = frappe.db.sql("""select file_url, file_name from tabFile as file + where file.attached_to_name=%s """,(announcement.name), as_dict = True) + + context.attached_files = attachments + + diff --git a/erpnext/templates/pages/courses.html b/erpnext/templates/pages/courses.html new file mode 100644 index 0000000000..42e7f3e70b --- /dev/null +++ b/erpnext/templates/pages/courses.html @@ -0,0 +1,11 @@ +{% extends "templates/web.html" %} + +{% block header %} +

About

+{% endblock %} + +{% block page_content %} + +

{{ intro }}

+ +{% endblock %} \ No newline at end of file diff --git a/erpnext/templates/pages/courses.py b/erpnext/templates/pages/courses.py new file mode 100644 index 0000000000..5b1410efbd --- /dev/null +++ b/erpnext/templates/pages/courses.py @@ -0,0 +1,28 @@ +# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors +# License: GNU General Public License v3. See license.txt + +from __future__ import unicode_literals +import frappe + + + +def get_context(context): + course = frappe.get_doc('Course', frappe.form_dict.course) + sidebar_title = course.name + + context.no_cache = 1 + context.show_sidebar = True + course = frappe.get_doc('Course', frappe.form_dict.course) + course.has_permission('read') + context.doc = course + portal_items = [{'reference_doctype': u'Topic', 'route': u"/topic?course=" + str(course.name), 'show_always': 0L, 'title': u'Topics'}, + {'reference_doctype': u'Discussion', 'route': u"/discussion?course=" + str(course.name), 'show_always': 0L, 'title': u'Discussions'}, + + ] + + context.sidebar_items = portal_items + + context.sidebar_title = sidebar_title + + context.intro = course.course_intro + diff --git a/erpnext/templates/pages/discussions.html b/erpnext/templates/pages/discussions.html new file mode 100644 index 0000000000..28eb01fd65 --- /dev/null +++ b/erpnext/templates/pages/discussions.html @@ -0,0 +1,15 @@ +{% extends "templates/web.html" %} + +{% block header %} +

{{doc.subject}}

+

{{doc.description}}

+

Started by: {{doc.owner}}

+{% endblock %} + +{% block page_content %} + +
+ {% include 'templates/includes/comments/comments.html' %} +
+ +{% endblock %} diff --git a/erpnext/templates/pages/discussions.py b/erpnext/templates/pages/discussions.py new file mode 100644 index 0000000000..22a1bef079 --- /dev/null +++ b/erpnext/templates/pages/discussions.py @@ -0,0 +1,21 @@ +# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors +# License: GNU General Public License v3. See license.txt + +from __future__ import unicode_literals +import frappe +from frappe.website.utils import get_comment_list + +def get_context(context): + context.doc = frappe.get_doc('Discussion', frappe.form_dict.discussion) + portal_items = [{'reference_doctype': u'Topic', 'route': u"/topic?course=" + str(context.doc.course), 'show_always': 0L, 'title': u'Topics'}, + {'reference_doctype': u'Discussion', 'route': u"/discussion?course=" + str(context.doc.course), 'show_always': 0L, 'title': u'Discussions'}, + + ] + context.show_sidebar = True + context.sidebar_items = portal_items + context.no_cache = 1 + context.doc.has_permission('read') + context.sidebar_title = context.doc.course + context.reference_doctype = "Discussion" + context.reference_name = context.doc.name + context.comment_list = get_comment_list(context.doc.doctype,context.doc.name) \ No newline at end of file diff --git a/erpnext/templates/pages/topics.html b/erpnext/templates/pages/topics.html new file mode 100644 index 0000000000..94d7a1731a --- /dev/null +++ b/erpnext/templates/pages/topics.html @@ -0,0 +1,12 @@ +{% extends "templates/web.html" %} + + +{% block header %} +

{{ doc.introduction }}

+{% endblock %} + +{% block page_content %} + +

{{ doc.content }}

+ +{% endblock %} \ No newline at end of file diff --git a/erpnext/templates/pages/topics.py b/erpnext/templates/pages/topics.py new file mode 100644 index 0000000000..8a55b640e7 --- /dev/null +++ b/erpnext/templates/pages/topics.py @@ -0,0 +1,15 @@ +# License: GNU General Public License v3. See license.txt + +from __future__ import unicode_literals +import frappe + + +def get_context(context): + topic = frappe.get_doc('Topic', frappe.form_dict.topic) + context.no_cache = 1 + context.show_sidebar = True + context.doc = topic + attachments = frappe.db.sql("""select file_url, file_name from tabFile as file + where file.attached_to_name=%s """,(topic.name), as_dict = True) + + context.attached_files = attachments From 20038ad2c940ae128e013d708d5284d58a1ba41e Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Thu, 21 Jul 2016 16:01:59 +0530 Subject: [PATCH 2/2] [fixes] setup wizard and domainify for schools; --- erpnext/config/desktop.py | 106 ++++++++++ erpnext/config/schools.py | 110 +++++++++++ erpnext/patches.txt | 1 + .../v7_0/migrate_schools_to_erpnext.py | 12 +- erpnext/public/js/setup_wizard.js | 183 +++++++++++++++--- .../doctype/announcement/announcement.json | 25 +-- erpnext/schools/doctype/fees/fees.json | 44 +---- erpnext/setup/setup_wizard/domainify.py | 92 +++++++-- erpnext/setup/setup_wizard/setup_wizard.py | 53 +++++ 9 files changed, 510 insertions(+), 116 deletions(-) create mode 100644 erpnext/config/schools.py diff --git a/erpnext/config/desktop.py b/erpnext/config/desktop.py index fc2be827b6..df2a0ee1f9 100644 --- a/erpnext/config/desktop.py +++ b/erpnext/config/desktop.py @@ -164,5 +164,111 @@ def get_data(): "icon": "octicon octicon-tools", "type": "module", "label": _("Maintenance") + }, + { + "module_name": "Student", + "color": "#c0392b", + "icon": "octicon octicon-person", + "label": _("Student"), + "link": "List/Student", + "doctype": "Student", + "type": "list" + }, + { + "module_name": "Student Group", + "color": "#d59919", + "icon": "octicon octicon-organization", + "label": _("Student Group"), + "link": "List/Student Group", + "doctype": "Student Group", + "type": "list" + }, + { + "module_name": "Course Schedule", + "color": "#fd784f", + "icon": "octicon octicon-calendar", + "label": _("Course Schedule"), + "link": "Calendar/Course Schedule", + "doctype": "Course Schedule", + "type": "list" + }, + { + "module_name": "Student Attendance", + "color": "#3aacba", + "icon": "octicon octicon-checklist", + "label": _("Student Attendance"), + "link": "List/Student Attendance", + "doctype": "Student Attendance", + "type": "list" + }, + { + "module_name": "Course", + "color": "#8e44ad", + "icon": "octicon octicon-book", + "label": _("Course"), + "link": "List/Course", + "doctype": "Course", + "type": "list" + }, + { + "module_name": "Program", + "color": "#9b59b6", + "icon": "octicon octicon-repo", + "label": _("Program"), + "link": "List/Program", + "doctype": "Program", + "type": "list" + }, + { + "module_name": "Student Applicant", + "color": "#4d927f", + "icon": "octicon octicon-clippy", + "label": _("Student Applicant"), + "link": "List/Student Applicant", + "doctype": "Student Applicant", + "type": "list" + }, + { + "module_name": "Examination", + "color": "#8a70be", + "icon": "icon-file-text-alt", + "label": _("Examination"), + "link": "List/Examination", + "doctype": "Examination", + "type": "list" + }, + { + "module_name": "Fees", + "color": "#83C21E", + "icon": "icon-money", + "label": _("Fees"), + "link": "List/Fees", + "doctype": "Fees", + "type": "list" + }, + { + "module_name": "Instructor", + "color": "#a99e4c", + "icon": "octicon octicon-broadcast", + "label": _("Instructor"), + "link": "List/Instructor", + "doctype": "Instructor", + "type": "list" + }, + { + "module_name": "Room", + "color": "#f22683", + "icon": "icon-map-marker", + "label": _("Room"), + "link": "List/Room", + "doctype": "Examination", + "type": "list" + }, + { + "module_name": "Schools", + "color": "#DE2B37", + "icon": "octicon octicon-mortar-board", + "type": "module", + "label": _("Schools") } ] diff --git a/erpnext/config/schools.py b/erpnext/config/schools.py new file mode 100644 index 0000000000..ee1a8cbf1a --- /dev/null +++ b/erpnext/config/schools.py @@ -0,0 +1,110 @@ +from __future__ import unicode_literals +from frappe import _ + +def get_data(): + return [ + { + "label": _("Student"), + "items": [ + + { + "type": "doctype", + "name": "Student" + }, + { + "type": "doctype", + "name": "Student Group" + }, + { + "type": "doctype", + "name": "Student Applicant" + }, + { + "type": "doctype", + "name": "Program Enrollment" + }, + { + "type": "doctype", + "name": "Program Enrollment Tool" + }, + { + "type": "doctype", + "name": "Student Group Creation Tool" + } + ] + }, + { + "label": _("Schedule"), + "items": [ + { + "type": "doctype", + "name": "Course Schedule", + "route": "Calendar/Course Schedule" + }, + { + "type": "doctype", + "name": "Student Attendance" + }, + { + "type": "doctype", + "name": "Scheduling Tool" + }, + { + "type": "doctype", + "name": "Examination" + } + ] + }, + { + "label": _("Fees"), + "items": [ + { + "type": "doctype", + "name": "Fees" + }, + { + "type": "doctype", + "name": "Fee Structure" + }, + { + "type": "doctype", + "name": "Fee Category" + }, + { + "type": "report", + "name": "Student Fee Collection", + "doctype": "Fees", + "is_query_report": True + } + ] + }, + { + "label": _("Setup"), + "items": [ + { + "type": "doctype", + "name": "Course" + }, + { + "type": "doctype", + "name": "Program" + }, + { + "type": "doctype", + "name": "Instructor" + }, + { + "type": "doctype", + "name": "Room" + }, + { + "type": "doctype", + "name": "Academic Term" + }, + { + "type": "doctype", + "name": "Academic Year" + } + ] + }, + ] diff --git a/erpnext/patches.txt b/erpnext/patches.txt index 699a745f24..d211ca9d77 100644 --- a/erpnext/patches.txt +++ b/erpnext/patches.txt @@ -299,3 +299,4 @@ execute:frappe.delete_doc_if_exists("Report", "Employee Holiday Attendance") execute:frappe.delete_doc_if_exists("DocType", "Payment Tool") execute:frappe.delete_doc_if_exists("DocType", "Payment Tool Detail") erpnext.patches.v7_0.setup_account_table_for_expense_claim_type_if_exists +erpnext.patches.v7_0.migrate_schools_to_erpnext diff --git a/erpnext/patches/v7_0/migrate_schools_to_erpnext.py b/erpnext/patches/v7_0/migrate_schools_to_erpnext.py index 95ab16c97a..ca37e69483 100644 --- a/erpnext/patches/v7_0/migrate_schools_to_erpnext.py +++ b/erpnext/patches/v7_0/migrate_schools_to_erpnext.py @@ -1,7 +1,13 @@ from __future__ import unicode_literals import frappe +from erpnext.setup.setup_wizard import domainify def execute(): - frappe.db.sql("""update `tabDoctype` set module='Schools' where module='Academics'""") - from frappe.installer import remove_from_installed_apps - remove_from_installed_apps("schools") \ No newline at end of file + frappe.get_doc('Portal Settings', 'Portal Settings').sync_menu() + if 'schools' in frappe.get_installed_apps(): + frappe.db.sql("""update `tabDoctype` set module='Schools' where module='Academics'""") + from frappe.installer import remove_from_installed_apps + remove_from_installed_apps("schools") + domainify.setup_domain('Education') + else: + domainify.setup_sidebar_items(domainify.get_domain('Manufacturing')) diff --git a/erpnext/public/js/setup_wizard.js b/erpnext/public/js/setup_wizard.js index 9954ae03ce..4da4ce2a74 100644 --- a/erpnext/public/js/setup_wizard.js +++ b/erpnext/public/js/setup_wizard.js @@ -9,28 +9,49 @@ frappe.pages['setup-wizard'].on_page_load = function(wrapper) { function load_erpnext_slides() { $.extend(erpnext.wiz, { - org: { - app_name: "erpnext", - title: __("The Organization"), - icon: "icon-building", + select_domain: { + domains: ["all"], + title: __('Select your Domain'), fields: [ - {fieldname:'company_name', label: __('Company Name'), fieldtype:'Data', reqd:1, - placeholder: __('e.g. "My Company LLC"')}, - {fieldname:'company_abbr', label: __('Company Abbreviation'), fieldtype:'Data', - description: __('Max 5 characters'), placeholder: __('e.g. "MC"'), reqd:1}, - {fieldname:'company_tagline', label: __('What does it do?'), fieldtype:'Data', - placeholder:__('e.g. "Build tools for builders"'), reqd:1}, - {fieldname:'bank_account', label: __('Bank Name'), fieldtype:'Data', - placeholder: __('e.g. "XYZ National Bank"'), reqd:1 }, {fieldname:'domain', label: __('Domain'), fieldtype:'Select', options: [ {"label": __("Distribution"), "value": "Distribution"}, + {"label": __("Education"), "value": "Education"}, {"label": __("Manufacturing"), "value": "Manufacturing"}, {"label": __("Retail"), "value": "Retail"}, - {"label": __("Services"), "value": "Services"}, - {"label": __("Education"), "value": "Education"}, - {"label": __("Other"), "value": "Other"}, + {"label": __("Services"), "value": "Services"} ], reqd:1}, + ], + help: __('Select the nature of your business.'), + onload: function(slide) { + slide.get_input("domain").on("change", function() { + frappe.wiz.domain = $(this).val(); + frappe.wizard.refresh_slides(); + }); + }, + css_class: "single-column" + }, + org: { + domains: ["all"], + title: __("The Organization"), + icon: "icon-building", + fields: [ + {fieldname:'company_name', + label: frappe.wiz.domain==='Education' ? + __('Institute Name') : __('Company Name'), + fieldtype:'Data', reqd:1}, + {fieldname:'company_abbr', + label: frappe.wiz.domain==='Education' ? + __('Institute Abbreviation') : __('Company Abbreviation'), + fieldtype:'Data'}, + {fieldname:'company_tagline', + label: __('What does it do?'), + fieldtype:'Data', + placeholder: frappe.wiz.domain==='Education' ? + __('e.g. "Primary School" or "University"') : + __('e.g. "Build tools for builders"'), + reqd:1}, + {fieldname:'bank_account', label: __('Bank Name'), fieldtype:'Data', reqd:1}, {fieldname:'chart_of_accounts', label: __('Chart of Accounts'), options: "", fieldtype: 'Select'}, @@ -41,7 +62,9 @@ function load_erpnext_slides() { {fieldname:'fy_end_date', label:__('Financial Year End Date'), fieldtype:'Date', description: __('Your financial year ends on'), reqd:1}, ], - help: __('The name of your company for which you are setting up this system.'), + help: (frappe.wiz.domain==='Education' ? + __('The name of the institute for which you are setting up this system.'): + __('The name of your company for which you are setting up this system.')), onload: function(slide) { erpnext.wiz.org.load_chart_of_accounts(slide); @@ -67,7 +90,7 @@ function load_erpnext_slides() { css_class: "single-column", set_fy_dates: function(slide) { - var country = slide.wiz.get_values().country; + var country = frappe.wizard.values.country; if(country) { var fy = erpnext.wiz.fiscal_years[country]; @@ -85,7 +108,7 @@ function load_erpnext_slides() { }, load_chart_of_accounts: function(slide) { - var country = slide.wiz.get_values().country; + var country = frappe.wizard.values.country; if(country) { frappe.call({ @@ -134,7 +157,7 @@ function load_erpnext_slides() { }, branding: { - app_name: "erpnext", + domains: ["all"], icon: "icon-bookmark", title: __("The Brand"), help: __('Upload your letter head and logo. (you can edit them later).'), @@ -156,7 +179,7 @@ function load_erpnext_slides() { }, users: { - app_name: "erpnext", + domains: ["all"], icon: "icon-money", title: __("Add Users"), help: __("Add users to your organization, other than yourself"), @@ -173,11 +196,14 @@ function load_erpnext_slides() { options: "Email"}, {fieldtype:"Column Break"}, {fieldtype: "Check", fieldname: "user_sales_" + i, - label:__("Sales"), default: 1}, + label:__("Sales"), "default": 1, + hidden: frappe.wiz.domain==='Education' ? 1 : 0}, {fieldtype: "Check", fieldname: "user_purchaser_" + i, - label:__("Purchaser"), default: 1}, + label:__("Purchaser"), "default": 1, + hidden: frappe.wiz.domain==='Education' ? 1 : 0}, {fieldtype: "Check", fieldname: "user_accountant_" + i, - label:__("Accountant"), default: 1}, + label:__("Accountant"), "default": 1, + hidden: frappe.wiz.domain==='Education' ? 1 : 0}, ]); } }, @@ -185,7 +211,7 @@ function load_erpnext_slides() { }, taxes: { - app_name: "erpnext", + domains: ['manufacturing', 'services', 'retail', 'distribution'], icon: "icon-money", title: __("Add Taxes"), help: __("List your tax heads (e.g. VAT, Customs etc; they should have unique names) and their standard rates. This will create a standard template, which you can edit and add more later."), @@ -206,7 +232,7 @@ function load_erpnext_slides() { }, customers: { - app_name: "erpnext", + domains: ['manufacturing', 'services', 'retail', 'distribution'], icon: "icon-group", title: __("Your Customers"), help: __("List a few of your customers. They could be organizations or individuals."), @@ -229,7 +255,7 @@ function load_erpnext_slides() { }, suppliers: { - app_name: "erpnext", + domains: ['manufacturing', 'services', 'retail', 'distribution'], icon: "icon-group", title: __("Your Suppliers"), help: __("List a few of your suppliers. They could be organizations or individuals."), @@ -252,7 +278,7 @@ function load_erpnext_slides() { }, items: { - app_name: "erpnext", + domains: ['manufacturing', 'services', 'retail', 'distribution'], icon: "icon-barcode", title: __("Your Products or Services"), help: __("List your products or services that you buy or sell. Make sure to check the Item Group, Unit of Measure and other properties when you start."), @@ -288,6 +314,81 @@ function load_erpnext_slides() { }, css_class: "two-column" }, + + program: { + domains: ["education"], + title: __("Program"), + help: __("Example: Masters in Computer Science"), + fields: [], + before_load: function(slide) { + slide.fields = []; + for(var i=1; i<6; i++) { + slide.fields = slide.fields.concat([ + {fieldtype:"Section Break", show_section_border: true}, + {fieldtype:"Data", fieldname:"program_" + i, label:__("Program") + " " + i, placeholder: __("Program Name")}, + ]) + } + slide.fields[1].reqd = 1; + }, + css_class: "single-column" + }, + + course: { + domains: ["education"], + title: __("Course"), + help: __("Example: Basic Mathematics"), + fields: [], + before_load: function(slide) { + slide.fields = []; + for(var i=1; i<6; i++) { + slide.fields = slide.fields.concat([ + {fieldtype:"Section Break", show_section_border: true}, + {fieldtype:"Data", fieldname:"course_" + i, label:__("Course") + " " + i, placeholder: __("Course Name")}, + ]) + } + slide.fields[1].reqd = 1; + }, + css_class: "single-column" + }, + + + instructor: { + domains: ["education"], + title: __("Instructor"), + help: __("People who teach at your organisation"), + fields: [], + before_load: function(slide) { + slide.fields = []; + for(var i=1; i<6; i++) { + slide.fields = slide.fields.concat([ + {fieldtype:"Section Break", show_section_border: true}, + {fieldtype:"Data", fieldname:"instructor_" + i, label:__("Instructor") + " " + i, placeholder: __("Instructor Name")}, + ]) + } + slide.fields[1].reqd = 1; + }, + css_class: "single-column" + }, + + room: { + domains: ["education"], + title: __("Room"), + help: __("Classrooms/ Laboratories etc where lectures can be scheduled."), + fields: [], + before_load: function(slide) { + slide.fields = []; + for(var i=1; i<4; i++) { + slide.fields = slide.fields.concat([ + {fieldtype:"Section Break", show_section_border: true}, + {fieldtype:"Data", fieldname:"room_" + i, label:__("Room") + " " + i}, + {fieldtype:"Column Break"}, + {fieldtype:"Int", fieldname:"room_capacity_" + i, label:__("Room") + " " + i + " Capacity"}, + ]) + } + slide.fields[1].reqd = 1; + }, + css_class: "two-column" + }, }); // Source: https://en.wikipedia.org/wiki/Fiscal_year @@ -316,6 +417,8 @@ function load_erpnext_slides() { frappe.wiz.on("before_load", function() { load_erpnext_slides(); + + frappe.wiz.add_slide(erpnext.wiz.select_domain); frappe.wiz.add_slide(erpnext.wiz.org); frappe.wiz.add_slide(erpnext.wiz.branding); @@ -327,5 +430,29 @@ frappe.wiz.on("before_load", function() { frappe.wiz.add_slide(erpnext.wiz.customers); frappe.wiz.add_slide(erpnext.wiz.suppliers); frappe.wiz.add_slide(erpnext.wiz.items); - frappe.wiz.welcome_page = "#welcome-to-erpnext"; + frappe.wiz.add_slide(erpnext.wiz.program); + frappe.wiz.add_slide(erpnext.wiz.course); + frappe.wiz.add_slide(erpnext.wiz.instructor); + frappe.wiz.add_slide(erpnext.wiz.room); + + if(frappe.wizard.domain && frappe.wizard.domain !== 'Education') { + frappe.wiz.welcome_page = "#welcome-to-erpnext"; + } }); + +test_values_edu = { + "language":"english", + "domain":"Education", + "country":"India", + "timezone":"Asia/Kolkata", + "currency":"INR", + "first_name":"Tester", + "email":"test@example.com", + "password":"test", + "company_name":"Hogwarts", + "company_abbr":"HS", + "company_tagline":"School for magicians", + "bank_account":"Gringotts Wizarding Bank", + "fy_start_date":"2016-04-01", + "fy_end_date":"2017-03-31" +} diff --git a/erpnext/schools/doctype/announcement/announcement.json b/erpnext/schools/doctype/announcement/announcement.json index c965da516c..831b71f973 100644 --- a/erpnext/schools/doctype/announcement/announcement.json +++ b/erpnext/schools/doctype/announcement/announcement.json @@ -9,6 +9,7 @@ "docstatus": 0, "doctype": "DocType", "document_type": "Document", + "editable_grid": 0, "fields": [ { "allow_on_submit": 0, @@ -276,8 +277,8 @@ "issingle": 0, "istable": 0, "max_attachments": 0, - "modified": "2016-07-18 10:30:50.243271", - "modified_by": "Administrator", + "modified": "2016-07-21 06:30:12.825629", + "modified_by": "r@r.com", "module": "Schools", "name": "Announcement", "name_case": "", @@ -302,26 +303,6 @@ "share": 1, "submit": 1, "write": 1 - }, - { - "amend": 0, - "apply_user_permissions": 0, - "cancel": 0, - "create": 1, - "delete": 0, - "email": 1, - "export": 1, - "if_owner": 0, - "import": 0, - "permlevel": 0, - "print": 1, - "read": 1, - "report": 1, - "role": "Guest", - "set_user_permissions": 0, - "share": 1, - "submit": 0, - "write": 1 } ], "quick_entry": 0, diff --git a/erpnext/schools/doctype/fees/fees.json b/erpnext/schools/doctype/fees/fees.json index 8e3b5601b5..576d69e168 100644 --- a/erpnext/schools/doctype/fees/fees.json +++ b/erpnext/schools/doctype/fees/fees.json @@ -478,8 +478,8 @@ "istable": 0, "max_attachments": 0, "menu_index": 0, - "modified": "2016-07-18 10:30:50.243271", - "modified_by": "Administrator", + "modified": "2016-07-21 06:20:10.878913", + "modified_by": "r@r.com", "module": "Schools", "name": "Fees", "name_case": "", @@ -504,46 +504,6 @@ "share": 1, "submit": 1, "write": 1 - }, - { - "amend": 0, - "apply_user_permissions": 0, - "cancel": 1, - "create": 1, - "delete": 1, - "email": 1, - "export": 1, - "if_owner": 0, - "import": 0, - "permlevel": 0, - "print": 1, - "read": 1, - "report": 1, - "role": "Administrator", - "set_user_permissions": 0, - "share": 1, - "submit": 1, - "write": 1 - }, - { - "amend": 0, - "apply_user_permissions": 0, - "cancel": 0, - "create": 0, - "delete": 0, - "email": 0, - "export": 0, - "if_owner": 0, - "import": 0, - "permlevel": 0, - "print": 1, - "read": 1, - "report": 0, - "role": "Guest", - "set_user_permissions": 0, - "share": 0, - "submit": 0, - "write": 0 } ], "quick_entry": 0, diff --git a/erpnext/setup/setup_wizard/domainify.py b/erpnext/setup/setup_wizard/domainify.py index 02be189b82..07b2e19943 100644 --- a/erpnext/setup/setup_wizard/domainify.py +++ b/erpnext/setup/setup_wizard/domainify.py @@ -4,86 +4,136 @@ from __future__ import unicode_literals import frappe -def get_domains(): +def get_domain(domain): '''Written as a function to prevent data mutation effects''' - return { + data = { 'Manufacturing': { 'desktop_icons': ['Item', 'BOM', 'Customer', 'Supplier', 'Sales Order', 'Production Order', 'Stock Entry', 'Purchase Order', 'Task', 'Buying', 'Selling', 'Accounts', 'HR', 'ToDo'], + 'remove_roles': ['Academics User'], 'properties': [ {'doctype': 'Item', 'fieldname': 'manufacturing', 'property': 'collapsible_depends_on', 'value': 'is_stock_item'}, ], 'set_value': [ ['Stock Settings', None, 'show_barcode_field', 1] - ] + ], + 'remove_sidebar_items': ['/announcement', '/course', '/examination', '/fees'] }, 'Retail': { 'desktop_icons': ['POS', 'Item', 'Customer', 'Sales Invoice', 'Purchase Order', 'Warranty Claim', 'Accounts', 'Buying', 'ToDo'], - 'remove_roles': ['Manufacturing User', 'Manufacturing Manager'], + 'remove_roles': ['Manufacturing User', 'Manufacturing Manager', 'Academics User'], 'properties': [ {'doctype': 'Item', 'fieldname': 'manufacturing', 'property': 'hidden', 'value': 1}, {'doctype': 'Customer', 'fieldname': 'credit_limit_section', 'property': 'hidden', 'value': 1}, ], 'set_value': [ ['Stock Settings', None, 'show_barcode_field', 1] - ] + ], + 'remove_sidebar_items': ['/announcement', '/course', '/examination', '/fees'] }, 'Distribution': { 'desktop_icons': ['Item', 'Customer', 'Supplier', 'Lead', 'Sales Order', 'Sales Invoice', 'CRM', 'Selling', 'Buying', 'Stock', 'Accounts', 'HR', 'ToDo'], - 'remove_roles': ['Manufacturing User', 'Manufacturing Manager'], + 'remove_roles': ['Manufacturing User', 'Manufacturing Manager', 'Academics User'], 'properties': [ {'doctype': 'Item', 'fieldname': 'manufacturing', 'property': 'hidden', 'value': 1}, ], 'set_value': [ ['Stock Settings', None, 'show_barcode_field', 1] - ] + ], + 'remove_sidebar_items': ['/announcement', '/course', '/examination', '/fees'] }, 'Services': { 'desktop_icons': ['Project', 'Timesheet', 'Customer', 'Sales Order', 'Sales Invoice', 'Lead', 'Opportunity', 'Expense Claim', 'Employee', 'HR', 'ToDo'], - 'remove_roles': ['Manufacturing User', 'Manufacturing Manager'], + 'remove_roles': ['Manufacturing User', 'Manufacturing Manager', 'Academics User'], 'properties': [ {'doctype': 'Item', 'fieldname': 'is_stock_item', 'property': 'default', 'value': 0}, ], 'set_value': [ ['Stock Settings', None, 'show_barcode_field', 0] - ] - } + ], + 'remove_sidebar_items': ['/announcement', '/course', '/examination', '/fees'] + }, + 'Education': { + 'desktop_icons': ['Student', 'Program', 'Course', 'Student Group', 'Instructor', + 'Fees', 'ToDo', 'Schools'], + 'allow_roles': ['Academics User', 'Accounts User', 'Accounts Manager'], + 'allow_sidebar_items': ['/announcement', '/course', '/examination', '/fees'] + }, } + if not domain in data: + raise 'Invalid Domain {0}'.format(domain) + return frappe._dict(data[domain]) def setup_domain(domain): - domains = get_domains() - - if not domain in domains: - return + '''Setup roles, desktop icons, properties, values, portal sidebar menu based on domain''' + data = get_domain(domain) + setup_roles(data) + setup_desktop_icons(data) + setup_properties(data) + set_values(data) + setup_sidebar_items(data) + frappe.clear_cache() +def setup_desktop_icons(data): + '''set desktop icons form `data.desktop_icons`''' from frappe.desk.doctype.desktop_icon.desktop_icon import set_desktop_icons - data = frappe._dict(domains[domain]) - - if data.remove_roles: - for role in data.remove_roles: - frappe.db.sql('delete from tabUserRole where role=%s', role) - if data.desktop_icons: set_desktop_icons(data.desktop_icons) +def setup_properties(data): if data.properties: for args in data.properties: frappe.make_property_setter(args) +def setup_roles(data): + '''Add, remove roles from `data.allow_roles` or `data.remove_roles`''' + def remove_role(role): + frappe.db.sql('delete from tabUserRole where role=%s', role) + + if data.remove_roles: + for role in data.remove_roles: + remove_role(role) + + if data.allow_roles: + # remove all roles other than allowed roles + data.allow_roles += ['Administrator', 'Guest', 'System Manager'] + for role in frappe.get_all('Role'): + if not (role.name in data.allow_roles): + remove_role(role.name) + +def set_values(data): + '''set values based on `data.set_value`''' if data.set_value: for args in data.set_value: doc = frappe.get_doc(args[0], args[1] or args[0]) doc.set(args[2], args[3]) doc.save() - frappe.clear_cache() +def setup_sidebar_items(data): + '''Enable / disable sidebar items''' + if data.allow_sidebar_items: + # disable all + frappe.db.sql('update `tabPortal Menu Item` set enabled=0') + + # enable + frappe.db.sql('''update `tabPortal Menu Item` set enabled=1 + where route in ({0})'''.format(', '.join(['"{0}"'.format(d) for d in data.allow_sidebar_items]))) + + if data.remove_sidebar_items: + # disable all + frappe.db.sql('update `tabPortal Menu Item` set enabled=1') + + # enable + frappe.db.sql('''update `tabPortal Menu Item` set enabled=0 + where route in ({0})'''.format(', '.join(['"{0}"'.format(d) for d in data.remove_sidebar_items]))) + def reset(): from frappe.desk.page.setup_wizard.setup_wizard import add_all_roles_to diff --git a/erpnext/setup/setup_wizard/setup_wizard.py b/erpnext/setup/setup_wizard/setup_wizard.py index 0284ca8195..3cabde11a5 100644 --- a/erpnext/setup/setup_wizard/setup_wizard.py +++ b/erpnext/setup/setup_wizard/setup_wizard.py @@ -32,6 +32,15 @@ def setup_complete(args=None): create_items(args) create_customers(args) create_suppliers(args) + + if args.domain.lower() == 'education': + create_academic_term() + create_academic_year() + create_program(args) + create_course(args) + create_instructor(args) + create_room(args) + frappe.local.message_log = [] setup_domain(args.get('domain')) @@ -493,3 +502,47 @@ def create_users(args): emp.flags.ignore_mandatory = True emp.insert(ignore_permissions = True) +def create_academic_term(): + at = ["Semester 1", "Semester 2", "Semester 3"] + for d in at: + academic_term = frappe.new_doc("Academic Term") + academic_term.term_name = d + academic_term.save() + +def create_academic_year(): + ac = ["2013-14", "2014-15", "2015-16", "2016-17", "2017-18"] + for d in ac: + academic_year = frappe.new_doc("Academic Year") + academic_year.academic_year_name = d + academic_year.save() + +def create_program(args): + for i in xrange(1,6): + if args.get("program_" + str(i)): + program = frappe.new_doc("Program") + program.program_name = args.get("program_" + str(i)) + program.save() + +def create_course(args): + for i in xrange(1,6): + if args.get("course_" + str(i)): + course = frappe.new_doc("Course") + course.course_name = args.get("course_" + str(i)) + course.save() + +def create_instructor(args): + for i in xrange(1,6): + if args.get("instructor_" + str(i)): + instructor = frappe.new_doc("Instructor") + instructor.instructor_name = args.get("instructor_" + str(i)) + instructor.save() + +def create_room(args): + for i in xrange(1,6): + if args.get("room_" + str(i)): + room = frappe.new_doc("Room") + room.room_name = args.get("room_" + str(i)) + room.seating_capacity = args.get("room_capacity_" + str(i)) + room.save() + +