[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.
This commit is contained in:
Martin Geubelle 2016-10-28 10:48:01 +02:00
parent 5ee4344efd
commit 9f09c625f5
1 changed files with 2 additions and 2 deletions

View File

@ -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'