Skip to content

Commit

Permalink
[FIX] mail_composer_cc_bcc: adapt to changes upstream
Browse files Browse the repository at this point in the history
  • Loading branch information
hbrunn committed Dec 12, 2024
1 parent 89ce88c commit 376ad8d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
14 changes: 10 additions & 4 deletions mail_composer_cc_bcc/models/mail_mail.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,13 @@

def format_emails(partners):
emails = [
tools.formataddr((p.name or "False", p.email or "False")) for p in partners
tools.formataddr(
(
p.name or "False",
p.email and tools.mail._normalize_email(p.email) or "False",
)
)
for p in partners
]
return ", ".join(emails)

Expand Down Expand Up @@ -48,8 +54,8 @@ def _send( # noqa: max-complexity: 4
success_pids = []
failure_type = None
# ===== Same with native Odoo =====
# https://github.com/odoo/odoo/blob/1098b033b4e1811d6ff4b8c3b90aa6b9e697cb93
# /addons/mail/models/mail_mail.py#L465
# https://github.com/odoo/odoo/blob/2baa481e14ca705f4c6d3d4d900daf24442a4aa5
# /addons/mail/models/mail_mail.py#L463
try:
if mail.state != "outgoing":
if mail.state != "exception" and mail.auto_delete:
Expand Down Expand Up @@ -129,7 +135,7 @@ def _send( # noqa: max-complexity: 4
)

# protect against ill-formatted email_from when formataddr was used on an already formatted email # noqa: B950
emails_from = tools.email_split_and_format(mail.email_from)
emails_from = tools.email_split_and_format_normalize(mail.email_from)
email_from = emails_from[0] if emails_from else mail.email_from

# build an RFC2822 email.message.Message object and send it without queuing
Expand Down
1 change: 1 addition & 0 deletions mail_composer_cc_bcc/tests/test_mail_cc_bcc.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
"d52cb36b88b33abc9556f7be6718d93f",
"461467cd5b356072fc054468c75f6e26",
"5d1ab352416f5074e131f35f20098d5b",
"46172c91183f2cb50b22a6b3b5e3869b",
]


Expand Down

0 comments on commit 376ad8d

Please sign in to comment.