The Calendar Holidays Public module lets you centrally manage public holidays for any country or region directly inside Odoo. Each holiday you define automatically generates a corresponding all-day calendar event, making public holidays visible to everyone on the calendar without any manual data entry. Holidays can be scoped to specific states or provinces, and partner records are used to filter which holidays apply to a given person.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/OCA/calendar/llms.txt
Use this file to discover all available pages before exploring further.
Key Concepts
Holiday Set (calendar.public.holiday)
A holiday set groups all public holidays for a specific calendar year and country. You cannot create two sets for the same year and country combination. Sets are displayed in descending year order.
Holiday Line (calendar.public.holiday.line)
Each line within a holiday set represents a single named public holiday with a specific date. Lines can optionally be restricted to one or more states/provinces via state_ids. The date on each line must fall within the year defined on the parent holiday set.
Calendar Event auto-creation
Saving a holiday line automatically creates an all-day calendar.event marked as busy and confidential. The event name includes the country name when a country is set (e.g., Christmas Day (Switzerland)). If the calendar_public_holiday.event_type_holiday event type exists, it is automatically assigned to the event. Deleting a line also deletes its associated calendar event.
Setting Up Public Holidays
Create a new holiday set
Click New, then set the Calendar Year and Country for this set. Each year/country combination must be unique.
Add holiday lines
In the Holiday Dates tab, add a line for each public holiday. Provide a Name and Date. Optionally, set Related States to restrict the holiday to specific provinces or regions within the country.
Copying to Next Year
Rather than re-entering holidays manually every year, you can use the built-in wizard to duplicate an existing set into the next year.- Go to Calendar → Public Holidays → Create Next Year Public Holidays.
- In the Templates field, select one or more existing holiday sets to use as a source. If you leave this blank, the wizard automatically uses the most recent set for each country.
- Set the Year field to the target year. If left blank, the year defaults to the template year plus one.
- Click Create. The wizard copies all holiday lines to a new set, adjusting each date to the target year.
Checking Holidays Programmatically
Thecalendar.public.holiday model exposes two public API methods for use in custom code or automation rules.
get_holidays_list(year, start_dt, end_dt, partner_id) — returns a recordset of calendar.public.holiday.line records that fall within the given date range and apply to the specified partner (filtered by the partner’s country and state).
is_public_holiday(selected_date, partner_id) — returns True if the given date is a public holiday for the partner, False otherwise.
partner_id (the integer ID of a res.partner record). When provided, the results are filtered to holidays that match the partner’s country and, if the holiday has state restrictions, the partner’s state.
State/Province Restrictions
Holiday lines support astate_ids many-to-many field (res.country.state). When one or more states are set on a line, that holiday only applies to partners whose state_id matches one of the listed states. Lines with no states set are treated as country-wide and apply to all partners in the country regardless of their state.
This allows you to model regional holidays (e.g., a public holiday observed only in certain cantons or provinces) within a single country-level holiday set.
This module includes a
pre_init_hook that automatically migrates data from the legacy hr_holidays_public module if it was previously installed. Existing public holiday records are preserved and renamed to the new model structure during the migration.Module Metadata
| Field | Value |
|---|---|
| Version | 18.0.1.0.1 |
| Authors | Michael Telahun Makonnen, Tecnativa, Fekete Mihai (Forest and Biomass Services Romania), Druidoo, Camptocamp, Odoo Community Association (OCA) |
| License | AGPL-3 |
| Depends on | calendar |
| Repository | OCA/calendar |