Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Employee Grievance #25705

Merged
merged 29 commits into from
Jun 23, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
17d9add
feat: Employee Grievance
Anurag810 May 11, 2021
1cc5578
feat: link to desk and automatic unsuspend
Anurag810 May 13, 2021
c909191
test: Employee Grievance
Anurag810 May 13, 2021
279f52e
fix: Sider and Translation
Anurag810 May 17, 2021
e1337ce
fix: sider
Anurag810 May 17, 2021
af2d4c6
fix: formatting
Anurag810 May 17, 2021
2ff3b54
Merge branch 'Employee-grievance' of https://github.com/anurag810/erp…
Anurag810 May 17, 2021
7ba2a0d
feat: changes requested
Anurag810 May 24, 2021
c4a212f
feat: Employee Grievance
Anurag810 May 11, 2021
dbbcab5
feat: link to desk and automatic unsuspend
Anurag810 May 13, 2021
76cef48
test: Employee Grievance
Anurag810 May 13, 2021
efed9f2
fix: Sider and Translation
Anurag810 May 17, 2021
52f5389
fix: sider
Anurag810 May 17, 2021
585ad90
fix: formatting
Anurag810 May 17, 2021
f073586
feat: changes requested
Anurag810 May 24, 2021
8af5567
fix: patch test and sider issue
ruchamahabal May 26, 2021
8600611
fix: make Employee Responsible non-mandatory since there cannot be an…
ruchamahabal May 26, 2021
de3cec8
feat: added subject field for more context
ruchamahabal May 26, 2021
0bdca5e
fix: sider issues
ruchamahabal May 26, 2021
2a991e4
fix: removed suspension and paycut
Anurag810 Jun 21, 2021
e6633cd
fix:sider
Anurag810 Jun 21, 2021
f50dcc9
Merge branch 'Employee-grievance' of https://github.com/anurag810/erp…
Anurag810 Jun 21, 2021
1a15449
fix: test
Anurag810 Jun 22, 2021
f4b178d
fix: test
Anurag810 Jun 22, 2021
81bb485
fix: resolved Conflicts
Anurag810 Jun 22, 2021
12fd275
fix: sider
Anurag810 Jun 22, 2021
b2dbe55
fix: remove debugging print statements
ruchamahabal Jun 23, 2021
d6969f3
fix: validation message
ruchamahabal Jun 23, 2021
eaaf3b3
fix: unnecessary comma
ruchamahabal Jun 23, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion erpnext/controllers/queries.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def employee_query(doctype, txt, searchfield, start, page_len, filters):
fields = get_fields("Employee", ["name", "employee_name"])

return frappe.db.sql("""select {fields} from `tabEmployee`
where status = 'Active'
where status in ('Active', 'Suspended')
Anurag810 marked this conversation as resolved.
Show resolved Hide resolved
and docstatus < 2
and ({key} like %(txt)s
or employee_name like %(txt)s)
Expand Down
4 changes: 2 additions & 2 deletions erpnext/hr/doctype/employee/employee.json
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@
"label": "Status",
"oldfieldname": "status",
"oldfieldtype": "Select",
"options": "Active\nInactive\nLeft",
"options": "Active\nInactive\nSuspended\nLeft",
"reqd": 1,
"search_index": 1
},
Expand Down Expand Up @@ -813,7 +813,7 @@
"idx": 24,
"image_field": "image",
"links": [],
"modified": "2021-06-12 11:31:37.730760",
"modified": "2021-06-17 11:31:37.730760",
"modified_by": "Administrator",
"module": "HR",
"name": "Employee",
Expand Down
5 changes: 2 additions & 3 deletions erpnext/hr/doctype/employee/employee.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,14 @@
from __future__ import unicode_literals
import frappe

from frappe.utils import getdate, validate_email_address, today, add_years, format_datetime, cstr
from frappe.utils import getdate, validate_email_address, today, add_years, cstr
from frappe.model.naming import set_name_by_naming_series
from frappe import throw, _, scrub
from frappe.permissions import add_user_permission, remove_user_permission, \
set_user_permission_if_allowed, has_permission, get_doc_permissions
from frappe.model.document import Document
from erpnext.utilities.transaction_base import delete_events
from frappe.utils.nestedset import NestedSet
from erpnext.hr.doctype.job_offer.job_offer import get_staffing_plan_detail

class EmployeeUserDisabledError(frappe.ValidationError): pass
class EmployeeLeftValidationError(frappe.ValidationError): pass
Expand All @@ -37,7 +36,7 @@ def autoname(self):

def validate(self):
from erpnext.controllers.status_updater import validate_status
validate_status(self.status, ["Active", "Inactive", "Left"])
validate_status(self.status, ["Active", "Inactive", "Suspended", "Left"])

self.employee = self.name
self.set_employee_name()
Expand Down
5 changes: 3 additions & 2 deletions erpnext/hr/doctype/employee/employee_dashboard.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ def get_data():
'heatmap_message': _('This is based on the attendance of this Employee'),
'fieldname': 'employee',
'non_standard_fieldnames': {
'Bank Account': 'party'
'Bank Account': 'party',
'Employee Grievance': 'raised_by'
},
'transactions': [
{
Expand All @@ -20,7 +21,7 @@ def get_data():
},
{
'label': _('Lifecycle'),
'items': ['Employee Transfer', 'Employee Promotion', 'Employee Separation']
'items': ['Employee Transfer', 'Employee Promotion', 'Employee Separation', 'Employee Grievance']
},
{
'label': _('Shift'),
Expand Down
2 changes: 1 addition & 1 deletion erpnext/hr/doctype/employee/employee_list.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ frappe.listview_settings['Employee'] = {
filters: [["status","=", "Active"]],
get_indicator: function(doc) {
var indicator = [__(doc.status), frappe.utils.guess_colour(doc.status), "status,=," + doc.status];
indicator[1] = {"Active": "green", "Inactive": "red", "Left": "gray"}[doc.status];
indicator[1] = {"Active": "green", "Inactive": "red", "Left": "gray", "Suspended": "orange"}[doc.status];
return indicator;
}
};
Empty file.
39 changes: 39 additions & 0 deletions erpnext/hr/doctype/employee_grievance/employee_grievance.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
// Copyright (c) 2021, Frappe Technologies Pvt. Ltd. and contributors
// For license information, please see license.txt

frappe.ui.form.on('Employee Grievance', {
setup: function(frm) {
frm.set_query('grievance_against_party', function() {
return {
filters: {
name: ['in', [
'Company', 'Department', 'Employee Group', 'Employee Grade', 'Employee']
]
}
};
});
frm.set_query('associated_document_type', function() {
let ignore_modules = ["Setup", "Core", "Integrations", "Automation", "Website",
"Utilities", "Event Streaming", "Social", "Chat", "Data Migration", "Printing", "Desk", "Custom"];
return {
filters: {
istable: 0,
issingle: 0,
module: ["Not In", ignore_modules]
}
};
});
},

grievance_against_party: function(frm) {
let filters = {};
if (frm.doc.grievance_against_party == 'Employee' && frm.doc.raised_by) {
filters.name = ["!=", frm.doc.raised_by];
}
frm.set_query('grievance_against', function() {
return {
filters: filters
};
});
},
});
261 changes: 261 additions & 0 deletions erpnext/hr/doctype/employee_grievance/employee_grievance.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,261 @@
{
"actions": [],
"autoname": "HR-GRIEV-.YYYY.-.#####",
"creation": "2021-05-11 13:41:51.485295",
"doctype": "DocType",
"editable_grid": 1,
"engine": "InnoDB",
"field_order": [
"subject",
"raised_by",
"employee_name",
"designation",
Anurag810 marked this conversation as resolved.
Show resolved Hide resolved
"column_break_3",
"date",
"status",
"reports_to",
"grievance_details_section",
"grievance_against_party",
"grievance_against",
"grievance_type",
"column_break_11",
"associated_document_type",
"associated_document",
"section_break_14",
"description",
"investigation_details_section",
"cause_of_grievance",
"resolution_details_section",
"resolved_by",
"resolution_date",
"employee_responsible",
"column_break_16",
"resolution_detail",
"amended_from"
],
"fields": [
{
"fieldname": "grievance_type",
"fieldtype": "Link",
"in_list_view": 1,
"label": "Grievance Type",
"options": "Grievance Type",
"reqd": 1
},
{
"fieldname": "column_break_3",
"fieldtype": "Column Break"
},
{
"fieldname": "date",
"fieldtype": "Date",
"in_list_view": 1,
"label": "Date ",
"reqd": 1
},
{
"default": "Open",
"fieldname": "status",
"fieldtype": "Select",
"in_list_view": 1,
"label": "Status",
"options": "Open\nInvestigated\nResolved\nInvalid",
Anurag810 marked this conversation as resolved.
Show resolved Hide resolved
"reqd": 1
},
{
"fieldname": "description",
"fieldtype": "Text",
"label": "Description",
ruchamahabal marked this conversation as resolved.
Show resolved Hide resolved
"reqd": 1
},
{
"fieldname": "cause_of_grievance",
"fieldtype": "Text",
"label": "Cause of Grievance",
"mandatory_depends_on": "eval: doc.status == \"Investigated\" || doc.status == \"Resolved\""
},
{
"fieldname": "resolution_details_section",
"fieldtype": "Section Break",
"label": "Resolution Details"
},
{
"fieldname": "resolved_by",
"fieldtype": "Link",
"label": "Resolved By",
"mandatory_depends_on": "eval: doc.status == \"Resolved\"",
"options": "User"
},
{
"fieldname": "employee_responsible",
"fieldtype": "Link",
"label": "Employee Responsible ",
"options": "Employee"
},
{
"fieldname": "resolution_detail",
"fieldtype": "Small Text",
"label": "Resolution Details",
"mandatory_depends_on": "eval: doc.status == \"Resolved\""
},
{
"fieldname": "column_break_16",
"fieldtype": "Column Break"
},
{
"fieldname": "resolution_date",
"fieldtype": "Date",
"label": "Resolution Date",
"mandatory_depends_on": "eval: doc.status == \"Resolved\""
},
{
"fieldname": "grievance_against",
"fieldtype": "Dynamic Link",
"label": "Grievance Against",
"options": "grievance_against_party",
"reqd": 1
},
{
"fieldname": "raised_by",
"fieldtype": "Link",
"label": "Raised By",
"options": "Employee",
"reqd": 1
},
{
"fieldname": "amended_from",
"fieldtype": "Link",
"label": "Amended From",
"no_copy": 1,
"options": "Employee Grievance",
"print_hide": 1,
"read_only": 1
},
{
"fetch_from": "raised_by.designation",
"fieldname": "designation",
"fieldtype": "Link",
"label": "Designation",
"options": "Designation",
"read_only": 1
},
{
"fetch_from": "raised_by.reports_to",
"fieldname": "reports_to",
"fieldtype": "Link",
"label": "Reports To",
"options": "Employee",
"read_only": 1
},
{
"fieldname": "grievance_details_section",
"fieldtype": "Section Break",
"label": "Grievance Details"
},
{
"fieldname": "column_break_11",
"fieldtype": "Column Break"
},
{
"fieldname": "section_break_14",
"fieldtype": "Section Break"
},
{
"fieldname": "grievance_against_party",
"fieldtype": "Link",
"in_list_view": 1,
"label": "Grievance Against Party",
"options": "DocType",
"reqd": 1
},
{
"fieldname": "associated_document_type",
"fieldtype": "Link",
"label": "Associated Document Type",
"options": "DocType"
},
{
"fieldname": "associated_document",
"fieldtype": "Dynamic Link",
"label": "Associated Document",
"options": "associated_document_type"
},
{
"fieldname": "investigation_details_section",
"fieldtype": "Section Break",
"label": "Investigation Details"
},
{
"fetch_from": "raised_by.employee_name",
"fieldname": "employee_name",
"fieldtype": "Data",
"label": "Employee Name",
"read_only": 1
},
{
"fieldname": "subject",
"fieldtype": "Data",
"label": "Subject",
"reqd": 1
}
],
"index_web_pages_for_search": 1,
"is_submittable": 1,
"links": [],
"modified": "2021-06-21 12:51:01.499486",
"modified_by": "Administrator",
"module": "HR",
"name": "Employee Grievance",
"owner": "Administrator",
"permissions": [
{
"amend": 1,
"cancel": 1,
"create": 1,
"delete": 1,
"email": 1,
"export": 1,
"print": 1,
"read": 1,
"report": 1,
"role": "System Manager",
"select": 1,
"share": 1,
"submit": 1,
"write": 1
},
{
"amend": 1,
"cancel": 1,
"create": 1,
"delete": 1,
"email": 1,
"export": 1,
"print": 1,
"read": 1,
"report": 1,
"role": "HR Manager",
"select": 1,
"share": 1,
"submit": 1,
"write": 1
},
{
"create": 1,
"delete": 1,
"email": 1,
"export": 1,
"print": 1,
"read": 1,
"report": 1,
"role": "HR User",
"share": 1,
"write": 1
}
],
"search_fields": "subject,raised_by,grievance_against_party",
"sort_field": "modified",
"sort_order": "DESC",
"title_field": "subject",
"track_changes": 1
}
15 changes: 15 additions & 0 deletions erpnext/hr/doctype/employee_grievance/employee_grievance.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Copyright (c) 2021, Frappe Technologies Pvt. Ltd. and contributors
# For license information, please see license.txt

import frappe
from frappe import _, bold
from frappe.model.document import Document

class EmployeeGrievance(Document):
def on_submit(self):
if self.status not in ["Invalid", "Resolved"]:
frappe.throw(_("Only Employee Grievance with status {0} or {1} can be submitted").format(
bold("Invalid"),
bold("Resolved"))
)

Loading