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

View File

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

View File

@@ -16,6 +16,8 @@
"add_weekly_holidays", "add_weekly_holidays",
"weekly_off", "weekly_off",
"get_weekly_off_dates", "get_weekly_off_dates",
"column_break_euok",
"is_half_day",
"add_local_holidays", "add_local_holidays",
"country", "country",
"subdivision", "subdivision",
@@ -136,12 +138,22 @@
"fieldtype": "Button", "fieldtype": "Button",
"label": "Add to Holidays", "label": "Add to Holidays",
"options": "get_local_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", "icon": "fa fa-calendar",
"idx": 1, "idx": 1,
"links": [], "links": [],
"modified": "2024-03-27 13:09:49.920245", "modified": "2025-08-28 15:17:05.313383",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Setup", "module": "Setup",
"name": "Holiday List", "name": "Holiday List",
@@ -160,6 +172,7 @@
"write": 1 "write": 1
} }
], ],
"row_format": "Dynamic",
"sort_field": "creation", "sort_field": "creation",
"sort_order": "DESC", "sort_order": "DESC",
"states": [] "states": []

View File

@@ -31,6 +31,7 @@ class HolidayList(Document):
from_date: DF.Date from_date: DF.Date
holiday_list_name: DF.Data holiday_list_name: DF.Data
holidays: DF.Table[Holiday] holidays: DF.Table[Holiday]
is_half_day: DF.Check
subdivision: DF.Autocomplete | None subdivision: DF.Autocomplete | None
to_date: DF.Date to_date: DF.Date
total_holidays: DF.Int total_holidays: DF.Int
@@ -56,7 +57,15 @@ class HolidayList(Document):
if d in existing_holidays: if d in existing_holidays:
continue 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() @frappe.whitelist()
def get_supported_countries(self): def get_supported_countries(self):