diff options
| author | Christophe Simonis <chs@odoo.com> | 2018-08-14 19:43:32 +0200 |
|---|---|---|
| committer | Christophe Simonis <chs@odoo.com> | 2018-08-14 19:43:32 +0200 |
| commit | dabe59df9c84d5dbb7109decb193606b8cc2efe0 (patch) | |
| tree | 412a986b495a3c104b51c60be453dd7b663389fe /addons/mail/controllers/main.py | |
| parent | e08f947abe5dc53768eb20463133c5fef177d816 (diff) | |
| parent | 27d8daf8a75845fa1e23676b91776a0e0a8b5165 (diff) | |
[MERGE] forward port branch saas-11.3 up to 27d8daf8a75
Diffstat (limited to 'addons/mail/controllers/main.py')
| -rw-r--r-- | addons/mail/controllers/main.py | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/addons/mail/controllers/main.py b/addons/mail/controllers/main.py index 949a715cddb..6386273070c 100644 --- a/addons/mail/controllers/main.py +++ b/addons/mail/controllers/main.py @@ -176,6 +176,20 @@ class MailController(http.Controller): models that have an access_token may apply variations on this. """ + # ============================================================================================== + # This block of code disappeared on saas-11.3 to be reintroduced by TBE. + # This is needed because after a migration from an older version to saas-11.3, the link + # received by mail with a message_id no longer work. + # So this block of code is needed to guarantee the backward compatibility of those links. + if kwargs.get('message_id'): + try: + message = request.env['mail.message'].sudo().browse(int(kwargs['message_id'])).exists() + except: + message = request.env['mail.message'] + if message: + model, res_id = message.model, message.res_id + # ============================================================================================== + if res_id and isinstance(res_id, pycompat.string_types): res_id = int(res_id) return self._redirect_to_record(model, res_id, access_token) |
