[FIX] mass mailing: keep menu when back in backend

The menu was not present in 8.0 when going back from the mass mailing email
composer to the backend. This fix adds the current action id as a return_action
query string parameter and return to the correct action.

fixes #5591

opw-629526
This commit is contained in:
Nicolas Lempereur 2015-03-06 01:52:26 +01:00
parent 9e4a8e814f
commit 9abf7a2010
5 changed files with 6 additions and 4 deletions

View File

@ -550,7 +550,7 @@ class MassMailing(osv.Model):
if not len(ids) == 1:
raise ValueError('One and only one ID allowed for this action')
mail = self.browse(cr, uid, ids[0], context=context)
url = '/website_mail/email_designer?model=mail.mass_mailing&res_id=%d&template_model=%s&enable_editor=1' % (ids[0], mail.mailing_model)
url = '/website_mail/email_designer?model=mail.mass_mailing&res_id=%d&template_model=%s&return_action=%d&enable_editor=1' % (ids[0], mail.mailing_model, context['params']['action'])
return {
'name': _('Open with Visual Editor'),
'type': 'ir.actions.act_url',

View File

@ -381,6 +381,7 @@ instance.web.ActionManager = instance.web.Widget.extend({
search_disable_custom_filters: action.context && action.context.search_disable_custom_filters
});
action.menu_id = options.action_menu_id;
action.context.params = _.extend({ 'action' : action.id }, action.context.params);
if (!(type in this)) {
console.error("Action manager can't handle action of type " + action.type, action);
return $.Deferred().reject();

View File

@ -45,6 +45,7 @@ class WebsiteEmailDesigner(http.Controller):
'email_from_field': email_from_field,
'subject_field': subject_field,
'body_field': body_field,
'return_action': kw.get('return_action', ''),
}
if getattr(record, body_field):

View File

@ -10,7 +10,7 @@ class EmailTemplate(osv.Model):
def action_edit_html(self, cr, uid, ids, context=None):
if not len(ids) == 1:
raise ValueError('One and only one ID allowed for this action')
url = '/website_mail/email_designer?model=email.template&res_id=%d&enable_editor=1' % (ids[0],)
url = '/website_mail/email_designer?model=email.template&res_id=%d&return_action=%d&enable_editor=1' % (ids[0], context['params']['action'])
return {
'name': _('Edit Template'),
'type': 'ir.actions.act_url',

View File

@ -8,7 +8,7 @@
<div id="wrap" class="container" t-ignore="True">
<div id="email_template" class="mb32" t-att-style="mode != 'email_template' and 'display: none' or ''">
<a class="mt16 btn btn-default pull-right css_editable_mode_hidden"
t-attf-href="/web#return_label=Website&amp;model=#{model}&amp;id=#{res_id}&amp;view_type=form">
t-attf-href="/web#return_label=Website&amp;model=#{model}&amp;id=#{res_id}&amp;view_type=form&amp;action=#{return_action}">
Back
</a>
<h1 class="page-header mt16">
@ -33,7 +33,7 @@
</div>
<div id="email_designer" class="mb32" t-att-style="mode != 'email_designer' and 'display: none' or ''">
<a class="mt16 btn btn-primary pull-right css_editable_mode_hidden"
t-attf-href="/web#return_label=Website&amp;model=#{model}&amp;id=#{res_id}&amp;view_type=form">
t-attf-href="/web#return_label=Website&amp;model=#{model}&amp;id=#{res_id}&amp;view_type=form&amp;action=#{return_action}">
Back to the mass mailing
</a>
<h1 class="page-header mt16">