mirror of
https://github.com/bringout/oca-ocb-core.git
synced 2026-04-21 20:32:05 +02:00
Initial commit: Core packages
This commit is contained in:
commit
12c29a983b
9512 changed files with 8379910 additions and 0 deletions
25
odoo-bringout-oca-ocb-event/event/controllers/main.py
Normal file
25
odoo-bringout-oca-ocb-event/event/controllers/main.py
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
# -*- 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"):event>/ics'''], type='http', auth="public")
|
||||
def event_ics_file(self, event, **kwargs):
|
||||
lang = request.context.get('lang', request.env.user.lang)
|
||||
if request.env.user._is_public():
|
||||
lang = request.httprequest.cookies.get('frontend_lang')
|
||||
event = event.with_context(lang=lang)
|
||||
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))
|
||||
])
|
||||
Loading…
Add table
Add a link
Reference in a new issue