Odoo Mindscape. Understand Odoo faster. Explore modules, fields, dependencies and version differences in one place instead of digging through the source code.

Module: Events Organization

Entity: event.slot

Compute Method: _compute_datetimes

View 19.0 View 20.0
Inputs Method Outputs
  • date_tz
  • date
  • start_hour
  • end_hour
for slot in self:
-             event_tz = pytz.timezone(slot.date_tz)
+             event_tz = ZoneInfo(slot.date_tz)
            start = datetime.combine(slot.date, float_to_time(slot.start_hour))
            end = datetime.combine(slot.date, float_to_time(slot.end_hour))
-             slot.start_datetime = event_tz.localize(start).astimezone(pytz.UTC).replace(tzinfo=None)
-             slot.end_datetime = event_tz.localize(end).astimezone(pytz.UTC).replace(tzinfo=None)
+             slot.start_datetime = start.replace(tzinfo=event_tz).astimezone(UTC).replace(tzinfo=None)
+             slot.end_datetime = end.replace(tzinfo=event_tz).astimezone(UTC).replace(tzinfo=None)
  • start_datetime
  • end_datetime

Back to entity