[MIG] base_mail_sender_bcc: make base_mail_sender_bcc work again !
This commit is contained in:
@@ -17,8 +17,5 @@ With this module, when Odoo sends an outgoing email, it adds the sender as Bcc (
|
|||||||
'author': 'Akretion',
|
'author': 'Akretion',
|
||||||
'website': 'https://github.com/akretion/odoo-usability',
|
'website': 'https://github.com/akretion/odoo-usability',
|
||||||
'depends': ['base'],
|
'depends': ['base'],
|
||||||
# I set it to False, because this module doesn't work because of send_validated_to in context
|
'installable': True,
|
||||||
# cf method _prepare_email_message()
|
|
||||||
# We should now use the module mail_composer_cc_bcc from OCA/social (moved to OCA/mail)
|
|
||||||
'installable': False,
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
# @author: Alexis de Lattre <alexis.delattre@akretion.com>
|
# @author: Alexis de Lattre <alexis.delattre@akretion.com>
|
||||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||||
|
|
||||||
from odoo import models
|
from odoo import models, tools
|
||||||
|
|
||||||
|
|
||||||
class IrMailServer(models.Model):
|
class IrMailServer(models.Model):
|
||||||
@@ -25,3 +25,13 @@ class IrMailServer(models.Model):
|
|||||||
message_id=message_id, references=references, object_id=object_id,
|
message_id=message_id, references=references, object_id=object_id,
|
||||||
subtype=subtype, headers=headers,
|
subtype=subtype, headers=headers,
|
||||||
body_alternative=body_alternative, subtype_alternative=subtype_alternative)
|
body_alternative=body_alternative, subtype_alternative=subtype_alternative)
|
||||||
|
|
||||||
|
def _prepare_email_message(self, message, smtp_session):
|
||||||
|
validated_to = self.env.context.get('send_validated_to') or []
|
||||||
|
if message['Bcc']:
|
||||||
|
email_bcc_normalized = tools.email_normalize_all(message['Bcc'])
|
||||||
|
for email in email_bcc_normalized:
|
||||||
|
if email not in validated_to:
|
||||||
|
validated_to.append(email)
|
||||||
|
return super(IrMailServer, self.with_context(send_validated_to=validated_to))._prepare_email_message(
|
||||||
|
message, smtp_session)
|
||||||
|
|||||||
Reference in New Issue
Block a user