diff --git a/erpnext/hooks.py b/erpnext/hooks.py index 4206ed2811..bf6f5aac86 100644 --- a/erpnext/hooks.py +++ b/erpnext/hooks.py @@ -133,7 +133,8 @@ standard_portal_menu_items = [ {"title": _("Prescription"), "route": "/prescription", "reference_doctype": "Consultation", "role":"Patient"}, {"title": _("Patient Appointment"), "route": "/patient-appointments", "reference_doctype": "Patient Appointment", "role":"Patient"}, {"title": _("Fees"), "route": "/fees", "reference_doctype": "Fees", "role":"Student"}, - {"title": _("Newsletter"), "route": "/newsletters", "reference_doctype": "Newsletter"} + {"title": _("Newsletter"), "route": "/newsletters", "reference_doctype": "Newsletter"}, + {"title": _("Admission"), "route": "/admissions", "reference_doctype": "Student Admission"} ] default_roles = [ diff --git a/erpnext/schools/doctype/student_admission/student_admission.json b/erpnext/schools/doctype/student_admission/student_admission.json index 4801e51163..c35d5be393 100644 --- a/erpnext/schools/doctype/student_admission/student_admission.json +++ b/erpnext/schools/doctype/student_admission/student_admission.json @@ -1,6 +1,6 @@ { "allow_copy": 0, - "allow_guest_to_view": 0, + "allow_guest_to_view": 1, "allow_import": 0, "allow_rename": 1, "autoname": "", @@ -12,97 +12,6 @@ "document_type": "Document", "editable_grid": 1, "fields": [ - { - "allow_bulk_edit": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "academic_year", - "fieldtype": "Link", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 1, - "in_standard_filter": 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, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 1, - "search_index": 0, - "set_only_once": 0, - "unique": 0 - }, - { - "allow_bulk_edit": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "admission_start_date", - "fieldtype": "Date", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "Admission Start Date", - "length": 0, - "no_copy": 0, - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "unique": 0 - }, - { - "allow_bulk_edit": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "admission_end_date", - "fieldtype": "Date", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "Admission End Date", - "length": 0, - "no_copy": 0, - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "unique": 0 - }, { "allow_bulk_edit": 0, "allow_on_submit": 0, @@ -139,7 +48,8 @@ "bold": 0, "collapsible": 0, "columns": 0, - "fieldname": "naming_series_for_student_applicant", + "depends_on": "", + "fieldname": "route", "fieldtype": "Data", "hidden": 0, "ignore_user_permissions": 0, @@ -148,9 +58,9 @@ "in_global_search": 0, "in_list_view": 0, "in_standard_filter": 0, - "label": "Naming Series (for Student Applicant)", + "label": "Route", "length": 0, - "no_copy": 0, + "no_copy": 1, "permlevel": 0, "precision": "", "print_hide": 0, @@ -161,7 +71,7 @@ "reqd": 0, "search_index": 0, "set_only_once": 0, - "unique": 0 + "unique": 1 }, { "allow_bulk_edit": 0, @@ -169,8 +79,8 @@ "bold": 0, "collapsible": 0, "columns": 0, - "fieldname": "publish", - "fieldtype": "Check", + "fieldname": "application_form_route", + "fieldtype": "Data", "hidden": 0, "ignore_user_permissions": 0, "ignore_xss_filter": 0, @@ -178,7 +88,7 @@ "in_global_search": 0, "in_list_view": 0, "in_standard_filter": 0, - "label": "Publish on website", + "label": "Application Form Route", "length": 0, "no_copy": 0, "permlevel": 0, @@ -188,7 +98,7 @@ "read_only": 0, "remember_last_selected_value": 0, "report_hide": 0, - "reqd": 0, + "reqd": 1, "search_index": 0, "set_only_once": 0, "unique": 0 @@ -228,112 +138,19 @@ "bold": 0, "collapsible": 0, "columns": 0, - "fieldname": "program", - "fieldtype": "Link", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 1, - "in_list_view": 0, - "in_standard_filter": 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, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "unique": 0 - }, - { - "allow_bulk_edit": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "application_fee", - "fieldtype": "Currency", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "Application Fee", - "length": 0, - "no_copy": 0, - "options": "currency", - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "unique": 0 - }, - { - "allow_bulk_edit": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "currency", + "fieldname": "academic_year", "fieldtype": "Link", "hidden": 0, "ignore_user_permissions": 0, "ignore_xss_filter": 0, "in_filter": 0, "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "Currency", + "in_list_view": 1, + "in_standard_filter": 1, + "label": "Academic Year", "length": 0, - "no_copy": 0, - "options": "Currency", - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "unique": 0 - }, - { - "allow_bulk_edit": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "depends_on": "", - "fieldname": "route", - "fieldtype": "Data", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "Route", - "length": 0, - "no_copy": 0, + "no_copy": 1, + "options": "Academic Year", "permlevel": 0, "precision": "", "print_hide": 0, @@ -344,7 +161,7 @@ "reqd": 1, "search_index": 0, "set_only_once": 0, - "unique": 1 + "unique": 0 }, { "allow_bulk_edit": 0, @@ -352,8 +169,8 @@ "bold": 0, "collapsible": 0, "columns": 0, - "fieldname": "application_form_route", - "fieldtype": "Data", + "fieldname": "admission_start_date", + "fieldtype": "Date", "hidden": 0, "ignore_user_permissions": 0, "ignore_xss_filter": 0, @@ -361,7 +178,67 @@ "in_global_search": 0, "in_list_view": 0, "in_standard_filter": 0, - "label": "Application Form Route", + "label": "Admission Start Date", + "length": 0, + "no_copy": 1, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "admission_end_date", + "fieldtype": "Date", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Admission End Date", + "length": 0, + "no_copy": 1, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "published", + "fieldtype": "Check", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Publish on website", "length": 0, "no_copy": 0, "permlevel": 0, @@ -391,6 +268,7 @@ "in_global_search": 0, "in_list_view": 0, "in_standard_filter": 0, + "label": "Eligibility and Details", "length": 0, "no_copy": 0, "permlevel": 0, @@ -405,6 +283,37 @@ "set_only_once": 0, "unique": 0 }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "program_details", + "fieldtype": "Table", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Eligibility and Details", + "length": 0, + "no_copy": 0, + "options": "Student Admission Program", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, { "allow_bulk_edit": 0, "allow_on_submit": 0, @@ -434,49 +343,20 @@ "search_index": 0, "set_only_once": 0, "unique": 0 - }, - { - "allow_bulk_edit": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "eligibility", - "fieldtype": "Text Editor", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "Eligibility", - "length": 0, - "no_copy": 0, - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "unique": 0 } ], - "has_web_view": 0, + "has_web_view": 1, "hide_heading": 0, "hide_toolbar": 0, "idx": 0, "image_view": 0, "in_create": 0, + "is_published_field": "published", "is_submittable": 0, "issingle": 0, "istable": 0, "max_attachments": 0, - "modified": "2017-06-30 08:21:50.722286", + "modified": "2017-10-02 15:16:44.386000", "modified_by": "Administrator", "module": "Schools", "name": "Student Admission", @@ -504,10 +384,11 @@ "write": 1 } ], - "quick_entry": 1, + "quick_entry": 0, "read_only": 0, "read_only_onload": 0, "restrict_to_domain": "Education", + "route": "admissions", "show_name_in_global_search": 1, "sort_field": "modified", "sort_order": "DESC", diff --git a/erpnext/schools/doctype/student_admission/student_admission.py b/erpnext/schools/doctype/student_admission/student_admission.py index a849d65d7b..e166b9b5e8 100644 --- a/erpnext/schools/doctype/student_admission/student_admission.py +++ b/erpnext/schools/doctype/student_admission/student_admission.py @@ -4,26 +4,41 @@ from __future__ import unicode_literals import frappe -from frappe.website.website_generator import WebsiteGenerator from frappe import _ +from frappe.utils import nowdate +from frappe.website.website_generator import WebsiteGenerator + class StudentAdmission(WebsiteGenerator): - website = frappe._dict( - template = "templates/generators/student_admission.html", - condition_field = "publish", - page_title_field = "title" - ) - def autoname(self): if not self.title: self.title = self.get_title() self.name = self.title + def validate(self): + if not self.route: #pylint: disable=E0203 + self.route = "admissions/" + "-".join(self.title.split(" ")) + def get_context(self, context): - context.parents = [{'name': 'admissions', 'title': _('All Student Admissions') }] + context.no_cache = 1 + context.show_sidebar = True + context.title = self.title + context.parents = [{'name': 'admissions', 'title': _('All Student Admissions'), 'route': 'admissions' }] def get_title(self): return _("Admissions for {0}").format(self.academic_year) -def get_list_context(context): - context.title = _("Student Admissions") + +def get_list_context(context=None): + context.update({ + "show_sidebar": True, + "title": _("Student Admissions"), + "get_list": get_admission_list, + "row_template": "schools/doctype/student_admission/templates/student_admission_row.html", + }) + +def get_admission_list(doctype, txt, filters, limit_start, limit_page_length=20, order_by="modified"): + return frappe.db.sql('''select name, title, academic_year, modified, admission_start_date, route, + admission_end_date from `tabStudent Admission` where published=1 and admission_end_date >= %s + order by admission_end_date asc limit {0}, {1} + '''.format(limit_start, limit_page_length), [nowdate()], as_dict=1) diff --git a/erpnext/schools/doctype/student_admission/templates/student_admission.html b/erpnext/schools/doctype/student_admission/templates/student_admission.html new file mode 100644 index 0000000000..25afaca84d --- /dev/null +++ b/erpnext/schools/doctype/student_admission/templates/student_admission.html @@ -0,0 +1,74 @@ + +{% extends "templates/web.html" %} + +{% block breadcrumbs %} + {% include "templates/includes/breadcrumbs.html" %} +{% endblock %} + +{% block header %} +
Program/Std. | +Minumum Age(DOB) | +Maximum Age(DOB) | +Application Fee | +
---|---|---|---|
{{ row.program }} | +{{ row.minimum_age }} | +{{ row.maximum_age }} | +{{ row.application_fee }} | +