mirror of
https://github.com/frappe/erpnext.git
synced 2026-06-02 11:49:10 +00:00
feat: add employee filter to employee leave balance
This commit is contained in:
@@ -29,7 +29,7 @@ frappe.ui.form.on("Leave Allocation", {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// opens leave balance report for employee
|
// opens leave balance report for employee
|
||||||
frm.add_custom_button(__('Check Leave Balance'), function() {
|
frm.add_custom_button(__('Leave Balance'), function() {
|
||||||
frappe.route_options = {
|
frappe.route_options = {
|
||||||
employee: frm.doc.employee,
|
employee: frm.doc.employee,
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -86,6 +86,16 @@ frappe.ui.form.on("Leave Application", {
|
|||||||
frm.set_value('employee', perm['Employee'].map(perm_doc => perm_doc.doc)[0]);
|
frm.set_value('employee', perm['Employee'].map(perm_doc => perm_doc.doc)[0]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (frm.doc.docstatus === 1) {
|
||||||
|
frm.add_custom_button(__('Leave Balance'), function() {
|
||||||
|
frappe.route_options = {
|
||||||
|
employee: frm.doc.employee,
|
||||||
|
group_by: ""
|
||||||
|
};
|
||||||
|
frappe.set_route("query-report", "Employee Leave Balance");
|
||||||
|
});
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
employee: function(frm) {
|
employee: function(frm) {
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ _test_records = [
|
|||||||
class TestLeaveApplication(unittest.TestCase):
|
class TestLeaveApplication(unittest.TestCase):
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
for dt in ["Leave Application", "Leave Allocation", "Salary Slip", "Leave Ledger Entry"]:
|
for dt in ["Leave Application", "Leave Allocation", "Salary Slip", "Leave Ledger Entry"]:
|
||||||
frappe.db.sql("DELETE FROM `tab%s`" % dt)
|
frappe.db.sql("DELETE FROM `tab%s`" % dt) #nosec
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def setUpClass(cls):
|
def setUpClass(cls):
|
||||||
|
|||||||
@@ -14,6 +14,7 @@
|
|||||||
"to_date",
|
"to_date",
|
||||||
"is_carry_forward",
|
"is_carry_forward",
|
||||||
"is_expired",
|
"is_expired",
|
||||||
|
"is_lwp",
|
||||||
"amended_from"
|
"amended_from"
|
||||||
],
|
],
|
||||||
"fields": [
|
"fields": [
|
||||||
@@ -90,11 +91,17 @@
|
|||||||
{
|
{
|
||||||
"fieldname": "column_break_7",
|
"fieldname": "column_break_7",
|
||||||
"fieldtype": "Column Break"
|
"fieldtype": "Column Break"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"default": "0",
|
||||||
|
"fieldname": "is_lwp",
|
||||||
|
"fieldtype": "Check",
|
||||||
|
"label": "Is Leave Without Pay"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"in_create": 1,
|
"in_create": 1,
|
||||||
"is_submittable": 1,
|
"is_submittable": 1,
|
||||||
"modified": "2019-05-30 14:45:16.577534",
|
"modified": "2019-06-05 12:56:04.980160",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "HR",
|
"module": "HR",
|
||||||
"name": "Leave Ledger Entry",
|
"name": "Leave Ledger Entry",
|
||||||
|
|||||||
@@ -30,6 +30,12 @@ frappe.query_reports["Employee Leave Balance"] = {
|
|||||||
"label": __("Department"),
|
"label": __("Department"),
|
||||||
"fieldtype": "Link",
|
"fieldtype": "Link",
|
||||||
"options": "Department",
|
"options": "Department",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldname":"employee",
|
||||||
|
"label": __("Employee"),
|
||||||
|
"fieldtype": "Link",
|
||||||
|
"options": "Employee",
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -37,9 +37,10 @@ def get_conditions(filters):
|
|||||||
"company": filters.company,
|
"company": filters.company,
|
||||||
}
|
}
|
||||||
if filters.get("department"):
|
if filters.get("department"):
|
||||||
conditions.update({
|
conditions.update({"department": filters.get("department")})
|
||||||
"department": filters.get("department")
|
if filters.get("employee"):
|
||||||
})
|
conditions.update({"employee": filters.get("employee")})
|
||||||
|
|
||||||
return conditions
|
return conditions
|
||||||
|
|
||||||
def get_data(filters, leave_types):
|
def get_data(filters, leave_types):
|
||||||
|
|||||||
Reference in New Issue
Block a user