Fix calendar_ics bug on notification

Used a source code sample taken from latest calendar_ics (https://github.com/vertelab/odoo-calendar/blob/master/calendar_ics/calendar.py ) version and applied to v8.0 version.
This commit is contained in:
osarrat 2017-06-06 14:37:17 +02:00
parent 21aee8638b
commit 59edf525bb

View File

@ -208,19 +208,18 @@ class calendar_event(models.Model):
if event.alarm_ids:
for alarm in event.alarm_ids:
valarm = ics.add('valarm')
interval = alarm.interval
duration = alarm.duration
trigger = valarm.add('TRIGGER')
trigger.params['related'] = ["START"]
if interval == 'days':
delta = timedelta(days=duration)
elif interval == 'hours':
delta = timedelta(hours=duration)
elif interval == 'minutes':
delta = timedelta(minutes=duration)
trigger.value = delta
valarm.add('DESCRIPTION').value = alarm.name or 'Odoo'
if alarm.type == 'notification':
valarm = Alarm()
valarm.add('ACTION', 'DISPLAY')
if alarm.interval == 'days':
delta = timedelta(days=alarm.duration)
elif alarm.interval == 'hours':
delta = timedelta(hours=alarm.duration)
elif alarm.interval == 'minutes':
delta = timedelta(minutes=alarm.duration)
trigger = valarm.add('TRIGGER', -delta) #fields.Datetime.from_string(event.start) -
valarm.add('DESCRIPTION', event.name)
ics.add_component(valarm)
if event.attendee_ids:
for attendee in event.attendee_ids:
attendee_add = ics.get('attendee')