From 51e4d641c8cbda4de7386b63f61cb5e83117fc54 Mon Sep 17 00:00:00 2001 From: Siddhi Sawant Date: Thu, 21 Jun 2018 10:47:54 +0530 Subject: [PATCH] Job Applicant Source (#14543) * New doctype - Job Applicant Source * Source and source name field in job applicant * Updated install_fixtures with default options * Update install_fixtures.py * Fixes codacy --- .../doctype/job_applicant/job_applicant.json | 87 +++++++++++- .../doctype/job_applicant_source/__init__.py | 0 .../job_applicant_source.js | 8 ++ .../job_applicant_source.json | 124 ++++++++++++++++++ .../job_applicant_source.py | 9 ++ .../test_job_applicant_source.js | 23 ++++ .../test_job_applicant_source.py | 9 ++ .../operations/install_fixtures.py | 7 +- 8 files changed, 263 insertions(+), 4 deletions(-) create mode 100644 erpnext/hr/doctype/job_applicant_source/__init__.py create mode 100644 erpnext/hr/doctype/job_applicant_source/job_applicant_source.js create mode 100644 erpnext/hr/doctype/job_applicant_source/job_applicant_source.json create mode 100644 erpnext/hr/doctype/job_applicant_source/job_applicant_source.py create mode 100644 erpnext/hr/doctype/job_applicant_source/test_job_applicant_source.js create mode 100644 erpnext/hr/doctype/job_applicant_source/test_job_applicant_source.py diff --git a/erpnext/hr/doctype/job_applicant/job_applicant.json b/erpnext/hr/doctype/job_applicant/job_applicant.json index dc8d82c082d..8c7ce74ebd3 100644 --- a/erpnext/hr/doctype/job_applicant/job_applicant.json +++ b/erpnext/hr/doctype/job_applicant/job_applicant.json @@ -1,5 +1,6 @@ { "allow_copy": 0, + "allow_guest_to_view": 0, "allow_import": 0, "allow_rename": 0, "autoname": "JA-.######", @@ -14,6 +15,7 @@ "engine": "InnoDB", "fields": [ { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 1, "collapsible": 0, @@ -39,9 +41,11 @@ "reqd": 0, "search_index": 0, "set_only_once": 0, + "translatable": 0, "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 1, "collapsible": 0, @@ -68,9 +72,11 @@ "reqd": 0, "search_index": 0, "set_only_once": 0, + "translatable": 0, "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -97,9 +103,11 @@ "reqd": 1, "search_index": 0, "set_only_once": 0, + "translatable": 0, "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -124,10 +132,12 @@ "reqd": 0, "search_index": 0, "set_only_once": 0, + "translatable": 0, "unique": 0, "width": "50%" }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -154,9 +164,76 @@ "reqd": 0, "search_index": 0, "set_only_once": 0, + "translatable": 0, "unique": 0 }, { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "source", + "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": "Source", + "length": 0, + "no_copy": 0, + "options": "Job Applicant Source", + "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, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "depends_on": "eval: doc.source==\"Employee Referral\" ", + "fieldname": "source_name", + "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": "Source Name", + "length": 0, + "no_copy": 0, + "options": "Employee", + "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, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -182,9 +259,11 @@ "reqd": 0, "search_index": 0, "set_only_once": 0, + "translatable": 0, "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -211,9 +290,11 @@ "reqd": 0, "search_index": 0, "set_only_once": 0, + "translatable": 0, "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -240,21 +321,22 @@ "reqd": 0, "search_index": 0, "set_only_once": 0, + "translatable": 0, "unique": 0 } ], + "has_web_view": 0, "hide_heading": 0, "hide_toolbar": 0, "icon": "fa fa-user", "idx": 1, "image_view": 0, "in_create": 0, - "is_submittable": 0, "issingle": 0, "istable": 0, "max_attachments": 0, - "modified": "2017-02-17 16:51:55.976529", + "modified": "2018-06-16 12:31:55.710812", "modified_by": "Administrator", "module": "HR", "name": "Job Applicant", @@ -262,7 +344,6 @@ "permissions": [ { "amend": 0, - "apply_user_permissions": 0, "cancel": 0, "create": 1, "delete": 1, diff --git a/erpnext/hr/doctype/job_applicant_source/__init__.py b/erpnext/hr/doctype/job_applicant_source/__init__.py new file mode 100644 index 00000000000..e69de29bb2d diff --git a/erpnext/hr/doctype/job_applicant_source/job_applicant_source.js b/erpnext/hr/doctype/job_applicant_source/job_applicant_source.js new file mode 100644 index 00000000000..8725f2312bb --- /dev/null +++ b/erpnext/hr/doctype/job_applicant_source/job_applicant_source.js @@ -0,0 +1,8 @@ +// Copyright (c) 2018, Frappe Technologies Pvt. Ltd. and contributors +// For license information, please see license.txt + +frappe.ui.form.on('Job Applicant Source', { + refresh: function() { + + } +}); diff --git a/erpnext/hr/doctype/job_applicant_source/job_applicant_source.json b/erpnext/hr/doctype/job_applicant_source/job_applicant_source.json new file mode 100644 index 00000000000..c3bb1eb9f75 --- /dev/null +++ b/erpnext/hr/doctype/job_applicant_source/job_applicant_source.json @@ -0,0 +1,124 @@ +{ + "allow_copy": 0, + "allow_guest_to_view": 0, + "allow_import": 1, + "allow_rename": 1, + "autoname": "field:source_name", + "beta": 0, + "creation": "2018-06-16 12:28:26.432651", + "custom": 0, + "docstatus": 0, + "doctype": "DocType", + "document_type": "", + "editable_grid": 1, + "engine": "InnoDB", + "fields": [ + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "source_name", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Source Name", + "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": 1, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "details", + "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": "Details", + "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, + "translatable": 0, + "unique": 0 + } + ], + "has_web_view": 0, + "hide_heading": 0, + "hide_toolbar": 0, + "idx": 0, + "image_view": 0, + "in_create": 0, + "is_submittable": 0, + "issingle": 0, + "istable": 0, + "max_attachments": 0, + "modified": "2018-06-16 14:53:52.918474", + "modified_by": "Administrator", + "module": "HR", + "name": "Job Applicant Source", + "name_case": "", + "owner": "Administrator", + "permissions": [ + { + "amend": 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": "HR User", + "set_user_permissions": 0, + "share": 1, + "submit": 0, + "write": 1 + } + ], + "quick_entry": 1, + "read_only": 0, + "read_only_onload": 0, + "show_name_in_global_search": 0, + "sort_field": "modified", + "sort_order": "DESC", + "track_changes": 0, + "track_seen": 0 +} \ No newline at end of file diff --git a/erpnext/hr/doctype/job_applicant_source/job_applicant_source.py b/erpnext/hr/doctype/job_applicant_source/job_applicant_source.py new file mode 100644 index 00000000000..5f543d285cf --- /dev/null +++ b/erpnext/hr/doctype/job_applicant_source/job_applicant_source.py @@ -0,0 +1,9 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2018, Frappe Technologies Pvt. Ltd. and contributors +# For license information, please see license.txt + +from __future__ import unicode_literals +from frappe.model.document import Document + +class JobApplicantSource(Document): + pass diff --git a/erpnext/hr/doctype/job_applicant_source/test_job_applicant_source.js b/erpnext/hr/doctype/job_applicant_source/test_job_applicant_source.js new file mode 100644 index 00000000000..c093928f321 --- /dev/null +++ b/erpnext/hr/doctype/job_applicant_source/test_job_applicant_source.js @@ -0,0 +1,23 @@ +/* eslint-disable */ +// rename this file from _test_[name] to test_[name] to activate +// and remove above this line + +QUnit.test("test: Job Applicant Source", function (assert) { + let done = assert.async(); + + // number of asserts + assert.expect(1); + + frappe.run_serially([ + // insert a new Job Applicant Source + () => frappe.tests.make('Job Applicant Source', [ + // values to be set + {key: 'value'} + ]), + () => { + assert.equal(cur_frm.doc.key, 'value'); + }, + () => done() + ]); + +}); diff --git a/erpnext/hr/doctype/job_applicant_source/test_job_applicant_source.py b/erpnext/hr/doctype/job_applicant_source/test_job_applicant_source.py new file mode 100644 index 00000000000..f318df20f7c --- /dev/null +++ b/erpnext/hr/doctype/job_applicant_source/test_job_applicant_source.py @@ -0,0 +1,9 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2018, Frappe Technologies Pvt. Ltd. and Contributors +# See license.txt +from __future__ import unicode_literals + +import unittest + +class TestJobApplicantSource(unittest.TestCase): + pass diff --git a/erpnext/setup/setup_wizard/operations/install_fixtures.py b/erpnext/setup/setup_wizard/operations/install_fixtures.py index f34a436dbab..7500240f24b 100644 --- a/erpnext/setup/setup_wizard/operations/install_fixtures.py +++ b/erpnext/setup/setup_wizard/operations/install_fixtures.py @@ -167,7 +167,6 @@ def install(country=None): {'doctype': 'Activity Type', 'activity_type': _('Execution')}, {'doctype': 'Activity Type', 'activity_type': _('Communication')}, - # Lead Source {'doctype': "Item Attribute", "attribute_name": _("Size"), "item_attribute_values": [ {"attribute_value": _("Extra Small"), "abbr": "XS"}, {"attribute_value": _("Small"), "abbr": "S"}, @@ -184,6 +183,12 @@ def install(country=None): {"attribute_value": _("White"), "abbr": "WHI"} ]}, + #Job Applicant Source + {'doctype': 'Job Applicant Source', 'source_name': _('Website Listing')}, + {'doctype': 'Job Applicant Source', 'source_name': _('Walk In')}, + {'doctype': 'Job Applicant Source', 'source_name': _('Employee Referral')}, + {'doctype': 'Job Applicant Source', 'source_name': _('Campaign')}, + {'doctype': "Email Account", "email_id": "sales@example.com", "append_to": "Opportunity"}, {'doctype': "Email Account", "email_id": "support@example.com", "append_to": "Issue"}, {'doctype': "Email Account", "email_id": "jobs@example.com", "append_to": "Job Applicant"},