Skip to content

[19.0][FIX] mail_tracking: do not swallow exceptions in send_email (task#33063) - #7

Closed
alan196 wants to merge 1 commit into
Jarsa:19.0from
Jarsa-dev:19.0-jarsa-fix-mail_tracking-reraise
Closed

alan196 wants to merge 1 commit into
Jarsa:19.0from
Jarsa-dev:19.0-jarsa-fix-mail_tracking-reraise

Conversation

@alan196

@alan196 alan196 commented Nov 30, 2026 •

Copy link
Copy Markdown

Brings the upstream fix OCA#266 (already merged in OCA/19.0) into Jarsa/19.0. Our fork is behind OCA and still swallows the exception when a tracking record exists.

Cherry-pick of d3f4d09 [FIX] mail_tracking: do not swallow exceptions in send_email (authorship kept).

All 46 mail_tracking tests pass, and pre-commit passes. The next rebase of the fork on OCA will drop this commit as already applied.

Merge with "Rebase and merge".

🤖 Generated with Claude Code

`MailMail._send()` tells a successful delivery from a failed one by the
exception raised by `send_email()`, not by its return value. `mail_tracking`
catches every exception and, when a `mail.tracking.email` record exists, records
the error on the tracking record and returns normally, so core believes the
mail was delivered: the recipient is marked as reached and its notification is
written `sent` for a mail that never left, core's `except AssertionError` never
runs so a NO_VALID_RECIPIENT is never classified, and the mail keeps the
placeholder failure reason set before the sending loop.

A tracking record is created for every outgoing email, so with `mail_tracking`
installed core's whole failure-handling path is disabled for the database.

This is not a duplicate of OCA#215/OCA#212, which added `else: raise`, i.e. it only
re-raises when there is NO tracking record -- the branch that is dead in
practice. The live case is the other one.

Re-raise unconditionally. The error is still recorded on the tracking record by
the `smtp_error()` call just above, so nothing is lost; only core's contract is
restored.

Note for adopters: delivery failures that used to be silent now surface as
`exception` states on `mail.mail`/`mail.notification`, so a backlog of
previously hidden failures may become visible at once on upgrade.

Fixes OCA#253
@jarsabot

Copy link
Copy Markdown

Linked to Odoo task #33063

@alan196
alan196 force-pushed the 19.0-jarsa-fix-mail_tracking-reraise branch from e62f27b to d92ede7 Compare November 30, 2026 17:56
@alan196

alan196 commented Nov 30, 2026

Copy link
Copy Markdown
Author

Not needed: Jarsa/19.0 is already in sync with OCA/19.0 (25d8adc), which includes d3f4d09 from OCA#266.

@alan196 alan196 closed this Nov 30, 2026
@alan196
alan196 deleted the 19.0-jarsa-fix-mail_tracking-reraise branch November 30, 2026 18:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants