Merge pull request #4846 from KanchanChauhan/job-applicant
Added feature to allow people to apply for job from website
This commit is contained in:
commit
ae7dc31d14
@ -68,6 +68,13 @@ website_route_rules = [
|
|||||||
"doctype": "Delivery Note",
|
"doctype": "Delivery Note",
|
||||||
"parents": [{"title": _("Shipments"), "name": "shipments"}]
|
"parents": [{"title": _("Shipments"), "name": "shipments"}]
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
{"from_route": "/jobs", "to_route": "Job Opening"},
|
||||||
|
{"from_route": "/jobs/<path:name>", "to_route": "job_opening",
|
||||||
|
"defaults": {
|
||||||
|
"doctype": "Job Opening",
|
||||||
|
"parents": [{"title": _("Job Opening"), "name": "jobs"}]
|
||||||
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -108,7 +108,7 @@
|
|||||||
"allow_on_submit": 0,
|
"allow_on_submit": 0,
|
||||||
"bold": 0,
|
"bold": 0,
|
||||||
"collapsible": 0,
|
"collapsible": 0,
|
||||||
"fieldname": "job_opening",
|
"fieldname": "job_title",
|
||||||
"fieldtype": "Link",
|
"fieldtype": "Link",
|
||||||
"hidden": 0,
|
"hidden": 0,
|
||||||
"ignore_user_permissions": 0,
|
"ignore_user_permissions": 0,
|
||||||
@ -184,7 +184,7 @@
|
|||||||
"issingle": 0,
|
"issingle": 0,
|
||||||
"istable": 0,
|
"istable": 0,
|
||||||
"max_attachments": 0,
|
"max_attachments": 0,
|
||||||
"modified": "2016-02-12 00:38:31.773297",
|
"modified": "2016-02-19 16:43:24.705867",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "HR",
|
"module": "HR",
|
||||||
"name": "Job Applicant",
|
"name": "Job Applicant",
|
||||||
@ -204,11 +204,33 @@
|
|||||||
"print": 1,
|
"print": 1,
|
||||||
"read": 1,
|
"read": 1,
|
||||||
"report": 1,
|
"report": 1,
|
||||||
|
"restrict": 0,
|
||||||
|
"restricted": 0,
|
||||||
"role": "HR User",
|
"role": "HR User",
|
||||||
"set_user_permissions": 0,
|
"set_user_permissions": 0,
|
||||||
"share": 1,
|
"share": 1,
|
||||||
"submit": 0,
|
"submit": 0,
|
||||||
"write": 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": 0,
|
||||||
|
"read": 1,
|
||||||
|
"report": 0,
|
||||||
|
"role": "Guest",
|
||||||
|
"set_user_permissions": 0,
|
||||||
|
"share": 0,
|
||||||
|
"submit": 0,
|
||||||
|
"write": 0
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"read_only": 0,
|
"read_only": 0,
|
||||||
|
@ -7,10 +7,12 @@ from __future__ import unicode_literals
|
|||||||
from frappe.model.document import Document
|
from frappe.model.document import Document
|
||||||
import frappe
|
import frappe
|
||||||
from frappe import _
|
from frappe import _
|
||||||
from frappe.utils import comma_and
|
from frappe.utils import comma_and, validate_email_add
|
||||||
|
|
||||||
sender_field = "email_id"
|
sender_field = "email_id"
|
||||||
|
|
||||||
|
class DuplicationError(frappe.ValidationError): pass
|
||||||
|
|
||||||
class JobApplicant(Document):
|
class JobApplicant(Document):
|
||||||
def onload(self):
|
def onload(self):
|
||||||
offer_letter = frappe.get_all("Offer Letter", filters={"job_applicant": self.name})
|
offer_letter = frappe.get_all("Offer Letter", filters={"job_applicant": self.name})
|
||||||
@ -25,6 +27,14 @@ class JobApplicant(Document):
|
|||||||
|
|
||||||
def validate(self):
|
def validate(self):
|
||||||
self.check_email_id_is_unique()
|
self.check_email_id_is_unique()
|
||||||
|
validate_email_add(self.email_id, True)
|
||||||
|
if frappe.db.sql("""select applicant_name from `tabJob Applicant` where email_id= %s and job_title= %s""",
|
||||||
|
(self.email_id, self.job_title)):
|
||||||
|
frappe.throw(_("Application already exist for {0} against Job Opening - {1}")
|
||||||
|
.format(self.applicant_name, self.job_title), DuplicationError)
|
||||||
|
|
||||||
|
if not self.get("__islocal") and not self.upload_cv:
|
||||||
|
frappe.throw(_("CV Required"))
|
||||||
|
|
||||||
def check_email_id_is_unique(self):
|
def check_email_id_is_unique(self):
|
||||||
if self.email_id:
|
if self.email_id:
|
||||||
@ -33,3 +43,5 @@ class JobApplicant(Document):
|
|||||||
|
|
||||||
if names:
|
if names:
|
||||||
frappe.throw(_("Email id must be unique, already exists for {0}").format(comma_and(names)), frappe.DuplicateEntryError)
|
frappe.throw(_("Email id must be unique, already exists for {0}").format(comma_and(names)), frappe.DuplicateEntryError)
|
||||||
|
|
||||||
|
|
0
erpnext/hr/doctype/job_opening/job_opening.js
Normal file
0
erpnext/hr/doctype/job_opening/job_opening.js
Normal file
@ -25,6 +25,7 @@
|
|||||||
"no_copy": 0,
|
"no_copy": 0,
|
||||||
"permlevel": 0,
|
"permlevel": 0,
|
||||||
"print_hide": 0,
|
"print_hide": 0,
|
||||||
|
"print_hide_if_no_value": 0,
|
||||||
"read_only": 0,
|
"read_only": 0,
|
||||||
"report_hide": 0,
|
"report_hide": 0,
|
||||||
"reqd": 1,
|
"reqd": 1,
|
||||||
@ -48,6 +49,7 @@
|
|||||||
"options": "Open\nClosed",
|
"options": "Open\nClosed",
|
||||||
"permlevel": 0,
|
"permlevel": 0,
|
||||||
"print_hide": 0,
|
"print_hide": 0,
|
||||||
|
"print_hide_if_no_value": 0,
|
||||||
"read_only": 0,
|
"read_only": 0,
|
||||||
"report_hide": 0,
|
"report_hide": 0,
|
||||||
"reqd": 0,
|
"reqd": 0,
|
||||||
@ -71,6 +73,7 @@
|
|||||||
"no_copy": 0,
|
"no_copy": 0,
|
||||||
"permlevel": 0,
|
"permlevel": 0,
|
||||||
"print_hide": 0,
|
"print_hide": 0,
|
||||||
|
"print_hide_if_no_value": 0,
|
||||||
"read_only": 0,
|
"read_only": 0,
|
||||||
"report_hide": 0,
|
"report_hide": 0,
|
||||||
"reqd": 0,
|
"reqd": 0,
|
||||||
@ -89,7 +92,7 @@
|
|||||||
"issingle": 0,
|
"issingle": 0,
|
||||||
"istable": 0,
|
"istable": 0,
|
||||||
"max_attachments": 0,
|
"max_attachments": 0,
|
||||||
"modified": "2015-11-16 06:29:48.769149",
|
"modified": "2016-02-17 17:29:04.401527",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "HR",
|
"module": "HR",
|
||||||
"name": "Job Opening",
|
"name": "Job Opening",
|
||||||
@ -114,8 +117,29 @@
|
|||||||
"share": 1,
|
"share": 1,
|
||||||
"submit": 0,
|
"submit": 0,
|
||||||
"write": 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": 0,
|
||||||
|
"read": 1,
|
||||||
|
"report": 0,
|
||||||
|
"role": "Guest",
|
||||||
|
"set_user_permissions": 0,
|
||||||
|
"share": 0,
|
||||||
|
"submit": 0,
|
||||||
|
"write": 0
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"read_only": 0,
|
"read_only": 0,
|
||||||
"read_only_onload": 0
|
"read_only_onload": 0,
|
||||||
|
"sort_order": "ASC"
|
||||||
}
|
}
|
20
erpnext/templates/pages/job_opening.html
Normal file
20
erpnext/templates/pages/job_opening.html
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
|
||||||
|
<head>
|
||||||
|
<title>{{doc.job_title}}</title>
|
||||||
|
</head>
|
||||||
|
{% extends "templates/web.html" %}
|
||||||
|
{% block header %}
|
||||||
|
<h1>{{ doc.job_title }}</h1>
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block breadcrumbs %}
|
||||||
|
{% include "templates/includes/breadcrumbs.html" %}
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block page_content %}
|
||||||
|
|
||||||
|
<p>{{ doc.description }}</p>
|
||||||
|
|
||||||
|
<input class="btn btn-large btn-primary" type="button" onclick="location.href='/job_application?job_title={{ doc.job_title }}';" value="Apply Now" />
|
||||||
|
|
||||||
|
{% endblock %}
|
16
erpnext/templates/pages/job_opening.py
Normal file
16
erpnext/templates/pages/job_opening.py
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
# 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 import _
|
||||||
|
|
||||||
|
def get_context(context):
|
||||||
|
context.no_cache = 1
|
||||||
|
context.doc = frappe.get_doc(frappe.form_dict.doctype, frappe.form_dict.name)
|
||||||
|
context.parents = frappe.form_dict.parents
|
||||||
|
|
||||||
|
if not context.doc.has_website_permission("read"):
|
||||||
|
frappe.throw(_("Not Permitted"), frappe.PermissionError)
|
||||||
|
|
Loading…
x
Reference in New Issue
Block a user