Files
odoo_source/addons/event/controllers/main.py
T
Dharmraj Jhala 8b31b3b18d [FIX] event: fix traceback while downloading ics file
Currently while downloading ics for an event, it gives
traceback due to improper handling of kwargs.

It was introduced from https://github.com/odoo/odoo/commit/a03faab03fdf8a164c2f1298cc138b3fa83b0bea

This commit fixes the issue by properly handling
kwargs in the method definition.

task-1938637

closes odoo/odoo#32750

Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2019-04-18 05:22:34 +00:00

24 lines
897 B
Python

# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from werkzeug.exceptions import NotFound
from odoo.http import Controller, request, route, content_disposition
class EventController(Controller):
@route(['''/event/<model("event.event", "[('state', 'in', ('confirm', 'done'))]"):event>/ics'''], type='http', auth="public")
def event_ics_file(self, event, **kwargs):
if not event or not event.registration_ids:
return request.not_found()
files = event._get_ics_file()
if not event.id in files:
return NotFound()
content = files[event.id]
return request.make_response(content, [
('Content-Type', 'application/octet-stream'),
('Content-Length', len(content)),
('Content-Disposition', content_disposition('%s.ics' % event.name))
])