From de25451de8c785ea462dee4e041b687122d6adb3 Mon Sep 17 00:00:00 2001 From: Mauro Amico Date: Fri, 10 Nov 2023 09:12:33 +0100 Subject: [PATCH] fix: booking_tyypes retro-compatibility (#113) --- CHANGES.rst | 5 +++++ .../prenotazioni/content/prenotazioni_folder.py | 12 ++++++++++++ 2 files changed, 17 insertions(+) diff --git a/CHANGES.rst b/CHANGES.rst index 575a1f4d..ec16d268 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -5,10 +5,15 @@ Changelog 2.1.4 (unreleased) ------------------ +- Compatibility with old code that use booking_types field in PrenotazioniFolder + [mamico] + - Extend the booking duration limit to 180 min. [folix-01] + - Allow Bookings Manager to create, move the bookings and create the vacations. [folix-01] + - Convert booking types to c.t. [folix-01] diff --git a/src/redturtle/prenotazioni/content/prenotazioni_folder.py b/src/redturtle/prenotazioni/content/prenotazioni_folder.py index 285211fe..b4e8051f 100644 --- a/src/redturtle/prenotazioni/content/prenotazioni_folder.py +++ b/src/redturtle/prenotazioni/content/prenotazioni_folder.py @@ -727,3 +727,15 @@ def get_booking_types(self) -> Generator[PrenotazioneType, None, None]: return self.listFolderContents( contentFilter={"portal_type": "PrenotazioneType"} ) + + # BBB: compatibility with old code (booking_types was a List of IBookingTypeRow) + @property + def booking_types(self): + return [ + { + "name": t.title, + "duration": t.duration, + "hidden": t.hidden, + } + for t in self.get_booking_types() + ]