Merge branch 'develop' into HR-fix

This commit is contained in:
Suraj Shetty
2020-08-14 16:12:28 +05:30
committed by GitHub
630 changed files with 24811 additions and 19429 deletions

View File

@@ -0,0 +1,27 @@
{
"chart_name": "Attendance Count",
"chart_type": "Report",
"creation": "2020-07-22 11:56:32.730068",
"custom_options": "{\n\t\t\"type\": \"line\",\n\t\t\"axisOptions\": {\n\t\t\t\"shortenYAxisNumbers\": 1\n\t\t},\n\t\t\"tooltipOptions\": {}\n\t}",
"docstatus": 0,
"doctype": "Dashboard Chart",
"dynamic_filters_json": "{\"month\":\"frappe.datetime.str_to_obj(frappe.datetime.get_today()).getMonth() + 1\",\"year\":\"frappe.datetime.str_to_obj(frappe.datetime.get_today()).getFullYear();\",\"company\":\"frappe.defaults.get_user_default(\\\"Company\\\")\"}",
"filters_json": "{}",
"group_by_type": "Count",
"idx": 0,
"is_public": 1,
"is_standard": 1,
"modified": "2020-07-22 14:32:40.334424",
"modified_by": "Administrator",
"module": "HR",
"name": "Attendance Count",
"number_of_groups": 0,
"owner": "Administrator",
"report_name": "Monthly Attendance Sheet",
"time_interval": "Yearly",
"timeseries": 0,
"timespan": "Last Year",
"type": "Line",
"use_report_chart": 1,
"y_axis": []
}

View File

@@ -0,0 +1,29 @@
{
"chart_name": "Department Wise Employee Count",
"chart_type": "Group By",
"creation": "2020-07-22 11:56:32.760730",
"custom_options": "",
"docstatus": 0,
"doctype": "Dashboard Chart",
"document_type": "Employee",
"dynamic_filters_json": "[[\"Employee\",\"company\",\"=\",\"frappe.defaults.get_user_default(\\\"Company\\\")\"]]",
"filters_json": "[[\"Employee\",\"status\",\"=\",\"Active\",false]]",
"group_by_based_on": "department",
"group_by_type": "Count",
"idx": 0,
"is_public": 1,
"is_standard": 1,
"last_synced_on": "2020-07-22 14:27:40.574194",
"modified": "2020-07-22 14:33:38.036794",
"modified_by": "Administrator",
"module": "HR",
"name": "Department Wise Employee Count",
"number_of_groups": 0,
"owner": "Administrator",
"time_interval": "Yearly",
"timeseries": 0,
"timespan": "Last Year",
"type": "Donut",
"use_report_chart": 0,
"y_axis": []
}

View File

@@ -0,0 +1,29 @@
{
"aggregate_function_based_on": "planned_vacancies",
"chart_name": "Department Wise Openings",
"chart_type": "Group By",
"creation": "2020-07-22 11:56:32.849775",
"custom_options": "",
"docstatus": 0,
"doctype": "Dashboard Chart",
"document_type": "Job Opening",
"filters_json": "[]",
"group_by_based_on": "department",
"group_by_type": "Sum",
"idx": 0,
"is_public": 1,
"is_standard": 1,
"last_synced_on": "2020-07-22 14:33:44.834801",
"modified": "2020-07-22 14:34:45.273591",
"modified_by": "Administrator",
"module": "HR",
"name": "Department Wise Openings",
"number_of_groups": 0,
"owner": "Administrator",
"time_interval": "Monthly",
"timeseries": 0,
"timespan": "Last Year",
"type": "Bar",
"use_report_chart": 0,
"y_axis": []
}

View File

@@ -0,0 +1,29 @@
{
"chart_name": "Designation Wise Employee Count",
"chart_type": "Group By",
"creation": "2020-07-22 11:56:32.790337",
"custom_options": "",
"docstatus": 0,
"doctype": "Dashboard Chart",
"document_type": "Employee",
"dynamic_filters_json": "[[\"Employee\",\"company\",\"=\",\"frappe.defaults.get_user_default(\\\"Company\\\")\"]]",
"filters_json": "[[\"Employee\",\"status\",\"=\",\"Active\",false]]",
"group_by_based_on": "designation",
"group_by_type": "Count",
"idx": 0,
"is_public": 1,
"is_standard": 1,
"last_synced_on": "2020-07-22 14:27:40.602783",
"modified": "2020-07-22 14:31:49.665555",
"modified_by": "Administrator",
"module": "HR",
"name": "Designation Wise Employee Count",
"number_of_groups": 0,
"owner": "Administrator",
"time_interval": "Yearly",
"timeseries": 0,
"timespan": "Last Year",
"type": "Donut",
"use_report_chart": 0,
"y_axis": []
}

View File

@@ -0,0 +1,30 @@
{
"aggregate_function_based_on": "planned_vacancies",
"chart_name": "Designation Wise Openings",
"chart_type": "Group By",
"creation": "2020-07-22 11:56:32.820217",
"custom_options": "",
"docstatus": 0,
"doctype": "Dashboard Chart",
"document_type": "Job Opening",
"dynamic_filters_json": "",
"filters_json": "[]",
"group_by_based_on": "designation",
"group_by_type": "Sum",
"idx": 0,
"is_public": 1,
"is_standard": 1,
"last_synced_on": "2020-07-22 14:33:44.806626",
"modified": "2020-07-22 14:34:32.711881",
"modified_by": "Administrator",
"module": "HR",
"name": "Designation Wise Openings",
"number_of_groups": 0,
"owner": "Administrator",
"time_interval": "Monthly",
"timeseries": 0,
"timespan": "Last Year",
"type": "Bar",
"use_report_chart": 0,
"y_axis": []
}

View File

@@ -0,0 +1,29 @@
{
"chart_name": "Gender Diversity Ratio",
"chart_type": "Group By",
"creation": "2020-07-22 11:56:32.667291",
"custom_options": "",
"docstatus": 0,
"doctype": "Dashboard Chart",
"document_type": "Employee",
"dynamic_filters_json": "[[\"Employee\",\"company\",\"=\",\"frappe.defaults.get_user_default(\\\"Company\\\")\"]]",
"filters_json": "[[\"Employee\",\"status\",\"=\",\"Active\",false]]",
"group_by_based_on": "gender",
"group_by_type": "Count",
"idx": 0,
"is_public": 1,
"is_standard": 1,
"last_synced_on": "2020-07-22 14:27:40.143783",
"modified": "2020-07-22 14:32:50.962459",
"modified_by": "Administrator",
"module": "HR",
"name": "Gender Diversity Ratio",
"number_of_groups": 0,
"owner": "Administrator",
"time_interval": "Yearly",
"timeseries": 0,
"timespan": "Last Year",
"type": "Pie",
"use_report_chart": 0,
"y_axis": []
}

View File

@@ -0,0 +1,29 @@
{
"chart_name": "Job Application Status",
"chart_type": "Group By",
"creation": "2020-07-22 11:56:32.699696",
"custom_options": "",
"docstatus": 0,
"doctype": "Dashboard Chart",
"document_type": "Job Applicant",
"dynamic_filters_json": "",
"filters_json": "[[\"Job Applicant\",\"creation\",\"Timespan\",\"last month\",false]]",
"group_by_based_on": "status",
"group_by_type": "Count",
"idx": 0,
"is_public": 1,
"is_standard": 1,
"last_synced_on": "2020-07-28 16:19:12.109979",
"modified": "2020-07-28 16:19:45.279490",
"modified_by": "Administrator",
"module": "HR",
"name": "Job Application Status",
"number_of_groups": 0,
"owner": "Administrator",
"time_interval": "Yearly",
"timeseries": 0,
"timespan": "Last Year",
"type": "Pie",
"use_report_chart": 0,
"y_axis": []
}

View File

@@ -1,190 +0,0 @@
# Copyright (c) 2020, Frappe Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
import frappe
import erpnext
import json
from frappe import _
def get_data():
return frappe._dict({
"dashboards": get_dashboards(),
"charts": get_charts(),
"number_cards": get_number_cards(),
})
def get_dashboards():
dashboards = []
dashboards.append(get_human_resource_dashboard())
return dashboards
def get_human_resource_dashboard():
return {
"name": "Human Resource",
"dashboard_name": "Human Resource",
"is_default": 1,
"charts": [
{ "chart": "Attendance Count", "width": "Full"},
{ "chart": "Gender Diversity Ratio", "width": "Half"},
{ "chart": "Job Application Status", "width": "Half"},
{ "chart": 'Designation Wise Employee Count', "width": "Half"},
{ "chart": 'Department Wise Employee Count', "width": "Half"},
{ "chart": 'Designation Wise Openings', "width": "Half"},
{ "chart": 'Department Wise Openings', "width": "Half"}
],
"cards": [
{"card": "Total Employees"},
{"card": "New Joinees (Last year)"},
{'card': "Employees Left (Last year)"},
{'card': "Total Applicants (Last month)"},
]
}
def get_recruitment_dashboard():
pass
def get_charts():
company = erpnext.get_default_company()
date = frappe.utils.get_datetime()
month_map = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov","Dec"]
if not company:
company = frappe.db.get_value("Company", {"is_group": 0}, "name")
dashboard_charts = [
get_dashboards_chart_doc('Gender Diversity Ratio', "Group By", "Pie",
document_type = "Employee", group_by_type="Count", group_by_based_on="gender",
filters_json = json.dumps([["Employee", "status", "=", "Active"]]))
]
dashboard_charts.append(
get_dashboards_chart_doc('Job Application Status', "Group By", "Pie",
document_type = "Job Applicant", group_by_type="Count", group_by_based_on="status",
filters_json = json.dumps([["Job Applicant", "creation", "Previous", "1 month"]]))
)
custom_options = '''{
"type": "line",
"axisOptions": {
"shortenYAxisNumbers": 1
},
"tooltipOptions": {}
}'''
filters_json = json.dumps({
"month": month_map[date.month - 1],
"year": str(date.year),
"company":company
})
dashboard_charts.append(
get_dashboards_chart_doc('Attendance Count', "Report", "Line",
report_name = "Monthly Attendance Sheet", is_custom =1, group_by_type="Count",
filters_json = filters_json, custom_options=custom_options)
)
dashboard_charts.append(
get_dashboards_chart_doc('Department Wise Employee Count', "Group By", "Donut",
document_type = "Employee", group_by_type="Count", group_by_based_on="department",
filters_json = json.dumps([["Employee", "status", "=", "Active"]]))
)
dashboard_charts.append(
get_dashboards_chart_doc('Designation Wise Employee Count', "Group By", "Donut",
document_type = "Employee", group_by_type="Count", group_by_based_on="designation",
filters_json = json.dumps([["Employee", "status", "=", "Active"]]))
)
dashboard_charts.append(
get_dashboards_chart_doc('Designation Wise Openings', "Group By", "Bar",
document_type = "Job Opening", group_by_type="Sum", group_by_based_on="designation",
time_interval = "Monthly", aggregate_function_based_on = "planned_vacancies")
)
dashboard_charts.append(
get_dashboards_chart_doc('Department Wise Openings', "Group By", "Bar",
document_type = "Job Opening", group_by_type="Sum", group_by_based_on="department",
time_interval = "Monthly", aggregate_function_based_on = "planned_vacancies")
)
return dashboard_charts
def get_number_cards():
number_cards = []
number_cards = [
get_number_cards_doc("Employee", "Total Employees", filters_json = json.dumps([
["Employee","status","=","Active"]
])
)
]
number_cards.append(
get_number_cards_doc("Employee", "New Joinees (Last year)", filters_json = json.dumps([
["Employee","date_of_joining","Timespan","last year"],
["Employee","status","=","Active"]
])
)
)
number_cards.append(
get_number_cards_doc("Employee", "Employees Left (Last year)", filters_json = json.dumps([
["Employee", "relieving_date", "Timespan", "last year"],
["Employee", "status", "=", "Left"]
])
)
)
number_cards.append(
get_number_cards_doc("Job Applicant", "Total Applicants (Last month)", filters_json = json.dumps([
["Job Applicant", "creation", "Timespan", "last month"]
])
)
)
return number_cards
def get_number_cards_doc(document_type, label, **args):
args = frappe._dict(args)
return {
"doctype": "Number Card",
"document_type": document_type,
"function": args.func or "Count",
"is_public": args.is_public or 1,
"label": _(label),
"name": args.name or label,
"show_percentage_stats": args.show_percentage_stats or 1,
"stats_time_interval": args.stats_time_interval or 'Monthly',
"filters_json": args.filters_json or '[]',
"aggregate_function_based_on": args.aggregate_function_based_on or None
}
def get_dashboards_chart_doc(name, chart_type, graph_type, **args):
args = frappe._dict(args)
return {
"name": name,
"chart_name": _(args.chart_name or name),
"chart_type": chart_type,
"document_type": args.document_type or None,
"report_name": args.report_name or None,
"is_custom": args.is_custom or 0,
"group_by_type": args.group_by_type or None,
"group_by_based_on": args.group_by_based_on or None,
"based_on": args.based_on or None,
"value_based_on": args.value_based_on or None,
"number_of_groups": args.number_of_groups or 0,
"is_public": args.is_public or 1,
"timespan": args.timespan or "Last Year",
"time_interval": args.time_interval or "Yearly",
"timeseries": args.timeseries or 0,
"filters_json": args.filters_json or '[]',
"type": graph_type,
"custom_options": args.custom_options or '',
"doctype": "Dashboard Chart",
"aggregate_function_based_on": args.aggregate_function_based_on or None
}

View File

@@ -78,7 +78,7 @@
"idx": 0,
"is_standard": 1,
"label": "HR",
"modified": "2020-06-16 19:20:50.976045",
"modified": "2020-08-11 17:04:38.655417",
"modified_by": "Administrator",
"module": "HR",
"name": "HR",
@@ -88,7 +88,7 @@
"pin_to_top": 0,
"shortcuts": [
{
"color": "#9deca2",
"color": "#cef6d1",
"format": "{} Active",
"label": "Employee",
"link_to": "Employee",
@@ -96,18 +96,19 @@
"type": "DocType"
},
{
"label": "Attendance",
"link_to": "Attendance",
"stats_filter": "",
"type": "DocType"
},
{
"color": "#ffe8cd",
"format": "{} Open",
"label": "Leave Application",
"link_to": "Leave Application",
"stats_filter": "{\"status\":\"Open\"}",
"type": "DocType"
},
{
"label": "Attendance",
"link_to": "Attendance",
"stats_filter": "",
"type": "DocType"
},
{
"label": "Job Applicant",
"link_to": "Job Applicant",

View File

@@ -11,6 +11,7 @@ class DepartmentApprover(Document):
pass
@frappe.whitelist()
@frappe.validate_and_sanitize_search_inputs
def get_approvers(doctype, txt, searchfield, start, page_len, filters):
if not filters.get("employee"):

View File

@@ -41,8 +41,7 @@
"fieldtype": "Select",
"in_list_view": 1,
"label": "Log Type",
"options": "\nIN\nOUT",
"reqd": 1
"options": "\nIN\nOUT"
},
{
"fieldname": "shift",
@@ -108,7 +107,7 @@
}
],
"links": [],
"modified": "2020-01-23 04:57:42.551355",
"modified": "2020-07-08 11:02:32.660986",
"modified_by": "Administrator",
"module": "HR",
"name": "Employee Checkin",

View File

@@ -8,10 +8,20 @@ frappe.ui.form.on('Employee Onboarding', {
frm.add_fetch("employee_onboarding_template", "designation", "designation");
frm.add_fetch("employee_onboarding_template", "employee_grade", "employee_grade");
frm.set_query("job_applicant", function () {
return {
filters:{
"status": "Accepted",
}
};
});
frm.set_query('job_offer', function () {
return {
filters: {
'job_applicant': frm.doc.job_applicant
'job_applicant': frm.doc.job_applicant,
'docstatus': 1
}
};
});

View File

@@ -1,620 +1,203 @@
{
"allow_copy": 0,
"allow_guest_to_view": 0,
"allow_import": 0,
"allow_rename": 0,
"autoname": "HR-EMP-ONB-.YYYY.-.#####",
"beta": 0,
"creation": "2018-05-09 04:57:20.016220",
"custom": 0,
"docstatus": 0,
"doctype": "DocType",
"document_type": "",
"editable_grid": 1,
"engine": "InnoDB",
"actions": [],
"autoname": "HR-EMP-ONB-.YYYY.-.#####",
"creation": "2018-05-09 04:57:20.016220",
"doctype": "DocType",
"editable_grid": 1,
"engine": "InnoDB",
"field_order": [
"job_applicant",
"job_offer",
"employee_name",
"employee",
"date_of_joining",
"boarding_status",
"notify_users_by_email",
"column_break_7",
"employee_onboarding_template",
"company",
"department",
"designation",
"employee_grade",
"project",
"table_for_activity",
"activities",
"amended_from"
],
"fields": [
{
"allow_bulk_edit": 0,
"allow_in_quick_entry": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "job_applicant",
"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": "Job Applicant",
"length": 0,
"no_copy": 0,
"options": "Job Applicant",
"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_in_quick_entry": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "job_offer",
"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": "Job Offer",
"length": 0,
"no_copy": 0,
"options": "Job Offer",
"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_in_quick_entry": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fetch_from": "job_applicant.applicant_name",
"fieldname": "employee_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": "Employee Name",
"length": 0,
"no_copy": 0,
"options": "",
"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_in_quick_entry": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "employee",
"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": "Employee",
"length": 0,
"no_copy": 0,
"options": "Employee",
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 1,
"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_in_quick_entry": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "date_of_joining",
"fieldtype": "Date",
"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": "Date of Joining",
"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
},
{
"allow_bulk_edit": 0,
"allow_in_quick_entry": 0,
"allow_on_submit": 1,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "boarding_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": "\nPending\nIn Process\nCompleted",
"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
"fieldname": "job_applicant",
"fieldtype": "Link",
"label": "Job Applicant",
"options": "Job Applicant",
"reqd": 1,
"show_days": 1,
"show_seconds": 1
},
{
"allow_bulk_edit": 0,
"allow_in_quick_entry": 0,
"allow_on_submit": 1,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "notify_users_by_email",
"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": "Notify users by email",
"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
},
"fieldname": "job_offer",
"fieldtype": "Link",
"label": "Job Offer",
"options": "Job Offer",
"reqd": 1,
"show_days": 1,
"show_seconds": 1
},
{
"allow_bulk_edit": 0,
"allow_in_quick_entry": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "column_break_7",
"fieldtype": "Column Break",
"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,
"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
},
"fetch_from": "job_applicant.applicant_name",
"fieldname": "employee_name",
"fieldtype": "Data",
"in_list_view": 1,
"label": "Employee Name",
"reqd": 1,
"show_days": 1,
"show_seconds": 1
},
{
"allow_bulk_edit": 0,
"allow_in_quick_entry": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "employee_onboarding_template",
"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": "Employee Onboarding Template",
"length": 0,
"no_copy": 0,
"options": "Employee Onboarding Template",
"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
},
"fieldname": "employee",
"fieldtype": "Link",
"label": "Employee",
"options": "Employee",
"read_only": 1,
"show_days": 1,
"show_seconds": 1
},
{
"allow_bulk_edit": 0,
"allow_in_quick_entry": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "company",
"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": "Company",
"length": 0,
"no_copy": 0,
"options": "Company",
"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
},
"fieldname": "date_of_joining",
"fieldtype": "Date",
"in_list_view": 1,
"label": "Date of Joining",
"show_days": 1,
"show_seconds": 1
},
{
"allow_bulk_edit": 0,
"allow_in_quick_entry": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "department",
"fieldtype": "Link",
"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": "Department",
"length": 0,
"no_copy": 0,
"options": "Department",
"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_on_submit": 1,
"fieldname": "boarding_status",
"fieldtype": "Select",
"label": "Status",
"options": "\nPending\nIn Process\nCompleted",
"show_days": 1,
"show_seconds": 1
},
{
"allow_bulk_edit": 0,
"allow_in_quick_entry": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "designation",
"fieldtype": "Link",
"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": "Designation",
"length": 0,
"no_copy": 0,
"options": "Designation",
"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_on_submit": 1,
"default": "0",
"fieldname": "notify_users_by_email",
"fieldtype": "Check",
"label": "Notify users by email",
"show_days": 1,
"show_seconds": 1
},
{
"allow_bulk_edit": 0,
"allow_in_quick_entry": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "employee_grade",
"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": "Employee Grade",
"length": 0,
"no_copy": 0,
"options": "Employee Grade",
"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
},
"fieldname": "column_break_7",
"fieldtype": "Column Break",
"show_days": 1,
"show_seconds": 1
},
{
"allow_bulk_edit": 0,
"allow_in_quick_entry": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "project",
"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": "Project",
"length": 0,
"no_copy": 0,
"options": "Project",
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 1,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
"fieldname": "employee_onboarding_template",
"fieldtype": "Link",
"label": "Employee Onboarding Template",
"options": "Employee Onboarding Template",
"show_days": 1,
"show_seconds": 1
},
{
"allow_bulk_edit": 0,
"allow_in_quick_entry": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "table_for_activity",
"fieldtype": "Section Break",
"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": "",
"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
},
"fieldname": "company",
"fieldtype": "Link",
"label": "Company",
"options": "Company",
"show_days": 1,
"show_seconds": 1
},
{
"allow_bulk_edit": 0,
"allow_in_quick_entry": 0,
"allow_on_submit": 1,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "activities",
"fieldtype": "Table",
"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": "Activities",
"length": 0,
"no_copy": 0,
"options": "Employee Boarding Activity",
"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
},
"fieldname": "department",
"fieldtype": "Link",
"in_list_view": 1,
"label": "Department",
"options": "Department",
"show_days": 1,
"show_seconds": 1
},
{
"allow_bulk_edit": 0,
"allow_in_quick_entry": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "amended_from",
"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": "Amended From",
"length": 0,
"no_copy": 1,
"options": "Employee Onboarding",
"permlevel": 0,
"print_hide": 1,
"print_hide_if_no_value": 0,
"read_only": 1,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
"fieldname": "designation",
"fieldtype": "Link",
"in_list_view": 1,
"label": "Designation",
"options": "Designation",
"show_days": 1,
"show_seconds": 1
},
{
"fieldname": "employee_grade",
"fieldtype": "Link",
"label": "Employee Grade",
"options": "Employee Grade",
"show_days": 1,
"show_seconds": 1
},
{
"fieldname": "project",
"fieldtype": "Link",
"label": "Project",
"options": "Project",
"read_only": 1,
"show_days": 1,
"show_seconds": 1
},
{
"fieldname": "table_for_activity",
"fieldtype": "Section Break",
"show_days": 1,
"show_seconds": 1
},
{
"allow_on_submit": 1,
"fieldname": "activities",
"fieldtype": "Table",
"label": "Activities",
"options": "Employee Boarding Activity",
"show_days": 1,
"show_seconds": 1
},
{
"fieldname": "amended_from",
"fieldtype": "Link",
"label": "Amended From",
"no_copy": 1,
"options": "Employee Onboarding",
"print_hide": 1,
"read_only": 1,
"show_days": 1,
"show_seconds": 1
}
],
"has_web_view": 0,
"hide_heading": 0,
"hide_toolbar": 0,
"idx": 0,
"image_view": 0,
"in_create": 0,
"is_submittable": 1,
"issingle": 0,
"istable": 0,
"max_attachments": 0,
"modified": "2019-08-01 16:15:55.968224",
"modified_by": "Administrator",
"module": "HR",
"name": "Employee Onboarding",
"name_case": "",
"owner": "Administrator",
],
"is_submittable": 1,
"links": [],
"modified": "2020-06-25 15:22:24.923835",
"modified_by": "Administrator",
"module": "HR",
"name": "Employee Onboarding",
"owner": "Administrator",
"permissions": [
{
"amend": 1,
"cancel": 1,
"create": 1,
"delete": 1,
"email": 1,
"export": 1,
"if_owner": 0,
"import": 0,
"permlevel": 0,
"print": 1,
"read": 1,
"report": 1,
"role": "System Manager",
"set_user_permissions": 0,
"share": 1,
"submit": 1,
"amend": 1,
"cancel": 1,
"create": 1,
"delete": 1,
"email": 1,
"export": 1,
"print": 1,
"read": 1,
"report": 1,
"role": "System Manager",
"share": 1,
"submit": 1,
"write": 1
}
],
"quick_entry": 0,
"read_only": 0,
"read_only_onload": 0,
"show_name_in_global_search": 0,
"sort_field": "modified",
"sort_order": "DESC",
"title_field": "employee_name",
"track_changes": 1,
"track_seen": 0,
"track_views": 0
],
"sort_field": "modified",
"sort_order": "DESC",
"title_field": "employee_name",
"track_changes": 1
}

View File

@@ -13,6 +13,12 @@ class IncompleteTaskError(frappe.ValidationError): pass
class EmployeeOnboarding(EmployeeBoardingController):
def validate(self):
super(EmployeeOnboarding, self).validate()
self.validate_duplicate_employee_onboarding()
def validate_duplicate_employee_onboarding(self):
emp_onboarding = frappe.db.exists("Employee Onboarding",{"job_applicant": self.job_applicant})
if emp_onboarding and emp_onboarding != self.name:
frappe.throw(_("Employee Onboarding: {0} is already for Job Applicant: {1}").format(frappe.bold(emp_onboarding), frappe.bold(self.job_applicant)))
def validate_employee_creation(self):
if self.docstatus != 1:

View File

@@ -8,6 +8,7 @@ import unittest
from frappe.utils import nowdate
from erpnext.hr.doctype.employee_onboarding.employee_onboarding import make_employee
from erpnext.hr.doctype.employee_onboarding.employee_onboarding import IncompleteTaskError
from erpnext.hr.doctype.job_offer.test_job_offer import create_job_offer
class TestEmployeeOnboarding(unittest.TestCase):
def test_employee_onboarding_incomplete_task(self):
@@ -15,8 +16,13 @@ class TestEmployeeOnboarding(unittest.TestCase):
frappe.delete_doc('Employee Onboarding', {'employee_name': 'Test Researcher'})
_set_up()
applicant = get_job_applicant()
job_offer = create_job_offer(job_applicant=applicant.name)
job_offer.submit()
onboarding = frappe.new_doc('Employee Onboarding')
onboarding.job_applicant = applicant.name
onboarding.job_offer = job_offer.name
onboarding.company = '_Test Company'
onboarding.designation = 'Researcher'
onboarding.append('activities', {

View File

@@ -9,6 +9,7 @@ frappe.views.calendar["Holiday List"] = {
"title": "description",
"allDay": "allDay"
},
order_by: `from_date`,
get_events_method: "erpnext.hr.doctype.holiday_list.holiday_list.get_events",
filters: [
{

View File

@@ -10,10 +10,14 @@ frappe.ui.form.on("Job Applicant", {
refresh: function(frm) {
if (!frm.doc.__islocal) {
if (frm.doc.__onload && frm.doc.__onload.job_offer) {
$('[data-doctype="Employee Onboarding"]').find("button").show();
$('[data-doctype="Job Offer"]').find("button").hide();
frm.add_custom_button(__("Job Offer"), function() {
frappe.set_route("Form", "Job Offer", frm.doc.__onload.job_offer);
}, __("View"));
} else {
$('[data-doctype="Employee Onboarding"]').find("button").hide();
$('[data-doctype="Job Offer"]').find("button").show();
frm.add_custom_button(__("Job Offer"), function() {
frappe.route_options = {
"job_applicant": frm.doc.name,

View File

@@ -15,6 +15,9 @@ class JobOffer(Document):
def validate(self):
self.validate_vacancies()
job_offer = frappe.db.exists("Job Offer",{"job_applicant": self.job_applicant})
if job_offer and job_offer != self.name:
frappe.throw(_("Job Offer: {0} is already for Job Applicant: {1}").format(frappe.bold(job_offer), frappe.bold(self.job_applicant)))
def validate_vacancies(self):
staffing_plan = get_staffing_plan_detail(self.designation, self.company, self.offer_date)

View File

@@ -13,4 +13,11 @@ class Vehicle(Document):
if getdate(self.start_date) > getdate(self.end_date):
frappe.throw(_("Insurance Start date should be less than Insurance End date"))
if getdate(self.carbon_check_date) > getdate():
frappe.throw(_("Last carbon check date cannot be a future date"))
frappe.throw(_("Last carbon check date cannot be a future date"))
def get_timeline_data(doctype, name):
'''Return timeline for vehicle log'''
return dict(frappe.db.sql('''select unix_timestamp(date), count(*)
from `tabVehicle Log` where license_plate=%s
and date > date_sub(curdate(), interval 1 year)
group by date''', name))

View File

@@ -0,0 +1,58 @@
{
"cards": [
{
"card": "Total Employees"
},
{
"card": "New Joinees (Last year)"
},
{
"card": "Employees Left (Last year)"
},
{
"card": "Total Applicants (Last month)"
}
],
"charts": [
{
"chart": "Attendance Count",
"width": "Full"
},
{
"chart": "Gender Diversity Ratio",
"width": "Half"
},
{
"chart": "Job Application Status",
"width": "Half"
},
{
"chart": "Designation Wise Employee Count",
"width": "Half"
},
{
"chart": "Department Wise Employee Count",
"width": "Half"
},
{
"chart": "Designation Wise Openings",
"width": "Half"
},
{
"chart": "Department Wise Openings",
"width": "Half"
}
],
"creation": "2020-07-22 11:56:33.015888",
"dashboard_name": "Human Resource",
"docstatus": 0,
"doctype": "Dashboard",
"idx": 0,
"is_default": 0,
"is_standard": 1,
"modified": "2020-07-22 14:42:12.789249",
"modified_by": "Administrator",
"module": "HR",
"name": "Human Resource",
"owner": "Administrator"
}

View File

@@ -0,0 +1,21 @@
{
"creation": "2020-07-22 11:56:32.947790",
"docstatus": 0,
"doctype": "Number Card",
"document_type": "Employee",
"dynamic_filters_json": "[[\"Employee\",\"company\",\"=\",\"frappe.defaults.get_user_default(\\\"Company\\\")\"]]",
"filters_json": "[[\"Employee\",\"relieving_date\",\"Timespan\",\"last year\",false]]",
"function": "Count",
"idx": 0,
"is_public": 1,
"is_standard": 1,
"label": "Employees Left (Last year)",
"modified": "2020-07-23 12:03:26.747447",
"modified_by": "Administrator",
"module": "HR",
"name": "Employees Left (Last year)",
"owner": "Administrator",
"show_percentage_stats": 1,
"stats_time_interval": "Monthly",
"type": "Document Type"
}

View File

@@ -0,0 +1,21 @@
{
"creation": "2020-07-22 11:56:32.914057",
"docstatus": 0,
"doctype": "Number Card",
"document_type": "Employee",
"dynamic_filters_json": "[[\"Employee\",\"company\",\"=\",\"frappe.defaults.get_user_default(\\\"Company\\\")\"]]",
"filters_json": "[[\"Employee\",\"date_of_joining\",\"Timespan\",\"last year\",false],[\"Employee\",\"status\",\"=\",\"Active\",false]]",
"function": "Count",
"idx": 0,
"is_public": 1,
"is_standard": 1,
"label": "New Joinees (Last year)",
"modified": "2020-07-22 14:32:09.352301",
"modified_by": "Administrator",
"module": "HR",
"name": "New Joinees (Last year)",
"owner": "Administrator",
"show_percentage_stats": 1,
"stats_time_interval": "Monthly",
"type": "Document Type"
}

View File

@@ -0,0 +1,21 @@
{
"creation": "2020-07-22 11:56:32.977716",
"docstatus": 0,
"doctype": "Number Card",
"document_type": "Job Applicant",
"dynamic_filters_json": "",
"filters_json": "[[\"Job Applicant\",\"creation\",\"Timespan\",\"last month\"]]",
"function": "Count",
"idx": 0,
"is_public": 1,
"is_standard": 1,
"label": "Total Applicants (Last month)",
"modified": "2020-07-22 14:32:27.656855",
"modified_by": "Administrator",
"module": "HR",
"name": "Total Applicants (Last month)",
"owner": "Administrator",
"show_percentage_stats": 1,
"stats_time_interval": "Monthly",
"type": "Document Type"
}

View File

@@ -0,0 +1,21 @@
{
"creation": "2020-07-22 11:56:32.874849",
"docstatus": 0,
"doctype": "Number Card",
"document_type": "Employee",
"dynamic_filters_json": "[[\"Employee\",\"company\",\"=\",\"frappe.defaults.get_user_default(\\\"Company\\\")\"]]",
"filters_json": "[[\"Employee\",\"status\",\"=\",\"Active\",false]]",
"function": "Count",
"idx": 0,
"is_public": 1,
"is_standard": 1,
"label": "Total Employees",
"modified": "2020-07-22 14:31:59.118650",
"modified_by": "Administrator",
"module": "HR",
"name": "Total Employees",
"owner": "Administrator",
"show_percentage_stats": 1,
"stats_time_interval": "Monthly",
"type": "Document Type"
}

View File

@@ -5,12 +5,25 @@
frappe.query_reports["Monthly Attendance Sheet"] = {
"filters": [
{
"fieldname":"month",
"fieldname": "month",
"label": __("Month"),
"fieldtype": "Select",
"options": "Jan\nFeb\nMar\nApr\nMay\nJun\nJul\nAug\nSep\nOct\nNov\nDec",
"default": ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov",
"Dec"][frappe.datetime.str_to_obj(frappe.datetime.get_today()).getMonth()],
"reqd": 1 ,
"options": [
{ "value": 1, "label": __("Jan") },
{ "value": 2, "label": __("Feb") },
{ "value": 3, "label": __("Mar") },
{ "value": 4, "label": __("Apr") },
{ "value": 5, "label": __("May") },
{ "value": 6, "label": __("June") },
{ "value": 7, "label": __("July") },
{ "value": 8, "label": __("Aug") },
{ "value": 9, "label": __("Sep") },
{ "value": 10, "label": __("Oct") },
{ "value": 11, "label": __("Nov") },
{ "value": 12, "label": __("Dec") },
],
"default": frappe.datetime.str_to_obj(frappe.datetime.get_today()).getMonth() + 1
},
{
"fieldname":"year",
@@ -22,7 +35,15 @@ frappe.query_reports["Monthly Attendance Sheet"] = {
"fieldname":"employee",
"label": __("Employee"),
"fieldtype": "Link",
"options": "Employee"
"options": "Employee",
get_query: () => {
var company = frappe.query_report.get_filter_value('company');
return {
filters: {
'company': company
}
};
}
},
{
"fieldname":"company",

View File

@@ -248,10 +248,7 @@ def get_conditions(filters):
if not (filters.get("month") and filters.get("year")):
msgprint(_("Please select month and year"), raise_exception=1)
filters["month"] = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov",
"Dec"].index(filters.month) + 1
filters["total_days_in_month"] = monthrange(cint(filters.year), filters.month)[1]
filters["total_days_in_month"] = monthrange(cint(filters.year), cint(filters.month))[1]
conditions = " and month(attendance_date) = %(month)s and year(attendance_date) = %(year)s"

View File

@@ -0,0 +1,23 @@
// Copyright (c) 2016, Frappe Technologies Pvt. Ltd. and contributors
// For license information, please see license.txt
/* eslint-disable */
frappe.query_reports["Recruitment Analytics"] = {
"filters": [
{
"fieldname":"company",
"label": __("Company"),
"fieldtype": "Link",
"options": "Company",
"default": frappe.defaults.get_user_default("Company"),
"reqd": 1
},
{
"fieldname":"on_date",
"label": __("On Date"),
"fieldtype": "Date",
"default": frappe.datetime.now_date(),
"reqd": 1,
},
]
};

View File

@@ -0,0 +1,27 @@
{
"add_total_row": 0,
"creation": "2020-05-14 16:28:45.743869",
"disable_prepared_report": 0,
"disabled": 0,
"docstatus": 0,
"doctype": "Report",
"idx": 0,
"is_standard": "Yes",
"modified": "2020-05-14 16:28:45.743869",
"modified_by": "Administrator",
"module": "HR",
"name": "Recruitment Analytics",
"owner": "Administrator",
"prepared_report": 0,
"ref_doctype": "Staffing Plan",
"report_name": "Recruitment Analytics",
"report_type": "Script Report",
"roles": [
{
"role": "HR Manager"
},
{
"role": "HR User"
}
]
}

View File

@@ -0,0 +1,190 @@
# Copyright (c) 2013, Frappe Technologies Pvt. Ltd. and contributors
# For license information, please see license.txt
from __future__ import unicode_literals
import frappe
from frappe import _
def execute(filters=None):
if not filters: filters = {}
filters = frappe._dict(filters)
columns = get_columns()
data = get_data(filters)
return columns, data
def get_columns():
return [
{
"label": _("Staffing Plan"),
"fieldtype": "Link",
"fieldname": "staffing_plan",
"options": "Staffing Plan",
"width": 150
},
{
"label": _("Job Opening"),
"fieldtype": "Link",
"fieldname": "job_opening",
"options": "Job Opening",
"width": 100
},
{
"label": _("Job Applicant"),
"fieldtype": "Link",
"fieldname": "job_applicant",
"options": "Job Applicant",
"width": 150
},
{
"label": _("Applicant name"),
"fieldtype": "data",
"fieldname": "applicant_name",
"width": 120
},
{
"label": _("Application Status"),
"fieldtype": "Data",
"fieldname": "application_status",
"width": 100
},
{
"label": _("Job Offer"),
"fieldtype": "Link",
"fieldname": "job_offer",
"options": "job Offer",
"width": 150
},
{
"label": _("Designation"),
"fieldtype": "Data",
"fieldname": "designation",
"width": 100
},
{
"label": _("Offer Date"),
"fieldtype": "date",
"fieldname": "offer_date",
"width": 100
},
{
"label": _("Job Offer status"),
"fieldtype": "Data",
"fieldname": "job_offer_status",
"width": 150
}
]
def get_data(filters):
data = []
staffing_plan_details = get_staffing_plan(filters)
staffing_plan_list = list(set([details["name"] for details in staffing_plan_details]))
sp_jo_map , jo_list = get_job_opening(staffing_plan_list)
jo_ja_map , ja_list = get_job_applicant(jo_list)
ja_joff_map = get_job_offer(ja_list)
for sp in sp_jo_map.keys():
parent_row = get_parent_row(sp_jo_map, sp, jo_ja_map, ja_joff_map)
data += parent_row
return data
def get_parent_row(sp_jo_map, sp, jo_ja_map, ja_joff_map):
data = []
if sp in sp_jo_map.keys():
for jo in sp_jo_map[sp]:
row = {
"staffing_plan" : sp,
"job_opening" : jo["name"],
}
data.append(row)
child_row = get_child_row( jo["name"], jo_ja_map, ja_joff_map)
data += child_row
return data
def get_child_row(jo, jo_ja_map, ja_joff_map):
data = []
if jo in jo_ja_map.keys():
for ja in jo_ja_map[jo]:
row = {
"indent":1,
"job_applicant": ja.name,
"applicant_name": ja.applicant_name,
"application_status": ja.status,
}
if ja.name in ja_joff_map.keys():
jo_detail =ja_joff_map[ja.name][0]
row["job_offer"] = jo_detail.name
row["job_offer_status"] = jo_detail.status
row["offer_date"]= jo_detail.offer_date.strftime("%d-%m-%Y")
row["designation"] = jo_detail.designation
data.append(row)
return data
def get_staffing_plan(filters):
staffing_plan = frappe.db.sql("""
select
sp.name, sp.department, spd.designation, spd.vacancies, spd.current_count, spd.parent, sp.to_date
from
`tabStaffing Plan Detail` spd , `tabStaffing Plan` sp
where
spd.parent = sp.name
And
sp.to_date > '{0}'
""".format(filters.on_date), as_dict = 1)
return staffing_plan
def get_job_opening(sp_list):
job_openings = frappe.get_all("Job Opening", filters = [["staffing_plan", "IN", sp_list]], fields =["name", "staffing_plan"])
sp_jo_map = {}
jo_list = []
for openings in job_openings:
if openings.staffing_plan not in sp_jo_map.keys():
sp_jo_map[openings.staffing_plan] = [openings]
else:
sp_jo_map[openings.staffing_plan].append(openings)
jo_list.append(openings.name)
return sp_jo_map, jo_list
def get_job_applicant(jo_list):
jo_ja_map = {}
ja_list =[]
applicants = frappe.get_all("Job Applicant", filters = [["job_title", "IN", jo_list]], fields =["name", "job_title","applicant_name", 'status'])
for applicant in applicants:
if applicant.job_title not in jo_ja_map.keys():
jo_ja_map[applicant.job_title] = [applicant]
else:
jo_ja_map[applicant.job_title].append(applicant)
ja_list.append(applicant.name)
return jo_ja_map , ja_list
def get_job_offer(ja_list):
ja_joff_map = {}
offers = frappe.get_all("Job Offer", filters = [["job_applicant", "IN", ja_list]], fields =["name", "job_applicant", "status", 'offer_date', 'designation'])
for offer in offers:
if offer.job_applicant not in ja_joff_map.keys():
ja_joff_map[offer.job_applicant] = [offer]
else:
ja_joff_map[offer.job_applicant].append(offer)
return ja_joff_map