summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Geubelle <mge@odoo.com>2016-10-28 10:48:01 +0200
committerMartin Geubelle <mge@odoo.com>2016-10-28 11:26:23 +0200
commit9f09c625f5163ef98ee308ea1bd7cb2004ef1f03 (patch)
tree300f464ca025fb5c4fd4f17a61065b6a54347129
parent5ee4344efd0074fac4006984c1eb1ccc4f335518 (diff)
[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.
-rw-r--r--addons/calendar/calendar.py4
1 files 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'