[FIX] calendar: _get_recurrent_date_by_event
Let's create in google calendar a reccurent event with all day set and a end date. When synchronising google calendar with Odoo(by clicking on button "Sync with Google"). It raised on error because the start date had a time zone but not the end date(the UNTIL in the rrule). opw:745665
This commit is contained in:
@@ -553,15 +553,18 @@ class Meeting(models.Model):
|
|||||||
if not event_date:
|
if not event_date:
|
||||||
event_date = datetime.now()
|
event_date = datetime.now()
|
||||||
|
|
||||||
# Convert the event date to saved timezone (or context tz) as it'll
|
if self.allday and self.rrule and 'Z' not in self.rrule:
|
||||||
# define the correct hour/day asked by the user to repeat for recurrence.
|
rset1 = rrule.rrulestr(str(self.rrule), dtstart=event_date.replace(tzinfo=None), forceset=True, ignoretz=True)
|
||||||
event_date = event_date.astimezone(timezone) # transform "+hh:mm" timezone
|
else:
|
||||||
rset1 = rrule.rrulestr(str(self.rrule), dtstart=event_date, forceset=True)
|
# Convert the event date to saved timezone (or context tz) as it'll
|
||||||
|
# define the correct hour/day asked by the user to repeat for recurrence.
|
||||||
|
event_date = event_date.astimezone(timezone) # transform "+hh:mm" timezone
|
||||||
|
rset1 = rrule.rrulestr(str(self.rrule), dtstart=event_date, forceset=True, tzinfos={})
|
||||||
recurring_meetings = self.search([('recurrent_id', '=', self.id), '|', ('active', '=', False), ('active', '=', True)])
|
recurring_meetings = self.search([('recurrent_id', '=', self.id), '|', ('active', '=', False), ('active', '=', True)])
|
||||||
|
|
||||||
for meeting in recurring_meetings:
|
for meeting in recurring_meetings:
|
||||||
rset1._exdate.append(todate(meeting.recurrent_id_date))
|
rset1._exdate.append(todate(meeting.recurrent_id_date))
|
||||||
return [d.astimezone(pytz.UTC) for d in rset1]
|
return [d.astimezone(pytz.UTC) if d.tzinfo else d for d in rset1]
|
||||||
|
|
||||||
@api.multi
|
@api.multi
|
||||||
def _get_recurrency_end_date(self):
|
def _get_recurrency_end_date(self):
|
||||||
|
|||||||
Reference in New Issue
Block a user