[FIX] base_comment_template: script pre-migration

When upgrade odoo from old version, table `base_comment_template_ir_model_rel` does not exists.

MT-6161 @moduon
This commit is contained in:
Emilio Pascual
2024-06-24 09:08:12 +02:00
parent eee5fd494c
commit e6bdc326e5

View File

@@ -8,7 +8,9 @@ from odoo.tools.sql import column_exists
@openupgrade.migrate()
def migrate(env, version):
if not column_exists(env.cr, "base_comment_template", "models"):
if openupgrade.table_exists(
env.cr, "base_comment_template_ir_model_rel"
) and not column_exists(env.cr, "base_comment_template", "models"):
openupgrade.logged_query(
env.cr,
"ALTER TABLE base_comment_template ADD COLUMN IF NOT EXISTS models text",