1 # -*- coding: utf-8 -*-
2 ##############################################################################
4 # OpenERP, Open Source Management Solution
5 # Copyright (C) 2013-TODAY OpenERP S.A (<http://www.openerp.com>).
7 # This program is free software: you can redistribute it and/or modify
8 # it under the terms of the GNU Affero General Public License as
9 # published by the Free Software Foundation, either version 3 of the
10 # License, or (at your option) any later version.
12 # This program is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 # GNU Affero General Public License for more details.
17 # You should have received a copy of the GNU Affero General Public License
18 # along with this program. If not, see <http://www.gnu.org/licenses/>.
20 ##############################################################################
22 from openerp import SUPERUSER_ID
23 from openerp.osv import osv
26 class mail_thread(osv.AbstractModel):
27 """ Update of mail_mail class, to add the signin URL to notifications. """
28 _inherit = 'mail.thread'
30 def _get_inbox_action_xml_id(self, cr, uid, context=None):
31 """ For a given message, return an action that either
32 - opens the form view of the related document if model, res_id, and
33 read access to the document
34 - opens the Inbox with a default search on the conversation if model,
36 - opens the Inbox with context propagated
38 cur_user = self.pool.get('res.users').browse(cr, SUPERUSER_ID, uid, context=context)
39 # if uid is a portal user -> action is different
40 if any(group.is_portal for group in cur_user.groups_id):
41 return ('portal', 'action_mail_inbox_feeds_portal')
43 return super(mail_thread, self)._get_inbox_action_xml_id(cr, uid, context=context)