summaryrefslogtreecommitdiff
path: root/addons/mail/mail_thread.py
diff options
context:
space:
mode:
authorJignesh Rathod <jir@openerp.com>2015-03-24 10:18:16 +0100
committerThibault Delavallée <tde@openerp.com>2015-03-24 10:18:16 +0100
commitb18beecf3b4c95c025e357630e01fd4cb8d6fc67 (patch)
tree9603b993e2a8f227b43b0f2b7ae682670f033855 /addons/mail/mail_thread.py
parenta8d8046cf20b2698286370a9a037e4d706755d81 (diff)
[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.
Diffstat (limited to 'addons/mail/mail_thread.py')
-rw-r--r--addons/mail/mail_thread.py8
1 files 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