diff --git a/addons/purchase/purchase.py b/addons/purchase/purchase.py index d663b69bb32..9869590052f 100644 --- a/addons/purchase/purchase.py +++ b/addons/purchase/purchase.py @@ -1065,9 +1065,9 @@ class MailComposeMessage(models.TransientModel): @api.multi def send_mail(self, auto_commit=False): - compose_internal = self.filtered('subtype_id.internal') - if self._context.get('default_model') == 'purchase.order' and self._context.get('default_res_id') and not compose_internal: - order = self.env['purchase.order'].browse([self._context['default_res_id']]) - if order.state == 'draft': - order.state = 'sent' + if self._context.get('default_model') == 'purchase.order' and self._context.get('default_res_id'): + if not self.filtered('subtype_id.internal'): + 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)