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(Payroll): Add employee grade filter in payroll entry (backport #960) #1013

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
6 changes: 4 additions & 2 deletions hrms/payroll/doctype/payroll_entry/payroll_entry.js
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ frappe.ui.form.on('Payroll Entry', {
let filters = {};

let fields = ['company', 'start_date', 'end_date', 'payroll_frequency', 'payroll_payable_account',
'currency', 'department', 'branch', 'designation', 'salary_slip_based_on_timesheet'];
'currency', 'department', 'branch', 'designation', 'salary_slip_based_on_timesheet','grade'];

fields.forEach(field => {
if (frm.doc[field]) {
Expand Down Expand Up @@ -283,7 +283,9 @@ frappe.ui.form.on('Payroll Entry', {
department: function (frm) {
frm.events.clear_employee_table(frm);
},

grade: function (frm) {
frm.events.clear_employee_table(frm);
},
designation: function (frm) {
frm.events.clear_employee_table(frm);
},
Expand Down
9 changes: 8 additions & 1 deletion hrms/payroll/doctype/payroll_entry/payroll_entry.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
"department",
"column_break_21",
"designation",
"grade",
"number_of_employees",
"section_break_24",
"employees",
Expand Down Expand Up @@ -324,12 +325,18 @@
"fieldtype": "Tab Break",
"label": "Connections",
"show_dashboard": 1
},
{
"fieldname": "grade",
"fieldtype": "Link",
"label": "Grade",
"options": "Employee Grade"
}
],
"icon": "fa fa-cog",
"is_submittable": 1,
"links": [],
"modified": "2023-07-13 12:27:33.418702",
"modified": "2023-10-10 14:21:24.517349",
"modified_by": "Administrator",
"module": "Payroll",
"name": "Payroll Entry",
Expand Down
3 changes: 2 additions & 1 deletion hrms/payroll/doctype/payroll_entry/payroll_entry.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@ def make_filters(self):
branch=self.branch,
department=self.department,
designation=self.designation,
grade=self.grade,
currency=self.currency,
start_date=self.start_date,
end_date=self.end_date,
Expand Down Expand Up @@ -1186,7 +1187,7 @@ def set_filter_conditions(query, filters, qb_object):
if filters.get("employees"):
query = query.where(qb_object.name.notin(filters.get("employees")))

for fltr_key in ["branch", "department", "designation"]:
for fltr_key in ["branch", "department", "designation", "grade"]:
if filters.get(fltr_key):
query = query.where(qb_object[fltr_key] == filters[fltr_key])

Expand Down
Loading