From 7f1ed8685bc3970cdd3bc65ac0a6a31dc378f14a Mon Sep 17 00:00:00 2001 From: Fabien BOURGEOIS Date: Thu, 10 May 2018 19:11:29 +0200 Subject: [PATCH] [IMP][WIP]Radicale Odoo Storage : handle all day events from Odoo --- radicale_odoo_storage/__init__.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/radicale_odoo_storage/__init__.py b/radicale_odoo_storage/__init__.py index 6f35a03..346a364 100644 --- a/radicale_odoo_storage/__init__.py +++ b/radicale_odoo_storage/__init__.py @@ -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