diff --git a/erpnext/hr/doctype/leave_allocation/leave_allocation_list.js b/erpnext/hr/doctype/leave_allocation/leave_allocation_list.js new file mode 100644 index 00000000000..946b4f84920 --- /dev/null +++ b/erpnext/hr/doctype/leave_allocation/leave_allocation_list.js @@ -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" +}; diff --git a/erpnext/hr/doctype/leave_application/leave_application.js b/erpnext/hr/doctype/leave_application/leave_application.js index 5534cec0611..b81e615b724 100755 --- a/erpnext/hr/doctype/leave_application/leave_application.js +++ b/erpnext/hr/doctype/leave_application/leave_application.js @@ -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"); } }, diff --git a/erpnext/hr/doctype/leave_application/leave_application.json b/erpnext/hr/doctype/leave_application/leave_application.json index c59449f8506..60efb33ca4f 100644 --- a/erpnext/hr/doctype/leave_application/leave_application.json +++ b/erpnext/hr/doctype/leave_application/leave_application.json @@ -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", diff --git a/erpnext/hr/doctype/leave_application/leave_application.py b/erpnext/hr/doctype/leave_application/leave_application.py index f6550f0dbe3..f87f7d53ef6 100755 --- a/erpnext/hr/doctype/leave_application/leave_application.py +++ b/erpnext/hr/doctype/leave_application/leave_application.py @@ -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,