2018-01-16 06:58:15 +01:00
|
|
|
# -*- coding: utf-8 -*-
|
2018-01-16 11:34:37 +01:00
|
|
|
# Part of Odoo, Flectra. See LICENSE file for full copyright and licensing details.
|
2018-01-16 06:58:15 +01:00
|
|
|
|
2018-01-16 11:34:37 +01:00
|
|
|
from flectra import api, models
|
2018-01-16 06:58:15 +01:00
|
|
|
|
|
|
|
|
|
|
|
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':
|
2018-04-05 10:25:40 +02:00
|
|
|
order.with_context(tracking_disable=True).state = 'sent'
|
2018-01-16 06:58:15 +01:00
|
|
|
self = self.with_context(mail_post_autofollow=True)
|
|
|
|
return super(MailComposeMessage, self).send_mail(auto_commit=auto_commit)
|