[FIX] calendar : change stop date for recurrent event

Changing end time for recurrent event will generate an error.

steps to reproduce the error:
1- Create an event in the calendar app with recurrence on
2- Save and close
3- Edit this event again and select change all events at the top
4- Change the ending time

The error was happening because the wrong key was accessed in a
dictionary

opw-3236432

closes odoo/odoo#118087

X-original-commit: 97f51b24da5db1a0217121aae583a9c1d715adc4
Signed-off-by: Adrien Widart <awt@odoo.com>
Signed-off-by: Mahdi Cheikh Rouhou (macr) <macr@odoo.com>
This commit is contained in:
Mahdi cheikh rouhou (macr)
2023-04-11 11:33:54 +02:00
parent 5f1f4d4170
commit de1d04db4c
2 changed files with 14 additions and 1 deletions
@@ -403,6 +403,19 @@ class TestUpdateRecurrentEvents(TestRecurrentEvents):
(datetime(2019, 11, 9, 1, 0), datetime(2019, 11, 12, 18, 0)),
])
def test_shift_stop_all(self):
# testing the case where we only want to update the stop time
event = self.events[0]
event.write({
'recurrence_update': 'all_events',
'stop': event.stop + relativedelta(hours=1),
})
self.assertEventDates(event.recurrence_id.calendar_event_ids, [
(datetime(2019, 10, 22, 2, 0), datetime(2019, 10, 24, 19, 0)),
(datetime(2019, 10, 29, 2, 0), datetime(2019, 10, 31, 19, 0)),
(datetime(2019, 11, 5, 2, 0), datetime(2019, 11, 7, 19, 0)),
])
def test_change_week_day_rrule(self):
recurrence = self.events.recurrence_id
recurrence.rrule = 'FREQ=WEEKLY;COUNT=3;BYDAY=WE' # from TU to WE