[FIX] calendar: ensure the recurring dates is inside the limit defined
by datetime The library `datetime` defines a MINYEAR and MAXYEAR limit. If you try to play with dates outside of these years limits, it crashes. In the case of the opw, the date within its timezone was within the limit (year 9999), but in the UTC timezone it was no longer the case (year 10000). Actually the condition should use `<=` instead of strict `<`, and check the year *in utc* is not outside the limit, but as soon as you try to compute the date within UTC, datetime crashes :). However we can assume nobody will need a event in the year 9999 any time soon, or by that time if Odoo still exists, we should have refactored this module about 3333 times and somebody would probably have removed this limitation by oversight anyway. opw-1850024
This commit is contained in:
@@ -4,7 +4,7 @@ import base64
|
||||
|
||||
import babel.dates
|
||||
import collections
|
||||
from datetime import datetime, timedelta
|
||||
from datetime import datetime, timedelta, MAXYEAR
|
||||
from dateutil import parser
|
||||
from dateutil import rrule
|
||||
from dateutil.relativedelta import relativedelta
|
||||
@@ -632,7 +632,7 @@ class Meeting(models.Model):
|
||||
recurring_date = todate(meeting.recurrent_id_date)
|
||||
rset1.exdate(recurring_date)
|
||||
invalidate = True
|
||||
return [d.astimezone(pytz.UTC) if d.tzinfo else d for d in rset1]
|
||||
return [d.astimezone(pytz.UTC) if d.tzinfo else d for d in rset1 if d.year < MAXYEAR]
|
||||
|
||||
@api.multi
|
||||
def _get_recurrency_end_date(self):
|
||||
|
||||
Reference in New Issue
Block a user