Skip to content

[14.0 -> 15.0] mail: Brackets not handled correctly within HTML placeholder element in Jinja -> QWeb mig. #5480

Description

@Honeyxilia

Module

mail

Describe the bug

When trying to migrate a mail template, using brackets within the value of a HTML placeholder (which functions in previous Odoo versions, like 12.0), the Regex matches with the bracket pair nested inside of the placeholder element.

For instance:

  • The initial template contains this instruction ${object.env["dummy.model"].create({"val": value}).name}
  • After migrating the database to Odoo v15.0 using OpenUpgrade, the placeholder is turned into this : <t t-out='object.env["dummy.model"].create({"val": value'></t>).name}

To Reproduce

Affected versions: 15.0, post-migration

Steps to reproduce the behavior:

  1. In an Odoo version prior to 15.0 (ie. 14.0), create a mail.template
  2. Within the main template, insert this instruction (in HTML) : ${env['res.partner'].create({"name": "Dummy user"}).name}, then save the template
  3. Migrate the template to Odoo v15 using the OpenUpgrade script

Expected behavior
We would like that nested brackets within an HTML placeholder are matched correctly, and not match any nested bracket pairs

For instance :

  • The initial template contains this instruction ${object.env["dummy.model"].create({"val": value}).name}
  • The expected result would be <t t-out='object.env["dummy.model"].create({"val": value}).name'></t>

Additional context
It might be done using recursive pattern matching

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions