Skip to content

Commit

Permalink
fix: booking_tyypes retro-compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
mamico committed Nov 9, 2023
1 parent 3fdfbf3 commit 9e16a18
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
5 changes: 5 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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]

Expand Down
12 changes: 12 additions & 0 deletions src/redturtle/prenotazioni/content/prenotazioni_folder.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
]

0 comments on commit 9e16a18

Please sign in to comment.