From fc8f1b3e004718c5c31aa989c0286ffd13a357a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dar=C3=ADo=20Lodeiros?= Date: Fri, 4 Sep 2026 12:07:17 +0200 Subject: [PATCH] [FIX] pos_pms_link: offer reservations whose stay covers today The POS reservation list was loaded with this domain: ["|", ("state", "=", "onboard"), "&", ("checkout", "=", now().date()), ("state", "!=", "cancel")] so a reservation only reached the POS while it was onboard, or on its very last day. A stay that is confirmed but not yet checked in was invisible, and the cashier could not charge a consumption to it. That is reasonable for a hotel, where every guest is checked in on arrival. It makes the feature unusable for long stays: a reservation spanning weeks or months sits in 'confirm' for its whole duration unless somebody performs a check-in, and a monthly-split stay gets a fresh segment whose checkout is weeks away. On a residence hall the list came up empty every single day. Load instead every non-cancelled reservation whose stay covers today, which is the single question the POS needs answered: can I charge this consumption to somebody who is staying right now. The explicit 'onboard' branch is dropped rather than kept as an alternative. It only ever added reservations that are onboard outside their own dates, and auto_departure_delayed() already moves those to 'departure_delayed' on the checkout day and auto-checks them out afterwards. The one case that behaves differently is an instance whose nocheckout_reservations cron is disabled: an overstay left in 'onboard' past its checkout is no longer offered, and its dates have to be corrected first. Also use fields.Date.context_today() instead of fields.Datetime.now().date(). The latter is UTC, so in a positive-offset timezone the date rolls over before local midnight and the evening shift loads the wrong day. --- pos_pms_link/__manifest__.py | 2 +- pos_pms_link/models/pos_session.py | 7 +++---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/pos_pms_link/__manifest__.py b/pos_pms_link/__manifest__.py index e32f8ac5f5..49631ed9ae 100644 --- a/pos_pms_link/__manifest__.py +++ b/pos_pms_link/__manifest__.py @@ -21,7 +21,7 @@ { "name": "POS PMS link", "summary": "Allows to use PMS reservations on the POS interface", - "version": "16.0.1.0.0", + "version": "16.0.1.0.1", "author": "Comunitea Servicios Tecnológicos S.L., Odoo Community Association (OCA)", "website": "https://github.com/OCA/pms", "license": "AGPL-3", diff --git a/pos_pms_link/models/pos_session.py b/pos_pms_link/models/pos_session.py index 58db47d44d..377666f092 100644 --- a/pos_pms_link/models/pos_session.py +++ b/pos_pms_link/models/pos_session.py @@ -140,12 +140,11 @@ def _pos_ui_models_to_load(self): return result def _loader_params_pms_reservation(self): + today = fields.Date.context_today(self) domain = [ - "|", - ("state", "=", "onboard"), - "&", - ("checkout", "=", fields.Datetime.now().date()), ("state", "!=", "cancel"), + ("checkin", "<=", today), + ("checkout", ">=", today), ] if self.config_id and self.config_id.reservation_allowed_propertie_ids: domain.append(