fix: add indicators for expire in the leave allocation list
This commit is contained in:
parent
87adaed933
commit
24fbe23c8d
12
erpnext/hr/doctype/leave_allocation/leave_allocation_list.js
Normal file
12
erpnext/hr/doctype/leave_allocation/leave_allocation_list.js
Normal file
@ -0,0 +1,12 @@
|
||||
// Copyright (c) 2019, Frappe Technologies Pvt. Ltd. and Contributors
|
||||
// License: GNU General Public License v3. See license.txt
|
||||
|
||||
// render
|
||||
frappe.listview_settings['Leave Allocation'] = {
|
||||
get_indicator: function(doc) {
|
||||
if(doc.status==="Expired") {
|
||||
return [__("Expired"), "darkgrey", "status, =, Expired"];
|
||||
}
|
||||
},
|
||||
right_column: "grand_total"
|
||||
};
|
@ -53,27 +53,23 @@ frappe.ui.form.on("Leave Application", {
|
||||
},
|
||||
callback: function(r) {
|
||||
if (!r.exc && r.message['leave_allocation']) {
|
||||
frm.set_value('leave_details', JSON.stringify(r.message['leave_allocation']));
|
||||
leave_details = r.message['leave_allocation'];
|
||||
}
|
||||
if (!r.exc && r.message['leave_approver']) {
|
||||
frm.set_value('leave_approver', r.message['leave_approver']);
|
||||
}
|
||||
}
|
||||
});
|
||||
frm.trigger("create_dashboard");
|
||||
$("div").remove(".form-dashboard-section");
|
||||
frm.dashboard.add_section(
|
||||
frappe.render_template('leave_application_dashboard', {
|
||||
data: leave_details
|
||||
})
|
||||
);
|
||||
frm.dashboard.show();
|
||||
}
|
||||
},
|
||||
|
||||
create_dashboard: function(frm) {
|
||||
$("div").remove(".form-dashboard-section");
|
||||
let section = frm.dashboard.add_section(
|
||||
frappe.render_template('leave_application_dashboard', {
|
||||
data: JSON.parse(frm.doc.leave_details)
|
||||
})
|
||||
);
|
||||
frm.dashboard.show();
|
||||
},
|
||||
|
||||
refresh: function(frm) {
|
||||
if (frm.is_new()) {
|
||||
frm.trigger("calculate_total_days");
|
||||
@ -98,7 +94,6 @@ frappe.ui.form.on("Leave Application", {
|
||||
};
|
||||
frappe.set_route("query-report", "Employee Leave Balance");
|
||||
});
|
||||
frm.trigger("create_dashboard");
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -653,37 +653,6 @@
|
||||
"translatable": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_in_quick_entry": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "leave_details",
|
||||
"fieldtype": "Small Text",
|
||||
"hidden": 1,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Leave Details",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"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,
|
||||
@ -982,7 +951,7 @@
|
||||
"issingle": 0,
|
||||
"istable": 0,
|
||||
"max_attachments": 3,
|
||||
"modified": "2019-05-31 11:30:14.745572",
|
||||
"modified": "2019-06-01 11:30:14.745572",
|
||||
"modified_by": "Administrator",
|
||||
"module": "HR",
|
||||
"name": "Leave Application",
|
||||
|
@ -426,7 +426,6 @@ def get_leave_details(employee, date):
|
||||
"leaves_taken": leaves_taken,
|
||||
"pending_leaves": leaves_pending,
|
||||
"remaining_leaves": remaining_leaves}
|
||||
leave_details = leave_allocation
|
||||
|
||||
ret = {
|
||||
'leave_allocation': leave_allocation,
|
||||
|
Loading…
x
Reference in New Issue
Block a user