HeadlinesBriefing favicon HeadlinesBriefing.com

Odoo 15 Email Template Bug: Wrong Order Lines Rendered

DEV Community •
×

A developer reports a critical bug in Odoo 15's Website Sale module where order confirmation emails display incorrect line items. The issue surfaces when multiple coupon programs trigger separate emails from a single order, each using a unique mail.template. While the system sends all messages successfully, the rendered order lines are jumbled, showing only the last item or lines from other products.

The problem occurs within a single HTTP request, using the same sale.order record ID for all templates. The code correctly calls `_render_field()` to generate HTML, yet the final email body is corrupted. This suggests a state persistence issue in Odoo's email rendering engine when processing multiple templates for the same model instance concurrently.

Developers suspect a core limitation in Odoo 15's mail.template rendering when sharing a record context. The recommended workaround may involve isolating data per email by forcing a separate transaction or re-fetching the order line subset within each template's rendering context. The community seeks an official fix or a reliable pattern to ensure each email reflects only its designated product rules.