Skip to content
Snippets Groups Projects
Commit 35ca91fe authored by Thomas Lefebvre (thle)'s avatar Thomas Lefebvre (thle)
Browse files

[FIX] event: translate ICS file


Issue:
------
After registering for an event, you can download the '.ics' file.
This file is not translated into the current user's language.

Solution:
---------
Use the default user language and, if public,
use the language selected on the website.

A user may wish to have his calendar in his preferred language
by using the English website.

opw-3193663

closes odoo/odoo#135161

X-original-commit: b06c56b9
Signed-off-by: default avatarThomas Lefebvre (thle) <thle@odoo.com>
parent 9b948ff9
Branches
Tags
No related merge requests found
......@@ -10,10 +10,10 @@ 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():
frontend_lang = request.httprequest.cookies.get('frontend_lang')
if frontend_lang:
event = event.with_context(lang=frontend_lang)
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()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment