Skip to content

Conversation

@KKamaa
Copy link

@KKamaa KKamaa commented Dec 31, 2025

fix bug where in email_template_qweb module: the QWeb renderer (ir.qweb) is instantiated once from the original environment (self.env) before the code switches into the per-language context:

  • Subject is rendered via the "normal" mail.template rendering path that uses the per-language self_with_lang context -> it follows template.lang.
  • Body is rendered by ir.qweb._render(...) using an IrQweb recordset created before lang was applied -> it keeps whatever env.lang was at the moment generate_email() started (e.g. the website request language, current user language, etc.), which explains the "random" English/Dutch mix.

Copy link

@thomaspaulb thomaspaulb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code approved, just the commit message should change to the OCA standard:

[FIX] email_template_qweb: use language-aware env for rendering QWeb

More detailed information... (maybe can leave out in this case, summary is clear)

"body_html"
] = self_with_lang._render_template_postprocess(
{res_id: body_html}
)[
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bit overkill to spread [res_id] over three lines.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks that way due to the pylint but the res_id used is from the for loop.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe I was not clear, I just meant that lines 48 - 50 could be on one line, making it all a bit more compact and readable.

Copy link
Author

@KKamaa KKamaa Jan 6, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated the readability on the lines affected

Copy link

@NL66278 NL66278 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 One minor remark but for the rest LGTM

@KKamaa KKamaa force-pushed the 16.0-13011-fix-email-template-qweb branch from c36282d to 4ffe344 Compare January 4, 2026 20:33
@KKamaa KKamaa changed the title Draft: [16.0][FIX] #13011 Bug Draft: [16.0][FIX] email_template_qweb: use language-aware env for rendering QWeb Jan 4, 2026
@OCA-git-bot
Copy link
Contributor

This PR has the approved label and has been created more than 5 days ago. It should therefore be ready to merge by a maintainer (or a PSC member if the concerned addon has no declared maintainer). 🤖

@thomaspaulb
Copy link

@OCA/social-maintainers This is ready for merge

@NL66278
Copy link

NL66278 commented Jan 6, 2026

@KKamaa Please remove the Draft: status of this PR, as that might stop people from merging.

@KKamaa KKamaa changed the title Draft: [16.0][FIX] email_template_qweb: use language-aware env for rendering QWeb [16.0][FIX] email_template_qweb: use language-aware env for rendering QWeb Jan 6, 2026
@KKamaa KKamaa requested review from NL66278 and ntsirintanis January 6, 2026 21:34
Copy link

@NL66278 NL66278 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 Already looked good. Now even better ;-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants