Files
odoo_source/addons/sale/wizard/mail_compose_message.py
T
Goffin Simon 287516c1a9 [FIX] sale:Empty email sent to followers when confirming the quotation
Steps to reproduce the bug:

- Subscribe another person as follower to all kind of messages in your default sales team.
- Create a new quotation.
- Hit on Send by Email and send the email.

Bug:

A empty email was sent to the followers.

Fix:

Now only the email rendered in the wizard is sent to the followers.

opw:1816028
2018-02-28 10:57:48 +01:00

18 lines
765 B
Python

# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import api, models
class MailComposeMessage(models.TransientModel):
_inherit = 'mail.compose.message'
@api.multi
def send_mail(self, auto_commit=False):
if self._context.get('default_model') == 'sale.order' and self._context.get('default_res_id') and self._context.get('mark_so_as_sent'):
order = self.env['sale.order'].browse([self._context['default_res_id']])
if order.state == 'draft':
order.with_context(tracking_disable=True).state = 'sent'
self = self.with_context(mail_post_autofollow=True)
return super(MailComposeMessage, self).send_mail(auto_commit=auto_commit)