[fixes] admission-applicant link and student applicant fixes

This commit is contained in:
Rushabh Mehta 2016-10-04 12:20:47 +05:30
parent aedad64445
commit 3af3d7abe3
6 changed files with 473 additions and 377 deletions

View File

@ -1,8 +1,8 @@
{ {
"allow_copy": 0, "allow_copy": 0,
"allow_import": 0, "allow_import": 0,
"allow_rename": 0, "allow_rename": 1,
"autoname": "field:route", "autoname": "",
"beta": 0, "beta": 0,
"creation": "2016-09-13 03:05:27.154713", "creation": "2016-09-13 03:05:27.154713",
"custom": 0, "custom": 0,
@ -116,6 +116,32 @@
"set_only_once": 0, "set_only_once": 0,
"unique": 0 "unique": 0
}, },
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "naming_series_for_student_applicant",
"fieldtype": "Data",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Naming Series (for Student Applicant)",
"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, "allow_on_submit": 0,
"bold": 0, "bold": 0,
@ -351,6 +377,32 @@
"search_index": 0, "search_index": 0,
"set_only_once": 0, "set_only_once": 0,
"unique": 0 "unique": 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_list_view": 0,
"label": "Eligibility",
"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_heading": 0,
@ -363,7 +415,7 @@
"issingle": 0, "issingle": 0,
"istable": 0, "istable": 0,
"max_attachments": 0, "max_attachments": 0,
"modified": "2016-10-04 02:08:06.915441", "modified": "2016-10-04 02:44:28.480942",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Schools", "module": "Schools",
"name": "Student Admission", "name": "Student Admission",

View File

@ -11,15 +11,18 @@ class StudentAdmission(WebsiteGenerator):
website = frappe._dict( website = frappe._dict(
template = "templates/generators/student_admission.html", template = "templates/generators/student_admission.html",
condition_field = "publish", condition_field = "publish",
page_title_field = "route" page_title_field = "title"
) )
def autoname(self):
self.name = self.get_title()
self.title = self.name
def get_context(self, context): def get_context(self, context):
context.parents = [{'name': 'admissions', 'title': _('All Student Admissions') }] context.parents = [{'name': 'admissions', 'title': _('All Student Admissions') }]
def validate(self): def get_title(self):
if not self.title: return _("Admissions for {0}") + self.academic_year
self.title = self.program + " admissions for " + self.academic_year
def get_list_context(context): def get_list_context(context):
context.title = _("Student Admissions") context.title = _("Student Admissions")

View File

@ -89,6 +89,33 @@
"set_only_once": 0, "set_only_once": 0,
"unique": 0 "unique": 0
}, },
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "student_admission",
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Student Admission",
"length": 0,
"no_copy": 0,
"options": "Student Admission",
"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, "allow_on_submit": 0,
"bold": 0, "bold": 0,
@ -182,7 +209,7 @@
"label": "Naming Series", "label": "Naming Series",
"length": 0, "length": 0,
"no_copy": 0, "no_copy": 0,
"options": "AP.", "options": "AP",
"permlevel": 0, "permlevel": 0,
"precision": "", "precision": "",
"print_hide": 0, "print_hide": 0,
@ -891,7 +918,7 @@
"istable": 0, "istable": 0,
"max_attachments": 0, "max_attachments": 0,
"menu_index": 0, "menu_index": 0,
"modified": "2016-09-23 14:15:25.153128", "modified": "2016-10-04 02:46:20.913741",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Schools", "module": "Schools",
"name": "Student Applicant", "name": "Student Applicant",
@ -908,6 +935,7 @@
"export": 1, "export": 1,
"if_owner": 0, "if_owner": 0,
"import": 1, "import": 1,
"is_custom": 0,
"permlevel": 0, "permlevel": 0,
"print": 1, "print": 1,
"read": 1, "read": 1,

View File

@ -8,6 +8,18 @@ from frappe import _
from frappe.model.document import Document from frappe.model.document import Document
class StudentApplicant(Document): class StudentApplicant(Document):
def autoname(self):
from frappe.model.naming import set_name_by_naming_series
if self.student_admission:
naming_series = frappe.db.get_value('Student Admission', self.student_admission,
'naming_series_for_student_applicant')
print naming_series
if naming_series:
self.naming_series = naming_series
set_name_by_naming_series(self)
def validate(self): def validate(self):
self.title = " ".join(filter(None, [self.first_name, self.middle_name, self.last_name])) self.title = " ".join(filter(None, [self.first_name, self.middle_name, self.last_name]))

View File

@ -19,8 +19,9 @@
{%- if application_form_route -%} {%- if application_form_route -%}
<p> <p>
<a class='btn btn-primary' <a class='btn btn-primary'
href='/{{ doc.application_form_route }}?academic_year={{ doc.academic_year }}&new=1 href='/{{ doc.application_form_route }}?new=1&student_admission={{ doc.name }}
{%- if doc.program -%}&program={{ doc.program }}{%- endif -%}'> {%- if doc.program -%}&program={{ doc.program }}{%- endif -%}
{%- if doc.academic_year -%}&academic_year={{ doc.academic_year }}{%- endif -%}'>
{{ _("Apply Now") }}</a> {{ _("Apply Now") }}</a>
</p> </p>
{% endif %} {% endif %}