[IMP] event: translate ics file to the frontend lang
This commit translate the ics file for an event to the language chosen by the public user on the website. For connected users, the ics file is translated to the user's language. Task-3199180 closes odoo/odoo#115599 X-original-commit: 2fa5ceaf2978036f44027c19abaf17afec1d5db3 Signed-off-by: Warnon Aurélien (awa) <awa@odoo.com>
This commit is contained in:
@@ -10,6 +10,10 @@ class EventController(Controller):
|
||||
|
||||
@route(['''/event/<model("event.event"):event>/ics'''], type='http', auth="public")
|
||||
def event_ics_file(self, event, **kwargs):
|
||||
if request.env.user._is_public():
|
||||
frontend_lang = request.httprequest.cookies.get('frontend_lang')
|
||||
if frontend_lang:
|
||||
event = event.with_context(lang=frontend_lang)
|
||||
files = event._get_ics_file()
|
||||
if not event.id in files:
|
||||
return NotFound()
|
||||
|
||||
Reference in New Issue
Block a user