[FIX] mail: keep recipients after saving a template
When sending an email via the mail.compose wizard, the selected partners are stored in the context (`active_ids`). If the composed message is saved (button "save template"), the context is lost in the _reopen action. The active_ids content of the new context is the id of the newly created mail template and is used as the id of a res.partner (sending the email to a different contact). Keep the context during the reopen to avoid losing active_ids. Closes #11947
This commit is contained in:
parent
c7fc8e1722
commit
638989b84e
|
@ -23,18 +23,17 @@ from openerp import tools
|
|||
from openerp.osv import osv, fields
|
||||
|
||||
|
||||
def _reopen(self, res_id, model):
|
||||
def _reopen(self, res_id, model, context=None):
|
||||
# save original model in context, because selecting the list of available
|
||||
# templates requires a model in context
|
||||
context = dict(context or {}, default_model=model)
|
||||
return {'type': 'ir.actions.act_window',
|
||||
'view_mode': 'form',
|
||||
'view_type': 'form',
|
||||
'res_id': res_id,
|
||||
'res_model': self._name,
|
||||
'target': 'new',
|
||||
# save original model in context, because selecting the list of available
|
||||
# templates requires a model in context
|
||||
'context': {
|
||||
'default_model': model,
|
||||
},
|
||||
'context': context,
|
||||
}
|
||||
|
||||
|
||||
|
@ -148,7 +147,7 @@ class mail_compose_message(osv.TransientModel):
|
|||
template_values = record.onchange_template_id(template_id, record.composition_mode, record.model, record.res_id)['value']
|
||||
template_values['template_id'] = template_id
|
||||
record.write(template_values)
|
||||
return _reopen(self, record.id, record.model)
|
||||
return _reopen(self, record.id, record.model, context=context)
|
||||
|
||||
#------------------------------------------------------
|
||||
# Wizard validation and send
|
||||
|
|
Loading…
Reference in New Issue