From 8b5440c2b4515dc45af2b0ef38e4081c33036643 Mon Sep 17 00:00:00 2001 From: Martin Geubelle Date: Mon, 22 Jan 2018 13:11:54 +0100 Subject: [PATCH] [FIX] mass_mailing: open `duplicate` in `edit` mode Since the new views, the flag `initial_view` on an action has been removed. There were in fact multiple ways to do the same thing (open a form view in edit mode directly with an action) (the supported option is `form_view_initial_mode` in the context) ; the options have been cleaned up a little bit. This was the only remaining recurrence. Closes #22353 --- addons/mass_mailing/models/mass_mailing.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/addons/mass_mailing/models/mass_mailing.py b/addons/mass_mailing/models/mass_mailing.py index f48ae787f2a..582e587b2e3 100644 --- a/addons/mass_mailing/models/mass_mailing.py +++ b/addons/mass_mailing/models/mass_mailing.py @@ -520,14 +520,15 @@ class MassMailing(models.Model): self.ensure_one() mass_mailing_copy = self.copy() if mass_mailing_copy: + context = dict(self.env.context) + context['form_view_initial_mode'] = 'edit' return { 'type': 'ir.actions.act_window', 'view_type': 'form', 'view_mode': 'form', 'res_model': 'mail.mass_mailing', 'res_id': mass_mailing_copy.id, - 'context': self.env.context, - 'flags': {'initial_mode': 'edit'}, + 'context': context, } return False