[FIX] mail, various: buttons in notifications
Various fixes : - new button (task / issue / note) param name + correct action - method button fix
This commit is contained in:
@@ -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}))
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
+3
-1
@@ -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
|
||||
|
||||
|
||||
@@ -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 = []
|
||||
|
||||
@@ -451,7 +451,7 @@
|
||||
<record id="action_view_task" model="ir.actions.act_window">
|
||||
<field name="name">Tasks</field>
|
||||
<field name="res_model">project.task</field>
|
||||
<field name="view_mode">tree,kanban,form,calendar,pivot,graph</field>
|
||||
<field name="view_mode">kanban,tree,form,calendar,pivot,graph</field>
|
||||
<field name="context">{}</field>
|
||||
<field name="search_view_id" ref="view_task_search_form"/>
|
||||
<field name="help" type="html">
|
||||
|
||||
@@ -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 = []
|
||||
|
||||
Reference in New Issue
Block a user