summaryrefslogtreecommitdiff
path: root/addons
diff options
context:
space:
mode:
authorThibault Delavallée <tde@odoo.com>2016-09-16 11:13:04 +0200
committerThibault Delavallée <tde@odoo.com>2016-09-23 10:00:18 +0200
commit033fc508f4b6330cb1a8d25cfd75c103c648edbb (patch)
tree643db5967d548c2b9f820d2e08848d98e5fa1edd /addons
parent26c7ff9118adbcf7873a6b1478ee3790168c3d1b (diff)
[FIX] mail: fix notification buttons url generation
* Assign controller now effectively redirects to mail/assign instead of mail/assign * Follow and Unfollow button now uses the helper that generated the link
Diffstat (limited to 'addons')
-rw-r--r--addons/mail/controllers/main.py2
-rw-r--r--addons/mail/models/mail_thread.py11
2 files changed, 6 insertions, 7 deletions
diff --git a/addons/mail/controllers/main.py b/addons/mail/controllers/main.py
index c579226a617..adfa7edbfe3 100644
--- a/addons/mail/controllers/main.py
+++ b/addons/mail/controllers/main.py
@@ -193,7 +193,7 @@ class MailController(http.Controller):
return werkzeug.utils.redirect('/mail/view?%s' % url_encode({'model': model, 'res_id': res_id}))
@http.route('/mail/assign', type='http', auth='user')
- def mail_action_assign(self, model, res_id, **kwargs):
+ def mail_action_assign(self, model, res_id):
if model not in request.env:
return self._redirect_to_messaging()
Model = request.env[model]
diff --git a/addons/mail/models/mail_thread.py b/addons/mail/models/mail_thread.py
index d75011b92d7..aa7e70cc8df 100644
--- a/addons/mail/models/mail_thread.py
+++ b/addons/mail/models/mail_thread.py
@@ -562,16 +562,15 @@ class MailThread(models.AbstractModel):
'message_id': kwargs.pop('message_id')
}
else:
- self.ensure_one()
base_params = {
- 'model': self._name,
- 'res_id': self.ids[0],
+ 'model': kwargs.pop('model', self._name),
+ 'res_id': kwargs.pop('res_id', self.ids and self.ids[0] or False),
}
link = False
if link_type in ['view', 'assign', 'follow', 'unfollow']:
params = dict(base_params)
- link = '/mail/view?%s' % url_encode(params)
+ link = '/mail/%s?%s' % (link_type, url_encode(params))
elif link_type == 'workflow':
params = dict(base_params, signal=kwargs['signal'])
link = '/mail/workflow?%s' % url_encode(params)
@@ -655,8 +654,8 @@ class MailThread(models.AbstractModel):
'followers': self.env['res.partner'],
'not_followers': self.env['res.partner'],
'button_access': {'url': access_link, 'title': view_title},
- 'button_follow': {'url': '/mail/follow?%s' % url_encode({'model': message.model, 'res_id': message.res_id}), 'title': _('Follow')},
- 'button_unfollow': {'url': '/mail/unfollow?%s' % url_encode({'model': message.model, 'res_id': message.res_id}), 'title': _('Unfollow')},
+ 'button_follow': {'url': self._notification_link_helper('follow', model=message.model, res_id=message.res_id), 'title': _('Follow')},
+ 'button_unfollow': {'url': self._notification_link_helper('unfollow', model=message.model, res_id=message.res_id), 'title': _('Unfollow')},
'actions': list(),
}
group_data[category] = self.env['res.partner']