TheDocumentation 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.
resource_booking module is built around three core models. A booking type (resource.booking.type) defines the rules — duration, scheduling calendar, available resource combinations, and reminders — for a category of reservations. A booking (resource.booking) represents a single reservation request made by one or more attendees, optionally linked to an auto-managed calendar.event. A combination (resource.booking.combination) groups one or more resource.resource records that must all be free simultaneously for the booking to be schedulable. Four Odoo base models are also extended to integrate with the booking engine.
resource.booking
Technical name: resource.bookingInherits:
mail.thread, mail.activity.mixin, portal.mixinDescription: Resource Booking
Default ordering:
start DESC
Key Fields
The booking type that governs this booking’s duration, calendar, combinations, and reminders. Deletion of the type cascades to all its bookings (
ondelete="cascade").The resource combination reserved for this booking. Computed and auto-assigned when
combination_auto_assign is True and a start date is set. Can be set manually when combination_auto_assign is False.When
True (default), the system automatically selects the best available combination each time start changes. When False, the user picks a combination manually and the engine honours that choice.People who will attend this booking. At least one partner is required. The first partner is surfaced as
partner_id (computed, non-stored).The organizer of the booking. Defaults to the current user at creation time. Synced from the linked
calendar.event when a meeting exists.Booking start date/time. Computed from
meeting_id.start when a meeting exists; stored so it can be indexed and searched.Booking end date/time. Derived from
start + duration. Stored and indexed.Length of the booking in hours. Defaults to
type_id.duration. Synced from the linked calendar.event once a meeting exists.The calendar event linked to this booking. Lazy-created by
_sync_meeting() the first time a start date is set; destroyed when the booking is unscheduled or canceled. Unique per booking (UNIQUE(meeting_id) SQL constraint).Workflow state of the booking. Stored and tracked.
| Value | Label | Meaning |
|---|---|---|
pending | Pending | No meeting scheduled yet. |
scheduled | Scheduled | Meeting exists but attendee has not confirmed. |
confirmed | Confirmed | Meeting exists and requester accepted the invite. |
canceled | Canceled | Booking archived; meeting removed. |
False when is_overdue is True and the current user is not in the resource_booking.group_manager security group (or is accessing via the portal). Managers can always modify overdue bookings.True when the current time has passed start − type_id.modifications_deadline hours. Always False when no start date is set.Methods
_check_scheduling()
meeting_id) fits inside the work intervals of both its booking type’s resource_calendar_id and its combination_id. Raises ValidationError when:
- A booking has a meeting but no combination with resources.
- A booking’s
(start, stop)window is not fully contained within any single contiguous available interval (as computed by_get_intervals()).
stop < now) are exempt from this check.
Auto-assignment Algorithm
Whencombination_auto_assign is True and start changes, _compute_combination_id() calls _get_best_combination(), which:
- Puts the currently selected combination first in the candidate list (highest priority).
- Appends all other combinations linked to
type_id, ordered by the type’scombination_assignmentstrategy (sortedby sequence, orrandom). - Returns the first combination for which
_get_intervals(start_dt, stop_dt, combination)returns an interval that fully contains the booking window.
When called from the portal (
using_portal context key), the method raises a ValidationError if no combination is available, giving the end user immediate feedback._sync_meeting() (internal)
Lazy-creates or destroys the linked calendar.event whenever start, stop, duration, or related fields change. Called automatically from create() and write(). Uses syncing_booking_ids context to prevent recursion between the booking and the event.
resource.booking.type
Technical name: resource.booking.typeInherits:
mail.thread, mail.activity.mixinDescription: Resource Booking Type
Key Fields
Display name of the booking type. Translatable and indexed.
Default booking duration in hours. Must be positive. Defaults to
0.5 (30 minutes).The step size in hours between consecutive available start slots shown to the requester. Defaults to
0.5 (30 minutes). A value of 1.0 with a duration of 0.5 means slots are offered every hour on the hour.Number of hours before
start after which unconfirmed bookings can no longer be modified by non-managers. Defaults to 24. Also used to exclude near-future slots from the availability calendar shown to portal users.The work schedule that governs when bookings of this type may be placed. Defaults to the company’s default resource calendar. Used as the outer bound for availability calculations.
Strategy for auto-assigning combinations.
| Value | Label |
|---|---|
sorted | Sorted — always picks the combination with the lowest sequence number first. |
random | Randomly — shuffles candidates on every evaluation; default. |
Default reminders added to every
calendar.event created for bookings of this type.Default event tags applied to meetings created for bookings of this type. Copied to
resource.booking.categ_ids when the type changes.Free-text guidance shown to the requester in portal invitation emails and the scheduling calendar view. Translatable. Also copied as the default
description of new calendar.event records.Company scope. Defaults to the current company.
resource.booking.combination
Technical name: resource.booking.combinationDescription: Bookable resource combinations A combination is a named grouping of one or more
resource.resource records that must all be simultaneously available for a booking to succeed. A single resource (e.g. a meeting room) is a combination of one. Multiple resources (e.g. a doctor + an examination room) form a combination of two.
Key Fields
The resources that must be free together. The combination is only schedulable in time windows where every one of its resources has a free work interval.
When set, this calendar is used instead of each individual resource’s own
calendar_id for availability calculations. Useful when resources belong to different schedules but must be treated as a single unit.Auto-generated from resource names joined with
" + ". When a forced_calendar_id is set, the calendar name is appended in parentheses: "Resource A + Resource B (using calendar Weekly 40h)".Methods
_get_intervals(start_dt, end_dt, tz)
[start_dt, end_dt]. Steps:
- Starts with the full
[start_dt, end_dt]interval as a base. - For each
resource.resourceinresource_ids, fetches its work intervals viacalendar._work_intervals_batch()(usingforced_calendar_idif set, otherwise the resource’s owncalendar_id). - Converts intervals to the requested
tztimezone if it differs from the calendar’s timezone. - Intersects (
&=) each resource’s intervals with the running result. - Unions (
|=) the final result for multi-combination recordsets.
exclude_public_holidays=True context to honour the hr_holidays_public integration when that module is installed.