[ADD][WIP]Radicale Odoo Storage : add alarms management from Odoo
This commit is contained in:
parent
800cc260ed
commit
81e84e7b28
@ -29,6 +29,7 @@
|
|||||||
|
|
||||||
from contextlib import contextmanager
|
from contextlib import contextmanager
|
||||||
from time import strftime, strptime
|
from time import strftime, strptime
|
||||||
|
from datetime import timedelta
|
||||||
import pytz
|
import pytz
|
||||||
import vobject
|
import vobject
|
||||||
from odoorpc import ODOO
|
from odoorpc import ODOO
|
||||||
@ -193,6 +194,7 @@ class Collection(BaseCollection):
|
|||||||
@classmethod
|
@classmethod
|
||||||
def _generate_ics_from_odoo(cls, href, event):
|
def _generate_ics_from_odoo(cls, href, event):
|
||||||
""" Generate and return UCS object from Odoo calendar.event record """
|
""" 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_dtstart = cls.odoo_date_to_utc(event.start_datetime)
|
||||||
utc_dtstop = cls.odoo_date_to_utc(event.stop_datetime)
|
utc_dtstop = cls.odoo_date_to_utc(event.stop_datetime)
|
||||||
last_modified = str(cls.odoo_date_to_utc(event.write_date))
|
last_modified = str(cls.odoo_date_to_utc(event.write_date))
|
||||||
@ -207,6 +209,12 @@ class Collection(BaseCollection):
|
|||||||
if event.categ_ids:
|
if event.categ_ids:
|
||||||
categs = [categ.name for categ in event.categ_ids]
|
categs = [categ.name for categ in event.categ_ids]
|
||||||
cal.vevent.add('categories').value = categs
|
cal.vevent.add('categories').value = categs
|
||||||
|
if event.alarm_ids:
|
||||||
|
for alarm in event.alarm_ids:
|
||||||
|
valarm = cal.vevent.add('valarm')
|
||||||
|
action = 'DISPLAY' if alarm.type == 'notification' else 'EMAIL'
|
||||||
|
valarm.add('action').value = action
|
||||||
|
valarm.add('trigger').value = timedelta(minutes=-alarm.duration_minutes)
|
||||||
cal.vevent.add('uid').value = href
|
cal.vevent.add('uid').value = href
|
||||||
cal.vevent.add('rev').value = last_modified
|
cal.vevent.add('rev').value = last_modified
|
||||||
cal.add('rev').value = last_modified
|
cal.add('rev').value = last_modified
|
||||||
|
Loading…
x
Reference in New Issue
Block a user