diff --git a/addons/mail/models/mail_message.py b/addons/mail/models/mail_message.py index fe1fc7a1141..6e97df905cb 100644 --- a/addons/mail/models/mail_message.py +++ b/addons/mail/models/mail_message.py @@ -110,7 +110,7 @@ class Message(models.Model): help='Answers do not go in the original document discussion thread. This has an impact on the generated message-id.') message_id = fields.Char('Message-Id', help='Message unique identifier', select=1, readonly=1, copy=False) reply_to = fields.Char('Reply-To', help='Reply email address. Setting the reply_to bypasses the automatic thread creation.') - mail_server_id = fields.Many2one('ir.mail_server', 'Outgoing mail server', readonly=1) + mail_server_id = fields.Many2one('ir.mail_server', 'Outgoing mail server') @api.multi def _get_needaction(self): diff --git a/addons/mail/models/res_partner.py b/addons/mail/models/res_partner.py index e64c2bdfa1e..a44920a5b92 100644 --- a/addons/mail/models/res_partner.py +++ b/addons/mail/models/res_partner.py @@ -93,6 +93,7 @@ class Partner(models.Model): mail_values = { 'mail_message_id': message.id, + 'mail_server_id': message.mail_server_id.id, 'auto_delete': self._context.get('mail_auto_delete', True), 'references': references, } diff --git a/addons/mail/wizard/mail_compose_message.py b/addons/mail/wizard/mail_compose_message.py index cc2dff25f38..158507a2530 100644 --- a/addons/mail/wizard/mail_compose_message.py +++ b/addons/mail/wizard/mail_compose_message.py @@ -216,7 +216,7 @@ class MailComposer(models.TransientModel): if wizard.template_id: # template user_signature is added when generating body_html # mass mailing: use template auto_delete value -> note, for emails mass mailing only - Mail = Mail.with_context(mail_notify_user_signature=False, mail_server_id=wizard.template_id.mail_server_id.id) + Mail = Mail.with_context(mail_notify_user_signature=False) ActiveModel = ActiveModel.with_context(mail_notify_user_signature=False, mail_auto_delete=wizard.template_id.auto_delete) if not hasattr(ActiveModel, 'message_post'): ActiveModel = self.env['mail.thread'].with_context(thread_model=wizard.model) @@ -282,6 +282,7 @@ class MailComposer(models.TransientModel): 'email_from': self.email_from, 'record_name': self.record_name, 'no_auto_thread': self.no_auto_thread, + 'mail_server_id': self.mail_server_id.id, } # mass mailing: rendering override wizard static values if mass_mail_mode and self.model: