From e1d620b1685dab17fc2851c3a6bf0e3dcb352eba Mon Sep 17 00:00:00 2001 From: Neil Trini Lasrado Date: Wed, 4 Mar 2015 16:01:45 +0530 Subject: [PATCH] Offer Letter - New Doctype added and job_applicant naming changed --- erpnext/config/hr.py | 5 + .../doctype/job_applicant/job_applicant.json | 11 +- erpnext/hr/doctype/offer_letter/__init__.py | 0 .../hr/doctype/offer_letter/offer_letter.js | 14 ++ .../hr/doctype/offer_letter/offer_letter.json | 233 ++++++++++++++++++ .../hr/doctype/offer_letter/offer_letter.py | 13 + .../doctype/offer_letter/test_offer_letter.py | 11 + 7 files changed, 286 insertions(+), 1 deletion(-) create mode 100644 erpnext/hr/doctype/offer_letter/__init__.py create mode 100644 erpnext/hr/doctype/offer_letter/offer_letter.js create mode 100644 erpnext/hr/doctype/offer_letter/offer_letter.json create mode 100644 erpnext/hr/doctype/offer_letter/offer_letter.py create mode 100644 erpnext/hr/doctype/offer_letter/test_offer_letter.py diff --git a/erpnext/config/hr.py b/erpnext/config/hr.py index 4353733a31..608e1bb5fa 100644 --- a/erpnext/config/hr.py +++ b/erpnext/config/hr.py @@ -47,6 +47,11 @@ def get_data(): "name": "Job Opening", "description": _("Opening for a Job."), }, + { + "type": "doctype", + "name": "Offer Letter", + "description": _("Offer candidate a Job."), + }, ] }, { diff --git a/erpnext/hr/doctype/job_applicant/job_applicant.json b/erpnext/hr/doctype/job_applicant/job_applicant.json index fbedc1f0b4..3ba3012f3d 100644 --- a/erpnext/hr/doctype/job_applicant/job_applicant.json +++ b/erpnext/hr/doctype/job_applicant/job_applicant.json @@ -1,5 +1,9 @@ { +<<<<<<< HEAD "autoname": "", +======= + "autoname": "JA-.######", +>>>>>>> Offer Letter - New Doctype added and job_applicant naming changed "creation": "2013-01-29 19:25:37", "description": "Applicant for a Job", "docstatus": 0, @@ -66,7 +70,11 @@ ], "icon": "icon-user", "idx": 1, +<<<<<<< HEAD "modified": "2015-03-23 05:42:02.016041", +======= + "modified": "2015-03-04 15:30:02.663549", +>>>>>>> Offer Letter - New Doctype added and job_applicant naming changed "modified_by": "Administrator", "module": "HR", "name": "Job Applicant", @@ -85,5 +93,6 @@ "share": 1, "write": 1 } - ] + ], + "title_field": "applicant_name" } \ No newline at end of file diff --git a/erpnext/hr/doctype/offer_letter/__init__.py b/erpnext/hr/doctype/offer_letter/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/erpnext/hr/doctype/offer_letter/offer_letter.js b/erpnext/hr/doctype/offer_letter/offer_letter.js new file mode 100644 index 0000000000..9b057a2a40 --- /dev/null +++ b/erpnext/hr/doctype/offer_letter/offer_letter.js @@ -0,0 +1,14 @@ +// Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors +// License: GNU General Public License v3. See license.txt + +cur_frm.cscript.job_applicant = function() { + frappe.call({ + doc: cur_frm.doc, + method: "set_applicant_name", + callback: function(r) { + if(!r.exe){ + refresh_field("applicant_name"); + } + } + }); +} \ No newline at end of file diff --git a/erpnext/hr/doctype/offer_letter/offer_letter.json b/erpnext/hr/doctype/offer_letter/offer_letter.json new file mode 100644 index 0000000000..7d7f27a81c --- /dev/null +++ b/erpnext/hr/doctype/offer_letter/offer_letter.json @@ -0,0 +1,233 @@ +{ + "allow_copy": 0, + "allow_import": 0, + "allow_rename": 0, + "autoname": "OL-.######", + "creation": "2015-03-04 14:20:17.662207", + "custom": 0, + "docstatus": 0, + "doctype": "DocType", + "document_type": "Transaction", + "fields": [ + { + "allow_on_submit": 0, + "fieldname": "job_applicant", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, + "label": "Job Applicant", + "no_copy": 0, + "options": "Job Applicant", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 1, + "search_index": 0, + "set_only_once": 0 + }, + { + "fieldname": "applicant_name", + "fieldtype": "Data", + "label": "Applicant Name", + "permlevel": 0, + "precision": "", + "read_only": 1 + }, + { + "fieldname": "column_break_3", + "fieldtype": "Column Break", + "permlevel": 0, + "precision": "" + }, + { + "fieldname": "status", + "fieldtype": "Select", + "label": "Status", + "options": "Awaiting Response\nAccepted\nRejected ", + "permlevel": 0, + "precision": "" + }, + { + "allow_on_submit": 0, + "fieldname": "desgnation", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, + "label": "Designation", + "no_copy": 0, + "options": "Designation", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0 + }, + { + "fieldname": "section_break_4", + "fieldtype": "Section Break", + "permlevel": 0, + "precision": "" + }, + { + "allow_on_submit": 0, + "fieldname": "expected_joining_date", + "fieldtype": "Date", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, + "label": "Expected Joining Date", + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0 + }, + { + "fieldname": "column_break_7", + "fieldtype": "Column Break", + "permlevel": 0, + "precision": "" + }, + { + "allow_on_submit": 0, + "description": "In months.", + "fieldname": "probation_period", + "fieldtype": "Int", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, + "label": "Probation Period", + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0 + }, + { + "fieldname": "section_break_9", + "fieldtype": "Section Break", + "permlevel": 0, + "precision": "" + }, + { + "allow_on_submit": 0, + "fieldname": "salary", + "fieldtype": "Currency", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, + "label": "Salary", + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0 + }, + { + "fieldname": "column_break_11", + "fieldtype": "Column Break", + "permlevel": 0, + "precision": "" + }, + { + "allow_on_submit": 0, + "fieldname": "terms", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, + "label": "Terms", + "no_copy": 0, + "options": "Terms and Conditions", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0 + }, + { + "fieldname": "amended_from", + "fieldtype": "Link", + "label": "Amended From", + "no_copy": 1, + "options": "Offer Letter", + "permlevel": 0, + "print_hide": 1, + "read_only": 1 + } + ], + "hide_heading": 0, + "hide_toolbar": 0, + "in_create": 0, + "in_dialog": 0, + "is_submittable": 1, + "issingle": 0, + "istable": 0, + "modified": "2015-03-04 15:51:12.341615", + "modified_by": "Administrator", + "module": "HR", + "name": "Offer Letter", + "name_case": "", + "owner": "Administrator", + "permissions": [ + { + "amend": 1, + "apply_user_permissions": 0, + "cancel": 1, + "create": 1, + "delete": 1, + "email": 0, + "export": 0, + "import": 0, + "permlevel": 0, + "print": 0, + "read": 1, + "report": 0, + "role": "HR Manager", + "set_user_permissions": 0, + "share": 0, + "submit": 1, + "write": 1 + }, + { + "create": 1, + "permlevel": 0, + "read": 1, + "role": "HR User", + "write": 1 + } + ], + "read_only": 0, + "read_only_onload": 0, + "sort_field": "modified", + "sort_order": "DESC", + "title_field": "job_applicant" +} \ No newline at end of file diff --git a/erpnext/hr/doctype/offer_letter/offer_letter.py b/erpnext/hr/doctype/offer_letter/offer_letter.py new file mode 100644 index 0000000000..e41efbec77 --- /dev/null +++ b/erpnext/hr/doctype/offer_letter/offer_letter.py @@ -0,0 +1,13 @@ +# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors and contributors +# For license information, please see license.txt + +from __future__ import unicode_literals +import frappe +from frappe.model.document import Document + +class OfferLetter(Document): + def validate(self): + self.set_applicant_name() + + def set_applicant_name(self): + self.applicant_name = frappe.db.get_value("Job Applicant", self.job_applicant, "applicant_name") diff --git a/erpnext/hr/doctype/offer_letter/test_offer_letter.py b/erpnext/hr/doctype/offer_letter/test_offer_letter.py new file mode 100644 index 0000000000..69d2df691e --- /dev/null +++ b/erpnext/hr/doctype/offer_letter/test_offer_letter.py @@ -0,0 +1,11 @@ +# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors and Contributors +# See license.txt +from __future__ import unicode_literals + +import frappe +import unittest + +# test_records = frappe.get_test_records('Offer Letter') + +class TestOfferLetter(unittest.TestCase): + pass