From 9f09c625f5163ef98ee308ea1bd7cb2004ef1f03 Mon Sep 17 00:00:00 2001 From: Martin Geubelle Date: Fri, 28 Oct 2016 10:48:01 +0200 Subject: [PATCH] [FIX] calendar: rule._bynweekday can be a set Depending on the version of dateutil, rule._bynweekday can either be a tuple or a set (see https://github.com/dateutil/dateutil/pull/54), which, in the case of a set, breaks the access by index (see related issue: https://github.com/dateutil/dateutil/issues/24). By casting it into a list, we make sure that we can access [0] in both case. Credits to jke ; closes opw-690761. --- addons/calendar/calendar.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/calendar/calendar.py b/addons/calendar/calendar.py index 0c38539d677..3e714243641 100644 --- a/addons/calendar/calendar.py +++ b/addons/calendar/calendar.py @@ -1343,8 +1343,8 @@ class calendar_event(osv.Model): data['rrule_type'] = 'weekly' #repeat monthly by nweekday ((weekday, weeknumber), ) if r._bynweekday: - data['week_list'] = day_list[r._bynweekday[0][0]].upper() - data['byday'] = str(r._bynweekday[0][1]) + data['week_list'] = day_list[list(r._bynweekday)[0][0]].upper() + data['byday'] = str(list(r._bynweekday)[0][1]) data['month_by'] = 'day' data['rrule_type'] = 'monthly'