[FIX]: caldav: Fixed problem of exdate for the event with timezone

bzr revid: rpa@tinyerp.com-20100805121152-0x9z33v4e1ql81la
This commit is contained in:
rpa (Open ERP) 2010-08-05 17:41:52 +05:30
parent bd76d0a66a
commit 90d7a02691
2 changed files with 9 additions and 3 deletions

View File

@ -1559,12 +1559,12 @@ true, it will allow you to hide the event alarm information without removing it.
continue
event_id, date_new = event_id.split('-')
event_id = [int(event_id)]
for record in self.read(cr, uid, event_id, ['date', 'rrule', 'exdate']):
for record in self.read(cr, uid, event_id, ['date', 'rrule', 'exdate'], context=context):
if record['rrule']:
# Remove one of the recurrent event
date_new = time.strftime("%Y-%m-%d %H:%M:%S", \
time.strptime(date_new, "%Y%m%d%H%M%S"))
exdate = (record['exdate'] and (record['exdate'] + ',') or '') + ''.join((re.compile('\d')).findall(date_new)) + 'Z'
exdate = (record['exdate'] and (record['exdate'] + ',') or '') + ''.join((re.compile('\d')).findall(date_new))
res = self.write(cr, uid, event_id, {'exdate': exdate})
else:
res = super(calendar_event, self).unlink(cr, uid, event_id)

View File

@ -276,6 +276,7 @@ class CalDAV(object):
timezones = []
for data in datas:
tzval = None
exfield = None
vevent = ical.add(name)
for field in self.__attribute__.keys():
map_field = self.ical_get(field, 'field')
@ -316,6 +317,8 @@ class CalDAV(object):
ical = tz_obj.export_cal(cr, uid, None, \
data[map_field], ical, context=context)
timezones.append(data[map_field])
if exfield:
exfield.params['TZID'] = [tzval.title()]
elif field == 'organizer' and data[map_field]:
event_org = vevent.add('organizer')
organizer_id = data[map_field][0]
@ -326,7 +329,10 @@ class CalDAV(object):
elif data[map_field]:
if map_type in ("char", "text"):
if field in ('exdate'):
vevent.add(field).value = map(parser.parse, (data[map_field]).split(','))
exfield = vevent.add(field)
if tzval:
exfield.params['TZID'] = [tzval.title()]
exfield.value = map(parser.parse, (data[map_field]).split(','))
else:
vevent.add(field).value = tools.ustr(data[map_field])
elif map_type in ('datetime', 'date') and data[map_field]: