[MIG] base_comment_template: Migration to 15.0

TT35696
This commit is contained in:
Víctor Martínez
2022-09-13 16:43:26 +02:00
committed by Jesús Alan Ramos Rodríguez
parent 61973247ec
commit 1a9d3178f1
23 changed files with 106 additions and 330 deletions

View File

@@ -0,0 +1,17 @@
# Copyright 2022 Tecnativa - Víctor Martínez
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
import re
from openupgradelib import openupgrade
@openupgrade.migrate()
def migrate(env, version):
"""In v15 mail engine is inline_template, we try to replace the following:
- ${object} > {{object}}
- ${user} > {{user}}
- ${ctx} > {{ctx}}
"""
for item in env["base.comment.template"].search([("text", "ilike", "${")]):
item.text = re.sub(r"\${(.+)}", r"{{\1}}", item.text)