From 396c5db41a37a413a93116f35a105c5f4aa3cbe3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thibault=20Delavall=C3=A9e?= Date: Tue, 22 Sep 2015 10:27:26 +0200 Subject: [PATCH] [FIX] mail, various: buttons in notifications Various fixes : - new button (task / issue / note) param name + correct action - method button fix --- addons/mail/controllers/main.py | 6 +++--- addons/mail/models/mail_thread.py | 2 +- addons/note/note.py | 4 +++- addons/project/project.py | 3 ++- addons/project/project_view.xml | 2 +- addons/project_issue/project_issue.py | 2 +- 6 files changed, 11 insertions(+), 8 deletions(-) diff --git a/addons/mail/controllers/main.py b/addons/mail/controllers/main.py index 781ada93edc..d6cdc9fe23f 100644 --- a/addons/mail/controllers/main.py +++ b/addons/mail/controllers/main.py @@ -170,8 +170,8 @@ class MailController(http.Controller): if model not in request.env: return self._redirect_to_messaging() params = {'view_type': 'form', 'model': model} - if kwargs.get('view_id'): - params['action'] = kwargs['view_id'] + if kwargs.get('action_id'): + params['action'] = kwargs['action_id'] return werkzeug.utils.redirect('/web?#%s' % url_encode(params)) @http.route('/mail/method', type='http', auth='user') @@ -182,7 +182,7 @@ class MailController(http.Controller): Model = request.env[model] try: record = Model.browse(int(res_id)).exists() - getattr(record, method) + getattr(record, method)() except: return self._redirect_to_messaging() return werkzeug.utils.redirect('/mail/view?%s' % url_encode({'model': model, 'res_id': res_id})) diff --git a/addons/mail/models/mail_thread.py b/addons/mail/models/mail_thread.py index 72de4faa522..5a42590105f 100644 --- a/addons/mail/models/mail_thread.py +++ b/addons/mail/models/mail_thread.py @@ -531,7 +531,7 @@ class MailThread(models.AbstractModel): params = dict(base_params, method=method, params=kwargs) link = '/mail/method?%s' % url_encode(params) elif link_type == 'new': - params = dict(base_params, view_id=kwargs.get('view_id')) + params = dict(base_params, action_id=kwargs.get('action_id')) link = '/mail/new?%s' % url_encode(params) return link diff --git a/addons/note/note.py b/addons/note/note.py index 98055143ee3..0818d03d471 100644 --- a/addons/note/note.py +++ b/addons/note/note.py @@ -159,8 +159,10 @@ class note_note(osv.osv): def _notification_get_recipient_groups(self, cr, uid, ids, message, recipients, context=None): res = super(note_note, self)._notification_get_recipient_groups(cr, uid, ids, message, recipients, context=context) + new_action_id = self.pool['ir.model.data'].xmlid_to_res_id(cr, uid, 'note.action_note_note') + new_action = self._notification_link_helper(cr, uid, ids, 'new', context=context, action_id=new_action_id) res['user'] = { - 'actions': [{'url': self._notification_link_helper(cr, uid, ids, 'new', context=context), 'title': _('New Note')}] + 'actions': [{'url': new_action, 'title': _('New Note')}] } return res diff --git a/addons/project/project.py b/addons/project/project.py index d3333c89fe6..e61251e465a 100644 --- a/addons/project/project.py +++ b/addons/project/project.py @@ -750,7 +750,8 @@ class task(osv.osv): res = super(task, self)._notification_get_recipient_groups(cr, uid, ids, message, recipients, context=context) take_action = self._notification_link_helper(cr, uid, ids, 'assign', context=context) - new_action = self._notification_link_helper(cr, uid, ids, 'new', context=context, view_xmlid='project.action_view_task') + new_action_id = self.pool['ir.model.data'].xmlid_to_res_id(cr, uid, 'project.action_view_task') + new_action = self._notification_link_helper(cr, uid, ids, 'new', context=context, action_id=new_action_id) task_record = self.browse(cr, uid, ids[0], context=context) actions = [] diff --git a/addons/project/project_view.xml b/addons/project/project_view.xml index a294937293d..a99da613812 100644 --- a/addons/project/project_view.xml +++ b/addons/project/project_view.xml @@ -451,7 +451,7 @@ Tasks project.task - tree,kanban,form,calendar,pivot,graph + kanban,tree,form,calendar,pivot,graph {} diff --git a/addons/project_issue/project_issue.py b/addons/project_issue/project_issue.py index 2d34e9f36b9..838a998bfc3 100644 --- a/addons/project_issue/project_issue.py +++ b/addons/project_issue/project_issue.py @@ -334,7 +334,7 @@ class project_issue(osv.Model): new_action_id = self.pool['ir.model.data'].xmlid_to_res_id(cr, uid, 'project_issue.project_issue_categ_act0') take_action = self._notification_link_helper(cr, uid, ids, 'assign', context=context) - new_action = self._notification_link_helper(cr, uid, ids, 'new', context=context, view_id=new_action_id) + new_action = self._notification_link_helper(cr, uid, ids, 'new', context=context, action_id=new_action_id) task_record = self.browse(cr, uid, ids[0], context=context) actions = []