From dfc37d340797e3c2c9ee8f4fef15de8db74221a3 Mon Sep 17 00:00:00 2001 From: len-odoo Date: Tue, 19 Jun 2018 13:08:36 +0200 Subject: [PATCH] [FIX] calendar: do not write end time before start time of an event The end time of a calendar event is constrained to never be before the start of te event. However when updating events, one path would first update the start of the event before updating the end of the event. So in case where (s_1, e_1) is updated by (s_2, e_2), with respectively s_i < e_i, if s2 > e1 then the update would violate the constraint and thus crash the calendar update. opw 1854394 --- addons/calendar/models/calendar.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/calendar/models/calendar.py b/addons/calendar/models/calendar.py index cf788a42432..f0f037fe655 100644 --- a/addons/calendar/models/calendar.py +++ b/addons/calendar/models/calendar.py @@ -816,8 +816,8 @@ class Meeting(models.Model): startdate = startdate.astimezone(pytz.utc) # Convert to UTC meeting.start = fields.Datetime.to_string(startdate) else: - meeting.start = meeting.start_datetime - meeting.stop = meeting.stop_datetime + meeting.write({'start': meeting.start_datetime, + 'stop': meeting.stop_datetime}) @api.depends('byday', 'recurrency', 'final_date', 'rrule_type', 'month_by', 'interval', 'count', 'end_type', 'mo', 'tu', 'we', 'th', 'fr', 'sa', 'su', 'day', 'week_list') def _compute_rrule(self):