[FIX] mail: no crash for portal url when not logged in

When portal user get email with portal url (like using
website_quote), it crashes because user is not logged.
For this case, we don't want to display the url with the
access token, but simply redirect it to messaging page.

The crash was about the "KeyError: 'view_type'" in
record_action dict, coming from website_quote.

opw-814647
This commit is contained in:
tde-banana-odoo
2018-02-13 13:56:45 +01:00
committed by jem-odoo
parent 32bdadad13
commit f78ebb33e3
+7
View File
@@ -89,6 +89,13 @@ class MailController(http.Controller):
return cls._redirect_to_messaging()
if record_action['type'] == 'ir.actions.act_url':
return werkzeug.utils.redirect(record_action['url'])
else:
# Specific case in 10.0 only: not logged users could receive an act_url that is
# not public. As we don't handle fully access tokens in 10.0 we have to redirect
# to the login to avoid access issues and/or crash when computing url_params.
# CHS-note: do not forward-port me as in saas-16 it is already managed
if record_action['type'] == 'ir.actions.act_url':
return cls._redirect_to_messaging()
url_params = {
'view_type': record_action['view_type'],