From b18beecf3b4c95c025e357630e01fd4cb8d6fc67 Mon Sep 17 00:00:00 2001 From: Jignesh Rathod Date: Tue, 24 Mar 2015 10:18:16 +0100 Subject: [PATCH] [FIX] mail: mail_thread: when trying to find the correct action to launch when coming from a notification link, consider an access error when reading the message as having to fallback on the Inbox, not crash. --- addons/mail/mail_thread.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/addons/mail/mail_thread.py b/addons/mail/mail_thread.py index 024735eca05..e2058fabdf2 100644 --- a/addons/mail/mail_thread.py +++ b/addons/mail/mail_thread.py @@ -635,9 +635,11 @@ class mail_thread(osv.AbstractModel): if not msg_id and not (model and res_id): return action if msg_id and not (model and res_id): - msg = self.pool.get('mail.message').browse(cr, uid, msg_id, context=context) - if msg.exists(): + msg = self.pool.get('mail.message').browse(cr, uid, msg_id, context=context).exists() + try: model, res_id = msg.model, msg.res_id + except AccessError: + pass # if model + res_id found: try to redirect to the document or fallback on the Inbox if model and res_id: @@ -1570,7 +1572,7 @@ class mail_thread(osv.AbstractModel): isinstance(thread_id, (int, long)) or \ (isinstance(thread_id, (list, tuple)) and len(thread_id) == 1), \ "Invalid thread_id; should be 0, False, an ID or a list with one ID" - if isinstance(thread_id, (list, tuple)): + if thread_id and isinstance(thread_id, (list, tuple)): thread_id = thread_id[0] # if we're processing a message directly coming from the gateway, the destination model was