[IMP+FIX] document_page_reference: Refactor code related to https://github.com/OCA/knowledge/pull/550#issuecomment-3108953008

TT55514
This commit is contained in:
Víctor Martínez
2025-08-21 12:26:49 +02:00
parent 30337f6547
commit 9a5d18a9a6
8 changed files with 67 additions and 73 deletions

View File

@@ -0,0 +1,12 @@
# Copyright 2025 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):
for item in env["document.page"].search([("content", "ilike", "${")]):
item.content = re.sub(r"\${(.+)}", r"{{\1}}", item.content)