From 7f1701cc45c2e0359f361aeeec39e498012fca44 Mon Sep 17 00:00:00 2001 From: "Pedro M. Baeza" Date: Fri, 13 Nov 2020 09:08:03 +0100 Subject: [PATCH] [MIG+FIX] base_comment_template: Fix migration scripts As the field was not properly converted to property at 2.0.0, the script fails to do its job when migrating from v11, so we need to adapt the scripts to this situation. --- .../migrations/12.0.2.0.0/pre-migration.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 base_comment_template/migrations/12.0.2.0.0/pre-migration.py diff --git a/base_comment_template/migrations/12.0.2.0.0/pre-migration.py b/base_comment_template/migrations/12.0.2.0.0/pre-migration.py new file mode 100644 index 000000000..bccc15632 --- /dev/null +++ b/base_comment_template/migrations/12.0.2.0.0/pre-migration.py @@ -0,0 +1,13 @@ +# Copyright 2020 Tecnativa - Pedro M. Baeza +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). +from openupgradelib import openupgrade + + +@openupgrade.migrate() +def migrate(env, version): + cr = env.cr + table = 'res_partner' + old_column = 'comment_template_id' + new_column = 'property_comment_template_id' + if openupgrade.column_exists(cr, table, old_column): + openupgrade.rename_columns(cr, {table: [(old_column, new_column)]})