feat: appointment Letter (#20104)
* feat: appointment Letter * fix: requested changes Co-authored-by: Nabin Hait <nabinhait@gmail.com>
This commit is contained in:
parent
6c14a08631
commit
1f6cc2b6ec
@ -289,6 +289,10 @@ def get_data():
|
|||||||
"name": "Job Offer",
|
"name": "Job Offer",
|
||||||
"onboard": 1,
|
"onboard": 1,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"type": "doctype",
|
||||||
|
"name": "Appointment Letter",
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"type": "doctype",
|
"type": "doctype",
|
||||||
"name": "Staffing Plan",
|
"name": "Staffing Plan",
|
||||||
|
|||||||
0
erpnext/hr/doctype/appointment_letter/__init__.py
Normal file
0
erpnext/hr/doctype/appointment_letter/__init__.py
Normal file
30
erpnext/hr/doctype/appointment_letter/appointment_letter.js
Normal file
30
erpnext/hr/doctype/appointment_letter/appointment_letter.js
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
// Copyright (c) 2019, Frappe Technologies Pvt. Ltd. and contributors
|
||||||
|
// For license information, please see license.txt
|
||||||
|
|
||||||
|
frappe.ui.form.on('Appointment Letter', {
|
||||||
|
appointment_letter_template: function(frm){
|
||||||
|
if (frm.doc.appointment_letter_template){
|
||||||
|
frappe.call({
|
||||||
|
method: 'erpnext.hr.doctype.appointment_letter.appointment_letter.get_appointment_letter_details',
|
||||||
|
args : {
|
||||||
|
template : frm.doc.appointment_letter_template
|
||||||
|
},
|
||||||
|
callback: function(r){
|
||||||
|
if(r.message){
|
||||||
|
let message_body = r.message;
|
||||||
|
frm.set_value("introduction", message_body[0].introduction);
|
||||||
|
frm.set_value("closing_notes", message_body[0].closing_notes);
|
||||||
|
frm.doc.terms = []
|
||||||
|
for (var i in message_body[1].description){
|
||||||
|
frm.add_child("terms");
|
||||||
|
frm.fields_dict.terms.get_value()[i].title = message_body[1].description[i].title;
|
||||||
|
frm.fields_dict.terms.get_value()[i].description = message_body[1].description[i].description;
|
||||||
|
}
|
||||||
|
frm.refresh();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
});
|
||||||
124
erpnext/hr/doctype/appointment_letter/appointment_letter.json
Normal file
124
erpnext/hr/doctype/appointment_letter/appointment_letter.json
Normal file
@ -0,0 +1,124 @@
|
|||||||
|
{
|
||||||
|
"actions": [],
|
||||||
|
"autoname": "HR-APP-LETTER-.#####",
|
||||||
|
"creation": "2019-12-26 12:35:49.574828",
|
||||||
|
"default_print_format": "Standard Appointment Letter",
|
||||||
|
"doctype": "DocType",
|
||||||
|
"editable_grid": 1,
|
||||||
|
"engine": "InnoDB",
|
||||||
|
"field_order": [
|
||||||
|
"job_applicant",
|
||||||
|
"applicant_name",
|
||||||
|
"column_break_3",
|
||||||
|
"company",
|
||||||
|
"appointment_date",
|
||||||
|
"appointment_letter_template",
|
||||||
|
"body_section",
|
||||||
|
"introduction",
|
||||||
|
"terms",
|
||||||
|
"closing_notes"
|
||||||
|
],
|
||||||
|
"fields": [
|
||||||
|
{
|
||||||
|
"fetch_from": "job_applicant.applicant_name",
|
||||||
|
"fieldname": "applicant_name",
|
||||||
|
"fieldtype": "Data",
|
||||||
|
"in_global_search": 1,
|
||||||
|
"in_list_view": 1,
|
||||||
|
"label": "Applicant Name",
|
||||||
|
"read_only": 1,
|
||||||
|
"reqd": 1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldname": "appointment_date",
|
||||||
|
"fieldtype": "Date",
|
||||||
|
"label": "Appointment Date",
|
||||||
|
"reqd": 1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldname": "appointment_letter_template",
|
||||||
|
"fieldtype": "Link",
|
||||||
|
"label": "Appointment Letter Template",
|
||||||
|
"options": "Appointment Letter Template",
|
||||||
|
"reqd": 1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fetch_from": "appointment_letter_template.introduction",
|
||||||
|
"fieldname": "introduction",
|
||||||
|
"fieldtype": "Long Text",
|
||||||
|
"label": "Introduction",
|
||||||
|
"reqd": 1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldname": "body_section",
|
||||||
|
"fieldtype": "Section Break",
|
||||||
|
"label": "Body"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldname": "column_break_3",
|
||||||
|
"fieldtype": "Column Break"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldname": "job_applicant",
|
||||||
|
"fieldtype": "Link",
|
||||||
|
"label": "Job Applicant",
|
||||||
|
"options": "Job Applicant",
|
||||||
|
"reqd": 1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldname": "company",
|
||||||
|
"fieldtype": "Link",
|
||||||
|
"label": "Company",
|
||||||
|
"options": "Company",
|
||||||
|
"reqd": 1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldname": "closing_notes",
|
||||||
|
"fieldtype": "Text",
|
||||||
|
"label": "Closing Notes"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldname": "terms",
|
||||||
|
"fieldtype": "Table",
|
||||||
|
"label": "Terms",
|
||||||
|
"options": "Appointment Letter content",
|
||||||
|
"reqd": 1
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"links": [],
|
||||||
|
"modified": "2020-01-21 17:30:36.334395",
|
||||||
|
"modified_by": "Administrator",
|
||||||
|
"module": "HR",
|
||||||
|
"name": "Appointment Letter",
|
||||||
|
"name_case": "Title Case",
|
||||||
|
"owner": "Administrator",
|
||||||
|
"permissions": [
|
||||||
|
{
|
||||||
|
"create": 1,
|
||||||
|
"delete": 1,
|
||||||
|
"email": 1,
|
||||||
|
"export": 1,
|
||||||
|
"print": 1,
|
||||||
|
"read": 1,
|
||||||
|
"report": 1,
|
||||||
|
"role": "System Manager",
|
||||||
|
"share": 1,
|
||||||
|
"write": 1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"create": 1,
|
||||||
|
"delete": 1,
|
||||||
|
"email": 1,
|
||||||
|
"export": 1,
|
||||||
|
"print": 1,
|
||||||
|
"read": 1,
|
||||||
|
"report": 1,
|
||||||
|
"role": "HR Manager",
|
||||||
|
"share": 1,
|
||||||
|
"write": 1
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"sort_field": "modified",
|
||||||
|
"sort_order": "DESC",
|
||||||
|
"track_changes": 1
|
||||||
|
}
|
||||||
25
erpnext/hr/doctype/appointment_letter/appointment_letter.py
Normal file
25
erpnext/hr/doctype/appointment_letter/appointment_letter.py
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
# Copyright (c) 2019, Frappe Technologies Pvt. Ltd. and contributors
|
||||||
|
# For license information, please see license.txt
|
||||||
|
|
||||||
|
from __future__ import unicode_literals
|
||||||
|
import frappe
|
||||||
|
from frappe.model.document import Document
|
||||||
|
|
||||||
|
class AppointmentLetter(Document):
|
||||||
|
pass
|
||||||
|
|
||||||
|
@frappe.whitelist()
|
||||||
|
def get_appointment_letter_details(template):
|
||||||
|
body = []
|
||||||
|
intro= frappe.get_list("Appointment Letter Template",
|
||||||
|
fields = ['introduction', 'closing_notes'],
|
||||||
|
filters={'name': template
|
||||||
|
})[0]
|
||||||
|
content = frappe.get_list("Appointment Letter content",
|
||||||
|
fields = ['title', 'description'],
|
||||||
|
filters={'parent': template
|
||||||
|
})
|
||||||
|
body.append(intro)
|
||||||
|
body.append({'description': content})
|
||||||
|
return body
|
||||||
@ -0,0 +1,10 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
# Copyright (c) 2019, Frappe Technologies Pvt. Ltd. and Contributors
|
||||||
|
# See license.txt
|
||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
|
# import frappe
|
||||||
|
import unittest
|
||||||
|
|
||||||
|
class TestAppointmentLetter(unittest.TestCase):
|
||||||
|
pass
|
||||||
@ -0,0 +1,39 @@
|
|||||||
|
{
|
||||||
|
"actions": [],
|
||||||
|
"creation": "2019-12-26 12:22:16.575767",
|
||||||
|
"doctype": "DocType",
|
||||||
|
"editable_grid": 1,
|
||||||
|
"engine": "InnoDB",
|
||||||
|
"field_order": [
|
||||||
|
"title",
|
||||||
|
"description"
|
||||||
|
],
|
||||||
|
"fields": [
|
||||||
|
{
|
||||||
|
"fieldname": "title",
|
||||||
|
"fieldtype": "Data",
|
||||||
|
"in_list_view": 1,
|
||||||
|
"label": "Title",
|
||||||
|
"reqd": 1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldname": "description",
|
||||||
|
"fieldtype": "Long Text",
|
||||||
|
"in_list_view": 1,
|
||||||
|
"label": "Description",
|
||||||
|
"reqd": 1
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"istable": 1,
|
||||||
|
"links": [],
|
||||||
|
"modified": "2019-12-26 12:24:09.824084",
|
||||||
|
"modified_by": "Administrator",
|
||||||
|
"module": "HR",
|
||||||
|
"name": "Appointment Letter content",
|
||||||
|
"owner": "Administrator",
|
||||||
|
"permissions": [],
|
||||||
|
"quick_entry": 1,
|
||||||
|
"sort_field": "modified",
|
||||||
|
"sort_order": "DESC",
|
||||||
|
"track_changes": 1
|
||||||
|
}
|
||||||
@ -0,0 +1,10 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
# Copyright (c) 2019, Frappe Technologies Pvt. Ltd. and contributors
|
||||||
|
# For license information, please see license.txt
|
||||||
|
|
||||||
|
from __future__ import unicode_literals
|
||||||
|
# import frappe
|
||||||
|
from frappe.model.document import Document
|
||||||
|
|
||||||
|
class AppointmentLettercontent(Document):
|
||||||
|
pass
|
||||||
@ -0,0 +1,8 @@
|
|||||||
|
// Copyright (c) 2019, Frappe Technologies Pvt. Ltd. and contributors
|
||||||
|
// For license information, please see license.txt
|
||||||
|
|
||||||
|
frappe.ui.form.on('Appointment Letter Template', {
|
||||||
|
// refresh: function(frm) {
|
||||||
|
|
||||||
|
// }
|
||||||
|
});
|
||||||
@ -0,0 +1,69 @@
|
|||||||
|
{
|
||||||
|
"actions": [],
|
||||||
|
"autoname": "HR-APP-LETTER-TEMP-.#####",
|
||||||
|
"creation": "2019-12-26 12:20:14.219578",
|
||||||
|
"doctype": "DocType",
|
||||||
|
"editable_grid": 1,
|
||||||
|
"engine": "InnoDB",
|
||||||
|
"field_order": [
|
||||||
|
"introduction",
|
||||||
|
"terms",
|
||||||
|
"closing_notes"
|
||||||
|
],
|
||||||
|
"fields": [
|
||||||
|
{
|
||||||
|
"fieldname": "introduction",
|
||||||
|
"fieldtype": "Long Text",
|
||||||
|
"in_list_view": 1,
|
||||||
|
"label": "Introduction",
|
||||||
|
"reqd": 1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldname": "closing_notes",
|
||||||
|
"fieldtype": "Text",
|
||||||
|
"label": "Closing Notes"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldname": "terms",
|
||||||
|
"fieldtype": "Table",
|
||||||
|
"label": "Terms",
|
||||||
|
"options": "Appointment Letter content",
|
||||||
|
"reqd": 1
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"links": [],
|
||||||
|
"modified": "2020-01-21 17:00:46.779420",
|
||||||
|
"modified_by": "Administrator",
|
||||||
|
"module": "HR",
|
||||||
|
"name": "Appointment Letter Template",
|
||||||
|
"owner": "Administrator",
|
||||||
|
"permissions": [
|
||||||
|
{
|
||||||
|
"create": 1,
|
||||||
|
"delete": 1,
|
||||||
|
"email": 1,
|
||||||
|
"export": 1,
|
||||||
|
"print": 1,
|
||||||
|
"read": 1,
|
||||||
|
"report": 1,
|
||||||
|
"role": "System Manager",
|
||||||
|
"share": 1,
|
||||||
|
"write": 1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"create": 1,
|
||||||
|
"delete": 1,
|
||||||
|
"email": 1,
|
||||||
|
"export": 1,
|
||||||
|
"print": 1,
|
||||||
|
"read": 1,
|
||||||
|
"report": 1,
|
||||||
|
"role": "HR Manager",
|
||||||
|
"share": 1,
|
||||||
|
"write": 1
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"sort_field": "modified",
|
||||||
|
"sort_order": "DESC",
|
||||||
|
"track_changes": 1
|
||||||
|
}
|
||||||
@ -0,0 +1,10 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
# Copyright (c) 2019, Frappe Technologies Pvt. Ltd. and contributors
|
||||||
|
# For license information, please see license.txt
|
||||||
|
|
||||||
|
from __future__ import unicode_literals
|
||||||
|
# import frappe
|
||||||
|
from frappe.model.document import Document
|
||||||
|
|
||||||
|
class AppointmentLetterTemplate(Document):
|
||||||
|
pass
|
||||||
@ -0,0 +1,10 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
# Copyright (c) 2019, Frappe Technologies Pvt. Ltd. and Contributors
|
||||||
|
# See license.txt
|
||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
|
# import frappe
|
||||||
|
import unittest
|
||||||
|
|
||||||
|
class TestAppointmentLetterTemplate(unittest.TestCase):
|
||||||
|
pass
|
||||||
@ -0,0 +1,38 @@
|
|||||||
|
{%- from "templates/print_formats/standard_macros.html" import add_header -%}
|
||||||
|
|
||||||
|
<div class="text-center" style="margin-bottom: 10%;"><h3>Appointment Letter</h3></div>
|
||||||
|
<div class ='row' style="margin-bottom: 5%;">
|
||||||
|
<div class = "col-sm-6">
|
||||||
|
<b>{{ doc.applicant_name }},</b>
|
||||||
|
</div>
|
||||||
|
<div class="col-sm-6">
|
||||||
|
<span style = "float: right;"><b> Date: </b>{{ doc.appointment_date }}</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div style="margin-bottom: 5%;">
|
||||||
|
{{ doc.introduction }}
|
||||||
|
</div>
|
||||||
|
<div style="margin-bottom: 5%;">
|
||||||
|
<ul>
|
||||||
|
{% for content in doc.terms %}
|
||||||
|
<li style="padding-bottom: 3%;">
|
||||||
|
<span>
|
||||||
|
<span><b>{{ content.title }}: </b></span> {{ content.description }}
|
||||||
|
</span>
|
||||||
|
</li>
|
||||||
|
{% endfor %}
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<div style="margin-bottom: 5%;">
|
||||||
|
<span>Your sincerely,</span><br>
|
||||||
|
<span><b>For {{ doc.company }}</b></span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div style="margin-bottom: 5%;">
|
||||||
|
<span>{{ doc.closing_notes }}</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<span><b>________________</b></span><br>
|
||||||
|
<span><b>{{ doc.applicant_name }}</b></span>
|
||||||
|
</div>
|
||||||
@ -0,0 +1,23 @@
|
|||||||
|
{
|
||||||
|
"align_labels_right": 0,
|
||||||
|
"creation": "2019-12-26 15:22:44.200332",
|
||||||
|
"custom_format": 0,
|
||||||
|
"default_print_language": "en",
|
||||||
|
"disabled": 0,
|
||||||
|
"doc_type": "Appointment Letter",
|
||||||
|
"docstatus": 0,
|
||||||
|
"doctype": "Print Format",
|
||||||
|
"font": "Default",
|
||||||
|
"idx": 0,
|
||||||
|
"line_breaks": 0,
|
||||||
|
"modified": "2020-01-21 17:24:16.705082",
|
||||||
|
"modified_by": "Administrator",
|
||||||
|
"module": "HR",
|
||||||
|
"name": "Standard Appointment Letter",
|
||||||
|
"owner": "Administrator",
|
||||||
|
"print_format_builder": 0,
|
||||||
|
"print_format_type": "Jinja",
|
||||||
|
"raw_printing": 0,
|
||||||
|
"show_section_headings": 0,
|
||||||
|
"standard": "Yes"
|
||||||
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user