Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[16.0][FIX] mail_composer_cc_bcc: adapt to changes upstream #1505

Merged
merged 1 commit into from
Nov 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions mail_composer_cc_bcc/models/mail_mail.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ def _send( # noqa: max-complexity: 4
success_pids = []
failure_type = None
# ===== Same with native Odoo =====
# https://github.com/odoo/odoo/blob/d492bbde35d2b52e975ca252588f5529f07027aa
# /addons/mail/models/mail_mail.py#L461
# https://github.com/odoo/odoo/blob/1098b033b4e1811d6ff4b8c3b90aa6b9e697cb93
# /addons/mail/models/mail_mail.py#L465
try:
if mail.state != "outgoing":
if mail.state != "exception" and mail.auto_delete:
Expand Down Expand Up @@ -153,7 +153,10 @@ def _send( # noqa: max-complexity: 4
headers=email_headers,
)
try:
res = IrMailServer.send_email(
email_to_normalized = email.pop("email_to_normalized", [])
res = IrMailServer.with_context(
send_validated_to=email_to_normalized
).send_email(
msg,
mail_server_id=mail.mail_server_id.id,
smtp_session=smtp_session,
Expand Down Expand Up @@ -250,8 +253,8 @@ def build_email(self, email, attachments=None, headers=None):
email_from = email.get("email_from")
IrMailServer = env["ir.mail_server"]
# ===== Same with native Odoo =====
# https://github.com/odoo/odoo/blob/d492bbde35d2b52e975ca252588f5529f07027aa
# /addons/mail/models/mail_mail.py#L543
# https://github.com/odoo/odoo/blob/1098b033b4e1811d6ff4b8c3b90aa6b9e697cb93
# /addons/mail/models/mail_mail.py#L550
msg = IrMailServer.build_email(
email_from=email_from,
email_to=email.get("email_to"),
Expand Down
6 changes: 5 additions & 1 deletion mail_composer_cc_bcc/tests/test_mail_cc_bcc.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,11 @@
from odoo.addons.mail.models.mail_mail import MailMail as upstream
from odoo.addons.mail.tests.test_mail_composer import TestMailComposer

VALID_HASHES = ["d52cb36b88b33abc9556f7be6718d93f", "461467cd5b356072fc054468c75f6e26"]
VALID_HASHES = [
"d52cb36b88b33abc9556f7be6718d93f",
"461467cd5b356072fc054468c75f6e26",
"5d1ab352416f5074e131f35f20098d5b",
]


class TestMailCcBcc(TestMailComposer):
Expand Down
Loading