[FIX] event: allow ics file with public user

If you register online on a free event, there is an
access rights error when trying to download the ICS file
if you are connectd with public user.

`if not event` part is pointless, if event cannot be resolved,
@http.route would return a 404 anyway.
`if not event.registration_ids` does not make sense from a
functional point of view: there is no problem in generating
an .ics file for a public event that has no registrations (yet)
and the button we use to generate the .ics file is displayed
after the registration anyway.

opw-2066847

closes odoo/odoo#37012

X-origin-commit: f4ca5897df9295b684bcbfcafd98fbde2f8bf673
Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
This commit is contained in:
Alex Tuyls
2019-09-17 13:33:08 +00:00
committed by Nicolas Martinelli
parent d3d21d2a64
commit 0d7ef88299
-2
View File
@@ -10,8 +10,6 @@ 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()