Skip to content

[18.0][IMP] resource_booking: per-resource booking buffer (post-booking cooldown)#221

Open
dnplkndll wants to merge 1 commit into
OCA:18.0from
ledoent:18.0-imp-resource_booking-booking_buffer
Open

[18.0][IMP] resource_booking: per-resource booking buffer (post-booking cooldown)#221
dnplkndll wants to merge 1 commit into
OCA:18.0from
ledoent:18.0-imp-resource_booking-booking_buffer

Conversation

@dnplkndll
Copy link
Copy Markdown
Contributor

Add a Float field booking_buffer (hours, SQL-constrained nonnegative, default 0) on resource.resource. When non-zero, the resource is treated as busy for that many hours after each scheduled booking ends, so the next slot cannot start within the cooldown window.

Implementation: new _get_buffered_booking_intervals helper that scans recently-ending overlapping bookings sharing at least one buffered resource, then subtracts the cooldown windows from candidate availability in _get_intervals. Default 0 preserves the existing back-to-back slot behavior.

Useful for resources that need cleanup/reset/turnaround time between appointments (rooms, equipment, etc.) without inflating the booking duration itself.

Adds 3 tests in tests/test_backend.py: test_booking_buffer_blocks_following_slots, ..._zero_keeps_legacy_behavior, ..._constraint. New view resource_resource_views.xml exposes the field on the form/list.

/ocabot merge minor

@OCA-git-bot
Copy link
Copy Markdown
Contributor

Hi @pedrobaeza, @ows-cloud,
some modules you are maintaining are being modified, check this out!

@dnplkndll dnplkndll force-pushed the 18.0-imp-resource_booking-booking_buffer branch 2 times, most recently from a2366b0 to 9db1b78 Compare May 16, 2026 11:58
…ldown)

Add a Float field booking_buffer (hours, SQL-constrained nonnegative,
default 0) on resource.resource. When non-zero, the resource is treated
as busy for that many hours after each scheduled booking ends, so the
next slot cannot start within the cooldown window.

Wire it into _get_intervals via a new _get_buffered_booking_intervals
helper that scans recently-ending overlapping bookings sharing at least
one buffered resource, then subtracts the cooldown windows from the
candidate availability. Default 0 preserves the existing back-to-back
slot behavior.

Useful for resources that need cleanup/reset/turnaround time between
appointments (rooms, equipment, etc.) without inflating the booking
duration itself.

Co-Authored-By: Brenden Eshbach <brenden@techsystech.com>
@dnplkndll dnplkndll force-pushed the 18.0-imp-resource_booking-booking_buffer branch 2 times, most recently from a822643 to 1e5644e Compare May 20, 2026 14:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants