[19.0][MIG] mail_notification_custom_subject: Migration to 19.0#221
Open
quoc-pn wants to merge 23 commits into
Open
[19.0][MIG] mail_notification_custom_subject: Migration to 19.0#221quoc-pn wants to merge 23 commits into
quoc-pn wants to merge 23 commits into
Conversation
…l notifications This module allows you to specify templates to override the subject on the notification emails sent by Odoo. TT27191 Co-authored-by: Pedro M. Baeza <pedro.baeza@tecnativa.com>
…ad_template_does_not_break test
[IMP] update dotfiles [ci skip]
TT36470 [UPD] Update mail_notification_custom_subject.pot [UPD] README.rst Update translation files Updated by "Update PO files to match POT (msgmerge)" hook in Weblate. Translation: social-15.0/social-15.0-mail_notification_custom_subject Translate-URL: https://translation.odoo-community.org/projects/social-15-0/social-15-0-mail_notification_custom_subject/
… send messages After installing the module, any user was required to have admin rights to be able to search across models. This fix does just that search with sudo and returns back to non-sudo mode immediately after. This way, we don't need to increase permissions for everybody. Tests now run unprivileged, to assert this problem never happens again. @moduon MT-1644 MT-1645
[UPD] README.rst mail_notification_custom_subject 15.0.1.0.1
…n selecting subtype_id [UPD] README.rst mail_notification_custom_subject 15.0.1.0.2
…ert syntaxis of jinja2 to jinja3 [UPD] README.rst
[UPD] Update mail_notification_custom_subject.pot [BOT] post-merge updates Update translation files Updated by "Update PO files to match POT (msgmerge)" hook in Weblate. Translation: social-17.0/social-17.0-mail_notification_custom_subject Translate-URL: https://translation.odoo-community.org/projects/social-17-0/social-17-0-mail_notification_custom_subject/
…ld translatable TT52259 [BOT] post-merge updates
… it is already set If we write something from the mail thread (without subject) it is only when it should replace the subject. TT52259
…ception to know what has happened TT52259
Example use Case: Our company is called: MY_COMPANY_NAME but is known as MCN, we want to replace in some places the subject line so that it is sent with MCN TT52259 [UPD] Update mail_notification_custom_subject.pot [BOT] post-merge updates Update translation files Updated by "Update PO files to match POT (msgmerge)" hook in Weblate. Translation: social-17.0/social-17.0-mail_notification_custom_subject Translate-URL: https://translation.odoo-community.org/projects/social-17-0/social-17-0-mail_notification_custom_subject/
The mail.thread override searches mail.message.custom.subject with sudo and then explicitly drops back to the caller's env with .sudo(False). When iterating the resulting recordset, field reads trigger ACL checks against the caller. Portal and public users are allowed to trigger message_post through portal controllers (which typically call record.sudo().message_post), but they lack read access to mail.message.custom.subject — an internal-only ACL. The resulting AccessError is silently caught by the per-template try/except, but the custom subject is never applied for those users, and the raw AccessError can leak when field access is triggered outside the try block (e.g. via prefetch on related fields). Templates are admin-managed configuration records, akin to mail.template. They should be read with sudo, while rendering still honors the caller's permissions on the business record via res_ids. Add a test that reproduces the portal-user path: runs as a portal user (asserts base.group_portal / not base.group_user), posts via partner.sudo().message_post(..., author_id=portal_user.partner_id) — the exact pattern used by portal controllers. Without the fix the subject falls back to the default "Re: <name>"; with the fix it is rendered from the template.
quoc-pn
force-pushed
the
19.0-mig-mail_notification_custom_subject
branch
from
July 2, 2026 09:19
fa02731 to
25d680f
Compare
Member
Author
|
This PR depends on the PR #216 to be able to test on Runboat. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.