diff --git a/addons/mail/controllers/main.py b/addons/mail/controllers/main.py index b9f0d8e8abc..f0990c7de40 100644 --- a/addons/mail/controllers/main.py +++ b/addons/mail/controllers/main.py @@ -164,7 +164,7 @@ class MailController(http.Controller): return subtypes_list @http.route('/mail/view', type='http', auth='none') - def mail_action_view(self, model=None, res_id=None, message_id=None, access_token=None, **kwargs): + def mail_action_view(self, model=None, res_id=None, access_token=None, **kwargs): """ Generic access point from notification emails. The heuristic to choose where to redirect the user is the following : @@ -176,19 +176,8 @@ class MailController(http.Controller): models that have an access_token may apply variations on this. """ - if message_id: - try: - message = request.env['mail.message'].sudo().browse(int(message_id)).exists() - except: - message = request.env['mail.message'] - if message: - model, res_id = message.model, message.res_id - else: - # either a wrong message_id, either someone trying ids -> just go to messaging - return self._redirect_to_messaging() - elif res_id and isinstance(res_id, pycompat.string_types): + 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) @http.route('/mail/assign', type='http', auth='user', methods=['GET']) diff --git a/addons/mail/models/mail_thread.py b/addons/mail/models/mail_thread.py index 961d9e30e03..1bb766768ea 100644 --- a/addons/mail/models/mail_thread.py +++ b/addons/mail/models/mail_thread.py @@ -613,15 +613,10 @@ class MailThread(models.AbstractModel): @api.multi def _notify_get_action_link(self, link_type, **kwargs): local_kwargs = dict(kwargs) # do not modify in-place, modify copy instead - if kwargs.get('message_id'): - base_params = { - 'message_id': kwargs['message_id'], - } - else: - base_params = { - 'model': kwargs.get('model', self._name), - 'res_id': kwargs.get('res_id', self.ids and self.ids[0] or False), - } + base_params = { + 'model': kwargs.get('model', self._name), + 'res_id': kwargs.get('res_id', self.ids and self.ids[0] or False), + } local_kwargs.pop('message_id', None) local_kwargs.pop('model', None) @@ -680,10 +675,7 @@ class MailThread(models.AbstractModel): # access rights checks and speedup the computation. result = {} - if self._context.get('auto_delete', False): - access_link = self._notify_get_action_link('view') - else: - access_link = self._notify_get_action_link('view', message_id=message.id) + access_link = self._notify_get_action_link('view') if message.model: model_name = self.env['ir.model']._get(message.model).display_name