feat: add link to policy

This commit is contained in:
Mangesh-Khairnar 2019-06-05 21:16:27 +05:30
parent afa1dc4ffa
commit 62011c9dc4
4 changed files with 53 additions and 6 deletions

View File

@ -22,10 +22,19 @@ frappe.ui.form.on("Leave Allocation", {
}, },
refresh: function(frm) { refresh: function(frm) {
if(frm.doc.docstatus == 1){ if(frm.doc.docstatus === 1 && frm.doc.status === "Active") {
frm.add_custom_button('Expire Allocation', function() { // expire current allocation
frm.add_custom_button(__('Expire Allocation'), function() {
frm.trigger("expire_allocation"); frm.trigger("expire_allocation");
}); });
// opens leave balance report for employee
frm.add_custom_button(__('Check Leave Balance'), function() {
frappe.route_options = {
employee: frm.doc.employee,
};
frappe.set_route("query-report", "Employee Leave Balance");
});
} }
}, },

View File

@ -599,6 +599,39 @@
"translatable": 0, "translatable": 0,
"unique": 0 "unique": 0
}, },
{
"allow_bulk_edit": 0,
"allow_in_quick_entry": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "status",
"fieldtype": "Select",
"hidden": 1,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 1,
"label": "Status",
"length": 0,
"no_copy": 0,
"options": "Active\nExpired",
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 1,
"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_bulk_edit": 0,
"allow_in_quick_entry": 0, "allow_in_quick_entry": 0,
@ -711,7 +744,7 @@
"issingle": 0, "issingle": 0,
"istable": 0, "istable": 0,
"max_attachments": 0, "max_attachments": 0,
"modified": "2019-05-30 11:28:09.360525", "modified": "2019-05-31 11:28:09.360525",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "HR", "module": "HR",
"name": "Leave Allocation", "name": "Leave Allocation",

View File

@ -183,13 +183,15 @@ def expire_current_allocation(ref_doc):
if flt(leaves) > 0: if flt(leaves) > 0:
args = dict( args = dict(
leaves=leaves * -1, leaves=leaves * -1,
from_date=ref_doc.from_date, from_date=ref_doc.to_date,
to_date=ref_doc.from_date, to_date=ref_doc.to_date,
is_carry_forward=0, is_carry_forward=0,
is_expired=1 is_expired=1
) )
create_leave_ledger_entry(ref_doc, args) create_leave_ledger_entry(ref_doc, args)
frappe.db.set_value("Leave Allocation", ref_doc.name, "status", "Expired")
def get_unused_leaves(employee, leave_type, date): def get_unused_leaves(employee, leave_type, date):
return frappe.db.get_value("Leave Ledger Entry", filters={ return frappe.db.get_value("Leave Ledger Entry", filters={
"to_date": ("<=", date), "to_date": ("<=", date),

View File

@ -12,6 +12,9 @@ def get_data():
}, },
{ {
'items': ['Employee Grade'] 'items': ['Employee Grade']
} },
{
'items': ['Leave Allocation']
},
] ]
} }