diff --git a/erpnext/hooks.py b/erpnext/hooks.py index 65953ece3d0..0b7d3eecc09 100644 --- a/erpnext/hooks.py +++ b/erpnext/hooks.py @@ -125,6 +125,7 @@ website_route_rules = [ {"from_route": "/admissions", "to_route": "Student Admission"}, {"from_route": "/boms", "to_route": "BOM"}, {"from_route": "/timesheets", "to_route": "Timesheet"}, + {"from_route": "/grant-application", "to_route": "Grant Application"}, ] standard_portal_menu_items = [ @@ -144,7 +145,8 @@ standard_portal_menu_items = [ {"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": _("Admission"), "route": "/admissions", "reference_doctype": "Student Admission"} + {"title": _("Admission"), "route": "/admissions", "reference_doctype": "Student Admission"}, + {"title": _("Grant Application"), "route": "/grant-application", "reference_doctype": "Grant Application"} ] default_roles = [ diff --git a/erpnext/non_profit/doctype/grant_application/grant_application.json b/erpnext/non_profit/doctype/grant_application/grant_application.json index e7d23144eba..509f67b6311 100644 --- a/erpnext/non_profit/doctype/grant_application/grant_application.json +++ b/erpnext/non_profit/doctype/grant_application/grant_application.json @@ -1,6 +1,6 @@ { "allow_copy": 0, - "allow_guest_to_view": 0, + "allow_guest_to_view": 1, "allow_import": 0, "allow_rename": 0, "autoname": "field:email", @@ -19,7 +19,7 @@ "bold": 0, "collapsible": 0, "columns": 0, - "fieldname": "organization", + "fieldname": "title", "fieldtype": "Data", "hidden": 0, "ignore_user_permissions": 0, @@ -132,6 +132,38 @@ "set_only_once": 0, "unique": 0 }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "default": "Open", + "fieldname": "status", + "fieldtype": "Select", + "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": "Status", + "length": 0, + "no_copy": 0, + "options": "Open\nReceived\nIn Progress\nApproved\nRejected\nExpired\nWithdrawan", + "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, @@ -462,20 +494,81 @@ "search_index": 0, "set_only_once": 0, "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "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, + "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": "Show on Website", + "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_field": "image", "image_view": 0, "in_create": 0, + "is_published_field": "published", "is_submittable": 0, "issingle": 0, "istable": 0, "max_attachments": 0, - "modified": "2017-09-22 13:10:32.303551", + "modified": "2017-10-30 16:18:40.911012", "modified_by": "Administrator", "module": "Non Profit", "name": "Grant Application", @@ -501,11 +594,32 @@ "share": 1, "submit": 0, "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": "Website Manager", + "set_user_permissions": 0, + "share": 1, + "submit": 0, + "write": 1 } ], "quick_entry": 1, "read_only": 0, "read_only_onload": 0, + "route": "grant-application", "show_name_in_global_search": 0, "sort_field": "modified", "sort_order": "DESC", diff --git a/erpnext/non_profit/doctype/grant_application/grant_application.py b/erpnext/non_profit/doctype/grant_application/grant_application.py index d97de40918c..de44e7975d8 100644 --- a/erpnext/non_profit/doctype/grant_application/grant_application.py +++ b/erpnext/non_profit/doctype/grant_application/grant_application.py @@ -3,10 +3,34 @@ # For license information, please see license.txt from __future__ import unicode_literals -from frappe.model.document import Document +import frappe +from frappe.website.website_generator import WebsiteGenerator from frappe.contacts.address_and_contact import load_address_and_contact -class GrantApplication(Document): +class GrantApplication(WebsiteGenerator): + _website = frappe._dict( + condition_field = "published", + ) + + def validate(self): + if not self.route: + self.route = 'grant-application/' + self.scrub(self.name) + def onload(self): """Load address and contacts in `__onload`""" load_address_and_contact(self) + + + def get_context(self, context): + context.no_cache = True + context.parents = [dict(label='View All ', + route='grant-application', title='View All')] + + + +def get_list_context(context): + context.allow_guest = True + context.no_cache = True + context.no_breadcrumbs = True + context.order_by = 'creation desc' + context.introduction ='
| Organization/Indvidual | +{{ title }} | +
| Grant Applicant Name | +{{ grant_applicant_name }} | +
| Date | +{{ frappe.format_date(creation) }} | +
| Status | +{{ status }} | +
| {{ email }} | +
{{ grant_description }}
+{{ grant_purpose }}
+{{ amount }}
+{{ grant_past_record }}
+| {{ email }} | +