diff --git a/addons/calendar/controllers/main.py b/addons/calendar/controllers/main.py index cfecfb96345..11ca7675daf 100644 --- a/addons/calendar/controllers/main.py +++ b/addons/calendar/controllers/main.py @@ -24,6 +24,32 @@ class CalendarController(http.Controller): attendee.do_accept() return self.view(db, token, action, id, view='form') + @http.route('/calendar/recurrence/accept', type='http', auth="calendar") + def accept_recurrence(self, db, token, action, id, **kwargs): + # LUL TODO db required? + attendee = request.env['calendar.attendee'].sudo().search([('access_token', '=', token), ('state', '!=', 'accepted')]) + if attendee: + attendees = request.env['calendar.attendee'].sudo().search([ + ('event_id', 'in', attendee.event_id.recurrence_id.calendar_event_ids.ids), + ('partner_id', '=', attendee.partner_id.id), + ('state', '!=', 'accepted'), + ]) + attendees.do_accept() + return self.view(db, token, action, id, view='form') + + @http.route('/calendar/recurrence/decline', type='http', auth="calendar") + def decline_recurrence(self, db, token, action, id, **kwargs): + # LUL TODO db required? + attendee = request.env['calendar.attendee'].sudo().search([('access_token', '=', token), ('state', '!=', 'declined')]) + if attendee: + attendees = request.env['calendar.attendee'].sudo().search([ + ('event_id', 'in', attendee.event_id.recurrence_id.calendar_event_ids.ids), + ('partner_id', '=', attendee.partner_id.id), + ('state', '!=', 'declined'), + ]) + attendees.do_decline() + return self.view(db, token, action, id, view='form') + @http.route('/calendar/meeting/decline', type='http', auth="calendar") def declined(self, db, token, action, id): registry = registry_get(db) diff --git a/addons/calendar/data/mail_data.xml b/addons/calendar/data/mail_data.xml index 70e1e1a5977..5c056eea138 100644 --- a/addons/calendar/data/mail_data.xml +++ b/addons/calendar/data/mail_data.xml @@ -11,23 +11,26 @@ ${object.partner_id.lang}
- % set colors = {'needsAction': 'grey', 'accepted': 'green', 'tentative': '#FFFF00', 'declined': 'red'} + % set colors = ctx.get('colors', {}) + % set recurrent = object.recurrence_id and not ctx['ignore_recurrence']

Hello ${object.common_name},

${object.event_id.user_id.partner_id.name} invited you for the ${object.event_id.name} meeting of ${object.event_id.user_id.company_id.name}.

- Accept - Decline - View
+ % if not recurrent:
${object.event_id.get_interval('dayname', tz=object.partner_id.tz if not object.event_id.allday else None)} @@ -43,6 +46,7 @@
+ % endif

Details of the event