Basicaly, do this RPC once, at webclient startup, to get the next notification. Do the RPC again when the notification is displayed to get the next one. When an event with alarm is created, edited or removed, trigger an event on the bus for all involved users (the attendees) with an update of their next calendar notification.
14 lines
520 B
Python
14 lines
520 B
Python
# -*- coding: utf-8 -*
|
|
import openerp
|
|
from openerp.http import request
|
|
|
|
|
|
class CalendarBusController(openerp.addons.bus.controllers.main.BusController):
|
|
# --------------------------
|
|
# Extends BUS Controller Poll
|
|
# --------------------------
|
|
def _poll(self, dbname, channels, last, options):
|
|
if request.session.uid:
|
|
channels.append((request.db, 'calendar.alarm', request.env.user.partner_id.id))
|
|
return super(CalendarBusController, self)._poll(dbname, channels, last, options)
|