[FIX] set timezone on context if empty in event and user

Prior to this commit, synchronizing an event to the CalDAV server could
break in the _add_event_dates method if both self.event_tz and
self.env.user.tz were empty (False). This should be a rare occurrence,
but adding a fallback of self._context.get('tz') should help.
This commit is contained in:
Marc Durepos 2024-12-12 08:45:11 -05:00
parent a0ff56ade2
commit 5a97745d42
2 changed files with 2 additions and 2 deletions

View file

@ -8,7 +8,7 @@
{
"name": "CalDAV Synchronization",
"version": "17.0.0.6.0",
"version": "17.0.0.6.1",
"license": "LGPL-3",
"category": "Productivity",
"summary": "Synchronize Odoo Calendar Events with CalDAV Servers",

View file

@ -453,7 +453,7 @@ class CalendarEvent(models.Model):
def _add_event_dates(self, event_data: Dict) -> None:
"""Add pertinent dates to event data, based on self."""
tz = self.event_tz or self.env.user.tz
tz = self.event_tz or self.env.user.tz or self._context.get('tz')
event_tz = timezone(tz)
event_data["last-modified"] = vDatetime(
utc.localize(self.write_date).astimezone(event_tz)