[IMP][WIP]Radicale Odoo Storage : handle all day events from Odoo

This commit is contained in:
Fabien BOURGEOIS 2018-05-10 19:11:29 +02:00
parent 81e84e7b28
commit 7f1ed8685b

View File

@ -195,14 +195,18 @@ class Collection(BaseCollection):
def _generate_ics_from_odoo(cls, href, event):
""" Generate and return UCS object from Odoo calendar.event record """
# TODO/IMP : attendees management (not handled directly by vobject)
utc_dtstart = cls.odoo_date_to_utc(event.start_datetime)
utc_dtstop = cls.odoo_date_to_utc(event.stop_datetime)
if event.allday:
utc_dtstart = event.start_date
utc_dtstop = event.stop_date + timedelta(days=1)
else:
utc_dtstart = cls.odoo_date_to_utc(event.start_datetime)
utc_dtstop = cls.odoo_date_to_utc(event.stop_datetime)
last_modified = str(cls.odoo_date_to_utc(event.write_date))
cal = vobject.iCalendar()
cal.add('vevent')
cal.vevent.add('summary').value = event.name
cal.vevent.add('location').value = event.location
cal.vevent.add('description').value = event.description
cal.vevent.add('location').value = event.location or ''
cal.vevent.add('description').value = event.description or ''
cal.vevent.add('dtstart').value = utc_dtstart
cal.vevent.add('dtend').value = utc_dtstop
# cal.vevent.add('duration').value = event.duration