Skip to content
Draft
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@
{
"fieldname": "naming_series",
"fieldtype": "Select",
"in_list_view": 1,
"label": "Naming Series",
"options": "HR-HLA-.YYYY.-",
"reqd": 1
Expand Down Expand Up @@ -107,7 +106,7 @@
"index_web_pages_for_search": 1,
"is_submittable": 1,
"links": [],
"modified": "2026-01-07 16:11:21.856458",
"modified": "2026-03-16 12:43:14.826131",
"modified_by": "Administrator",
"module": "HR",
"name": "Holiday List Assignment",
Expand Down
12 changes: 10 additions & 2 deletions hrms/hr/doctype/leave_allocation/leave_allocation.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@
"earned_leave_schedule",
"retry_failed_allocations",
"notes",
"description"
"description",
"connection_tab"
],
"fields": [
{
Expand Down Expand Up @@ -136,6 +137,7 @@
"allow_on_submit": 1,
"fieldname": "total_leaves_allocated",
"fieldtype": "Float",
"in_list_view": 1,
"label": "Total Leaves Allocated",
"read_only": 1,
"reqd": 1
Expand Down Expand Up @@ -251,14 +253,20 @@
"fieldtype": "Button",
"hidden": 1,
"label": "Retry Failed Allocations"
},
{
"fieldname": "connection_tab",
"fieldtype": "Tab Break",
"label": "Connection",
"show_dashboard": 1
}
],
"icon": "fa fa-ok",
"idx": 1,
"index_web_pages_for_search": 1,
"is_submittable": 1,
"links": [],
"modified": "2025-11-12 12:54:03.589896",
"modified": "2026-03-16 12:33:09.010233",
"modified_by": "Administrator",
"module": "HR",
"name": "Leave Allocation",
Expand Down
15 changes: 15 additions & 0 deletions hrms/hr/doctype/leave_application/leave_application.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ frappe.ui.form.on("Leave Application", {
frm.trigger("make_dashboard");
}
frm.trigger("set_form_buttons");
frm.trigger("add_approval_action");
},

async set_employee(frm) {
Expand Down Expand Up @@ -295,6 +296,20 @@ frappe.ui.form.on("Leave Application", {
frm.trigger("make_dashboard");
frm.trigger("get_leave_balance");
},

add_approval_action: function (frm) {
if (frm.doc.status === "Open") {
frm.add_custom_button(__("Approve"), () => {
frm.set_value("status", "Approved");
frm.save();
});

frm.add_custom_button(__("Reject"), () => {
frm.set_value("status", "Rejected");
frm.save();
});
}
},
});

frappe.tour["Leave Application"] = [
Expand Down
20 changes: 15 additions & 5 deletions hrms/hr/doctype/leave_application/leave_application.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
"employee",
"employee_name",
"column_break_4",
"leave_type",
"company",
"department",
"section_break_5",
Expand All @@ -22,7 +21,9 @@
"half_day_date",
"total_leave_days",
"column_break1",
"leave_type",
"description",
"specify_reason",
"leave_balance",
"section_break_7",
"leave_approver",
Expand Down Expand Up @@ -75,6 +76,7 @@
"fieldname": "leave_type",
"fieldtype": "Link",
"ignore_user_permissions": 1,
"in_list_view": 1,
"in_standard_filter": 1,
"label": "Leave Type",
"options": "Leave Type",
Expand All @@ -99,7 +101,7 @@
{
"fieldname": "section_break_5",
"fieldtype": "Section Break",
"label": "Dates & Reason"
"label": "Leave Details"
},
{
"fieldname": "from_date",
Expand All @@ -112,6 +114,7 @@
{
"fieldname": "to_date",
"fieldtype": "Date",
"in_list_view": 1,
"label": "To Date",
"reqd": 1,
"search_index": 1
Expand Down Expand Up @@ -145,8 +148,9 @@
},
{
"fieldname": "description",
"fieldtype": "Small Text",
"label": "Reason"
"fieldtype": "Select",
"label": "Reason",
"options": "\nSick\nDoctor / Medical Appointment\nPersonal Work\nStudy / Exams\nTravelling\nVacation\nGetting Married\nWedding / Family Function\nFamily Emergency\nBreak\nGrievance leave\nOther (Specify)"
},
{
"fieldname": "section_break_7",
Expand Down Expand Up @@ -248,14 +252,20 @@
"fieldname": "sb_other_details",
"fieldtype": "Section Break",
"label": "Other Details"
},
{
"depends_on": "eval: doc.description == \"Other (Specify)\"",
"fieldname": "specify_reason",
"fieldtype": "Small Text",
"label": "Specify Reason"
}
],
"icon": "fa fa-calendar",
"idx": 1,
"is_submittable": 1,
"links": [],
"max_attachments": 3,
"modified": "2026-01-27 12:02:51.679025",
"modified": "2026-03-16 12:22:47.066429",
"modified_by": "Administrator",
"module": "HR",
"name": "Leave Application",
Expand Down
17 changes: 16 additions & 1 deletion hrms/hr/doctype/leave_application/leave_application.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,21 @@ class LeaveApplication(Document, PWANotificationsMixin):
color: DF.Color | None
company: DF.Link
department: DF.Link | None
description: DF.SmallText | None
description: DF.Literal[
"",
"Sick",
"Doctor / Medical Appointment",
"Personal Work",
"Study / Exams",
"Travelling",
"Vacation",
"Getting Married",
"Wedding / Family Function",
"Family Emergency",
"Break",
"Grievance leave",
"Other (Specify)",
]
employee: DF.Link
employee_name: DF.Data | None
follow_via_email: DF.Check
Expand All @@ -94,6 +108,7 @@ class LeaveApplication(Document, PWANotificationsMixin):
naming_series: DF.Literal["HR-LAP-.YYYY.-"]
posting_date: DF.Date
salary_slip: DF.Link | None
specify_reason: DF.SmallText | None
status: DF.Literal["Open", "Approved", "Rejected", "Cancelled"]
to_date: DF.Date
total_leave_days: DF.Float
Expand Down
39 changes: 26 additions & 13 deletions hrms/hr/doctype/leave_application/test_leave_application.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,8 @@ def make_leave_applications(cls):
"doctype": "Leave Application",
"employee": "_T-Employee-00001",
"from_date": "2013-05-01",
"description": "_Test Reason",
"description": "Other (Specify)",
"specify_reason": "_Test Reason",
"leave_type": "_Test Leave Type",
"posting_date": "2013-01-02",
"to_date": "2013-05-05",
Expand All @@ -75,7 +76,8 @@ def make_leave_applications(cls):
"doctype": "Leave Application",
"employee": "_T-Employee-00002",
"from_date": "2013-05-01",
"description": "_Test Reason",
"description": "Other (Specify)",
"specify_reason": "_Test Reason",
"leave_type": "_Test Leave Type",
"posting_date": "2013-01-02",
"to_date": "2013-05-05",
Expand All @@ -85,7 +87,8 @@ def make_leave_applications(cls):
"doctype": "Leave Application",
"employee": "_T-Employee-00001",
"from_date": "2013-01-15",
"description": "_Test Reason",
"description": "Other (Specify)",
"specify_reason": "_Test Reason",
"leave_type": "_Test Leave Type LWP",
"posting_date": "2013-01-02",
"to_date": "2013-01-15",
Expand Down Expand Up @@ -603,7 +606,8 @@ def test_optional_leave(self):
doctype="Leave Application",
employee=employee.name,
company="_Test Company",
description="_Test Reason",
description="Other (Specify)",
specify_reason="_Test Reason",
leave_type=leave_type,
from_date=date,
to_date=date,
Expand Down Expand Up @@ -638,7 +642,8 @@ def test_leaves_allowed(self):
doctype="Leave Application",
employee=employee.name,
leave_type=leave_type.name,
description="_Test Reason",
description="Other (Specify)",
specify_reason="_Test Reason",
from_date=date,
to_date=add_days(date, 2),
company="_Test Company",
Expand All @@ -653,7 +658,8 @@ def test_leaves_allowed(self):
doctype="Leave Application",
employee=employee.name,
leave_type=leave_type.name,
description="_Test Reason",
description="Other (Specify)",
specify_reason="_Test Reason",
from_date=add_days(date, 4),
to_date=add_days(date, 8),
company="_Test Company",
Expand All @@ -679,7 +685,8 @@ def test_applicable_after(self):
doctype="Leave Application",
employee=employee.name,
leave_type=leave_type.name,
description="_Test Reason",
description="Other (Specify)",
specify_reason="_Test Reason",
from_date=date,
to_date=add_days(date, 4),
company="_Test Company",
Expand All @@ -702,7 +709,8 @@ def test_applicable_after(self):
doctype="Leave Application",
employee=employee.name,
leave_type=leave_type_1.name,
description="_Test Reason",
description="Other (Specify)",
specify_reason="_Test Reason",
from_date=date,
to_date=add_days(date, 4),
company="_Test Company",
Expand Down Expand Up @@ -736,7 +744,8 @@ def test_max_continuous_leaves(self):
doctype="Leave Application",
employee=employee.name,
leave_type=leave_type.name,
description="_Test Reason",
description="Other (Specify)",
specify_reason="_Test Reason",
from_date=date,
to_date=add_days(date, 4),
company="_Test Company",
Expand Down Expand Up @@ -846,7 +855,8 @@ def test_current_leave_on_submit(self):
doctype="Leave Application",
employee=employee.name,
leave_type=leave_type,
description="_Test Reason",
description="Other (Specify)",
specify_reason="_Test Reason",
from_date="2018-10-02",
to_date="2018-10-02",
company="_Test Company",
Expand Down Expand Up @@ -914,7 +924,8 @@ def test_ledger_entry_creation_on_intermediate_allocation_expiry(self):
to_date=add_days(nowdate(), 7),
half_day=1,
half_day_date=add_days(nowdate(), -3),
description="_Test Reason",
description="Other (Specify)",
specify_reason="_Test Reason",
company="_Test Company",
docstatus=1,
status="Approved",
Expand Down Expand Up @@ -1013,7 +1024,8 @@ def test_self_leave_approval_allowed(self):
from_date="2014-06-01",
to_date="2014-06-02",
posting_date="2014-05-30",
description="_Test Reason",
description="Other (Specify)",
specify_reason="_Test Reason",
company="_Test Company",
leave_approver="test@example.com",
)
Expand Down Expand Up @@ -1051,7 +1063,8 @@ def test_self_leave_approval_not_allowed(self):
from_date="2014-06-03",
to_date="2014-06-04",
posting_date="2014-05-30",
description="_Test Reason",
description="Other (Specify)",
specify_reason="_Test Reason",
company="_Test Company",
leave_approver=leave_approver,
)
Expand Down
6 changes: 3 additions & 3 deletions hrms/hr/doctype/leave_block_list/leave_block_list.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
{
"fieldname": "leave_block_list_name",
"fieldtype": "Data",
"in_list_view": 1,
"label": "Leave Block List Name",
"reqd": 1,
"unique": 1
Expand Down Expand Up @@ -89,7 +88,7 @@
"icon": "fa fa-calendar",
"idx": 1,
"links": [],
"modified": "2024-03-27 13:10:00.587073",
"modified": "2026-03-16 12:48:24.559364",
"modified_by": "Administrator",
"module": "HR",
"name": "Leave Block List",
Expand All @@ -106,7 +105,8 @@
"write": 1
}
],
"row_format": "Dynamic",
"sort_field": "creation",
"sort_order": "ASC",
"states": []
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -171,15 +171,9 @@ def test_get_leaves_for_passed_months(self):
self.assertEqual(new_leaves_allocated, 20)

def test_pro_rated_leave_allocation_for_custom_date_range(self):
leave_type = frappe.get_doc(
{
"doctype": "Leave Type",
"leave_type_name": "_Test Leave Type_",
"include_holiday": 1,
"is_earned_leave": 1,
"allocate_on_day": "First Day",
}
).submit()
leave_type = create_leave_type(
leave_type_name="_Test Leave Type_", is_earned_leave=True, allocate_on_day="First Day"
)

leave_policy = frappe.get_doc(
{
Expand Down
Loading
Loading