feat: specify half day in holiday list

This commit is contained in:
Asmita Hase
2025-09-09 10:34:53 +05:30
parent 68cdadf11a
commit 0af4515afd
4 changed files with 43 additions and 6 deletions

View File

@@ -10,10 +10,12 @@
"column_break_2",
"weekly_off",
"section_break_4",
"description"
"description",
"is_half_day"
],
"fields": [
{
"columns": 2,
"fieldname": "holiday_date",
"fieldtype": "Date",
"in_list_view": 1,
@@ -23,6 +25,7 @@
"reqd": 1
},
{
"columns": 3,
"fieldname": "description",
"fieldtype": "Text Editor",
"in_list_view": 1,
@@ -32,6 +35,7 @@
"width": "300px"
},
{
"columns": 2,
"default": "0",
"fieldname": "weekly_off",
"fieldtype": "Check",
@@ -44,18 +48,28 @@
{
"fieldname": "section_break_4",
"fieldtype": "Section Break"
},
{
"columns": 2,
"default": "0",
"fieldname": "is_half_day",
"fieldtype": "Check",
"in_list_view": 1,
"in_preview": 1,
"label": "Is Half Day"
}
],
"idx": 1,
"istable": 1,
"links": [],
"modified": "2024-03-27 13:09:49.810408",
"modified": "2025-08-28 15:15:44.177181",
"modified_by": "Administrator",
"module": "Setup",
"name": "Holiday",
"owner": "Administrator",
"permissions": [],
"row_format": "Dynamic",
"sort_field": "creation",
"sort_order": "ASC",
"states": []
}
}

View File

@@ -16,6 +16,7 @@ class Holiday(Document):
description: DF.TextEditor
holiday_date: DF.Date
is_half_day: DF.Check
parent: DF.Data
parentfield: DF.Data
parenttype: DF.Data

View File

@@ -16,6 +16,8 @@
"add_weekly_holidays",
"weekly_off",
"get_weekly_off_dates",
"column_break_euok",
"is_half_day",
"add_local_holidays",
"country",
"subdivision",
@@ -136,12 +138,22 @@
"fieldtype": "Button",
"label": "Add to Holidays",
"options": "get_local_holidays"
},
{
"fieldname": "column_break_euok",
"fieldtype": "Column Break"
},
{
"default": "0",
"fieldname": "is_half_day",
"fieldtype": "Check",
"label": "Is Half Day"
}
],
"icon": "fa fa-calendar",
"idx": 1,
"links": [],
"modified": "2024-03-27 13:09:49.920245",
"modified": "2025-08-28 15:17:05.313383",
"modified_by": "Administrator",
"module": "Setup",
"name": "Holiday List",
@@ -160,7 +172,8 @@
"write": 1
}
],
"row_format": "Dynamic",
"sort_field": "creation",
"sort_order": "DESC",
"states": []
}
}

View File

@@ -31,6 +31,7 @@ class HolidayList(Document):
from_date: DF.Date
holiday_list_name: DF.Data
holidays: DF.Table[Holiday]
is_half_day: DF.Check
subdivision: DF.Autocomplete | None
to_date: DF.Date
total_holidays: DF.Int
@@ -56,7 +57,15 @@ class HolidayList(Document):
if d in existing_holidays:
continue
self.append("holidays", {"description": _(self.weekly_off), "holiday_date": d, "weekly_off": 1})
self.append(
"holidays",
{
"description": _(self.weekly_off),
"holiday_date": d,
"weekly_off": 1,
"is_half_day": self.is_half_day,
},
)
@frappe.whitelist()
def get_supported_countries(self):