diff options
| author | Christophe Simonis <chs@odoo.com> | 2019-05-17 09:59:53 +0200 |
|---|---|---|
| committer | Christophe Simonis <chs@odoo.com> | 2019-05-17 10:00:11 +0200 |
| commit | 5f17daae4069fca9d65d35c74cac548c48a17d59 (patch) | |
| tree | f863d478169e9ed339f34385e5b2c3d2820207c9 /addons/mail/wizard/mail_compose_message.py | |
| parent | 587357432e13bf80f341ca33cc798b633b2208c5 (diff) | |
| parent | daf9763e6ecbaadb8f92b14fd2fadc310c54c690 (diff) | |
[MERGE] forward report branch 11.0 up to daf9763e6ec
Diffstat (limited to 'addons/mail/wizard/mail_compose_message.py')
| -rw-r--r-- | addons/mail/wizard/mail_compose_message.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/addons/mail/wizard/mail_compose_message.py b/addons/mail/wizard/mail_compose_message.py index d60ddb5e3a5..c22a8a10cc9 100644 --- a/addons/mail/wizard/mail_compose_message.py +++ b/addons/mail/wizard/mail_compose_message.py @@ -353,6 +353,7 @@ class MailComposer(models.TransientModel): - normal mode: return rendered values /!\ for x2many field, this onchange return command instead of ids """ + attachment_ids = [] if template_id and composition_mode == 'mass_mail': template = self.env['mail.template'].browse(template_id) fields = ['subject', 'body_html', 'email_from', 'reply_to', 'mail_server_id'] @@ -378,7 +379,7 @@ class MailComposer(models.TransientModel): 'res_id': 0, 'type': 'binary', # override default_type from context, possibly meant for another model! } - values.setdefault('attachment_ids', list()).append(Attachment.create(data_attach).id) + attachment_ids.append(Attachment.create(data_attach).id) else: default_values = self.with_context(default_composition_mode=composition_mode, default_model=model, default_res_id=res_id).default_get(['composition_mode', 'model', 'res_id', 'parent_id', 'partner_ids', 'subject', 'body', 'email_from', 'reply_to', 'attachment_ids', 'mail_server_id']) values = dict((key, default_values[key]) for key in ['subject', 'body', 'partner_ids', 'email_from', 'reply_to', 'attachment_ids', 'mail_server_id'] if key in default_values) @@ -391,6 +392,8 @@ class MailComposer(models.TransientModel): # this force the complete replacement of x2many field with # command and is compatible with onchange api.v7 values = self._convert_to_write(values) + if attachment_ids: + values.update(attachment_ids=[(6, 0, attachment_ids)]) return {'value': values} |
