[FIX] purchase: Don't auto subscribe recipients on mail composers

Purpose
=======

During the refactoring of the purchase module something went wrong when overriding the 'send_mail' method.

The 'mail_post_autofollow' key should have been set into the context only for the purchase orders model.

See: https://github.com/odoo/odoo/commit/cb01be2#diff-fe8587929089e5fdb6c75687011b1c7eR822
This commit is contained in:
Yannick Tivisse
2018-03-14 16:09:57 +01:00
parent f1608829a1
commit 1663133873
+2 -1
View File
@@ -1047,7 +1047,8 @@ class MailComposeMessage(models.Model):
@api.multi
def send_mail(self, auto_commit=False):
if self._context.get('default_model') == 'purchase.order' and self._context.get('default_res_id'):
self = self.with_context(mail_post_autofollow=True)
order = self.env['purchase.order'].browse([self._context['default_res_id']])
if order.state == 'draft':
order.state = 'sent'
return super(MailComposeMessage, self.with_context(mail_post_autofollow=True)).send_mail(auto_commit=auto_commit)
return super(MailComposeMessage, self).send_mail(auto_commit=auto_commit)