Currently, if users try to send invoices / quotations / purchase orders to themselves in order to look at final result, they can't do so because our default chatter protection prevents sending mails to authors themselves. This commit uses 'mail_notify_author' context key and allows users to send mails from the header buttons available on SO / PO / invoices to themselves if they are in recipients. This commit targets only those buttons as this is the main case where we want to allow people to send emails to themselves. In order to avoid side effects no other use case is supported. Task ID-2294130 closes odoo/odoo#56370 X-original-commit: 08c0dc929da38595e29a9d1db93065547cd98ad1 Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
14 lines
538 B
Python
14 lines
538 B
Python
# -*- coding: utf-8 -*-
|
|
# purches Part of Odoo. See LICENSE file for full copyright and licensing details.
|
|
|
|
from odoo import models
|
|
|
|
|
|
class MailComposeMessage(models.TransientModel):
|
|
_inherit = 'mail.compose.message'
|
|
|
|
def send_mail(self, auto_commit=False):
|
|
if self.env.context.get('mark_rfq_as_sent') and self.model == 'purchase.order':
|
|
self = self.with_context(mail_notify_author=self.env.user.partner_id in self.partner_ids)
|
|
return super(MailComposeMessage, self).send_mail(auto_commit=auto_commit)
|