From f78ebb33e3b8c8205d5e2da594cbb4a8da68758f Mon Sep 17 00:00:00 2001 From: tde-banana-odoo Date: Tue, 13 Feb 2018 12:13:55 +0100 Subject: [PATCH] [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 --- addons/mail/controllers/main.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/addons/mail/controllers/main.py b/addons/mail/controllers/main.py index 7c4f42d9f5a..72ebfe58112 100644 --- a/addons/mail/controllers/main.py +++ b/addons/mail/controllers/main.py @@ -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'],