Skip to content

[16.0][ADD] pms: children capacity in rooms - #463

Open
jesusVMayor wants to merge 2 commits into
OCA:16.0from
commitsun:16.0-add-room-children-capacity
Open

jesusVMayor wants to merge 2 commits into
OCA:16.0from
commitsun:16.0-add-room-children-capacity

Conversation

@jesusVMayor

Copy link
Copy Markdown
Member

Rooms declared how many people fit, with no way to say how many of those
places are for children only, such as child bunk beds.

Children were meant to be counted through pms.reservation.children_occupying,
a plain integer with no compute, default or constraint. Nothing kept it in sync
with children, so it was left empty and children did not count towards the
room capacity at all: a double room took two adults and any number of children
without complaint. The demo data of this very module books an adult and a child
into a single room because of it.

What this does

pms.room gets children_capacity. capacity keeps its meaning, the places
where anyone can sleep, and children take those first, overflowing into the
children places only once they are full. Adults never occupy them, so a room
with free children places can still be full for adults.

adults            <= capacity
adults + children <= capacity + children_capacity

This is the bed space model channel managers work with, where adult spaces hold
anyone and children spaces only children.

The two places that checked the capacity duplicated the formula; both call
pms.room.fits_occupancy() now.

Nothing changes unless the property asks for it

Counting children refuses reservations that properties have been taking all
along, so it is off unless the new pms.children_occupy_capacity system
parameter says otherwise. With it off the behaviour is exactly the current one.
See readme/CONFIGURE.rst.

children_occupying is dropped

A reservation could declare an occupying child without counting it in
children, so the migration folds it in before the column goes away, or those
children would be lost.

pms_l10n_es subtracted children_occupying from the extra beds of the INE
report. As the field was never filled in, the subtraction always took zero and
no past report changes.

Tests

New tests cover that children do not occupy by default, that they overflow into
the children places when the parameter is on, and that adults never take those
places. The existing test_manage_children_raise turns the parameter on and
now asserts the reason, as a bare assertRaises(ValidationError) was passing
for an unrelated validation.

@OCA-git-bot OCA-git-bot added mod:pms Module pms series:16.0 mod:pms_l10n_es Module pms_l10n_es labels Oct 9, 2026
Rooms declared how many people fit, with no way to say how many of those
places are for children only, such as child bunk beds. Children were
meant to be counted through the reservation children_occupying, but
nothing kept that field in sync with children and it was left empty, so
children did not count towards the room capacity at all.

Rooms get children_capacity now. capacity keeps its meaning, the places
where anyone can sleep, and children take those first, overflowing into
the children places only once they are full. Adults never occupy them,
so a room with free children places can still be full for adults.

Whether children take a place at all is up to the property, through the
pms.children_occupy_capacity system parameter, and off unless it says
otherwise: counting them refuses reservations that properties have been
taking all along, so it cannot be something an upgrade decides for them.

children_occupying is dropped. A reservation could declare an occupying
child without counting it in children, so the migration folds it into
children before the column goes away.

Assisted-by: Claude Opus 5
The INE extra bed count subtracted the children occupying the room from
the extra beds sold for that date. Nothing ever filled children_occupying
in, so the subtraction always took zero, and the field is gone now.

Assisted-by: Claude Opus 5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

mod:pms_l10n_es Module pms_l10n_es mod:pms Module pms series:16.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants