From e7f414e38a14d9812511efb8f082236ae31efd9f Mon Sep 17 00:00:00 2001 From: Stefan Rijnhart Date: Wed, 24 Jul 2013 16:52:03 +0200 Subject: [PATCH] [FIX] Fixed migration scripts after testing --- .../post-set-statement-line-state.py | 0 .../migrations/7.0.0.1/pre-migration.py | 33 ++++++++++++++++ .../post-fill-ir_model_id.py | 0 .../post-set-payment-order-type.py | 0 .../migrations/7.0.2/post-migration.py | 38 +++++++++++++++++++ .../migrations/7.0.2/pre-migration.py | 14 ++----- 6 files changed, 75 insertions(+), 10 deletions(-) rename account_banking/migrations/{0.1.81 => 6.1.0.1.81}/post-set-statement-line-state.py (100%) create mode 100644 account_banking/migrations/7.0.0.1/pre-migration.py rename account_banking_nl_clieop/migrations/{0.63 => 6.1.0.63}/post-fill-ir_model_id.py (100%) rename account_banking_nl_clieop/migrations/{0.64 => 6.1.0.64}/post-set-payment-order-type.py (100%) create mode 100644 account_direct_debit/migrations/7.0.2/post-migration.py diff --git a/account_banking/migrations/0.1.81/post-set-statement-line-state.py b/account_banking/migrations/6.1.0.1.81/post-set-statement-line-state.py similarity index 100% rename from account_banking/migrations/0.1.81/post-set-statement-line-state.py rename to account_banking/migrations/6.1.0.1.81/post-set-statement-line-state.py diff --git a/account_banking/migrations/7.0.0.1/pre-migration.py b/account_banking/migrations/7.0.0.1/pre-migration.py new file mode 100644 index 000000000..e12284d0e --- /dev/null +++ b/account_banking/migrations/7.0.0.1/pre-migration.py @@ -0,0 +1,33 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# Copyright (C) 2013 Therp BV (). +# All Rights Reserved +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . +# +############################################################################## + +def migrate(cr, version): + if not version: + return + + # workflow state moved to another, new module + cr.execute( + """ + UPDATE ir_model_data + SET module = 'account_banking_payment' + WHERE name = 'trans_done_sent' + AND module = 'account_direct_debit' + """) diff --git a/account_banking_nl_clieop/migrations/0.63/post-fill-ir_model_id.py b/account_banking_nl_clieop/migrations/6.1.0.63/post-fill-ir_model_id.py similarity index 100% rename from account_banking_nl_clieop/migrations/0.63/post-fill-ir_model_id.py rename to account_banking_nl_clieop/migrations/6.1.0.63/post-fill-ir_model_id.py diff --git a/account_banking_nl_clieop/migrations/0.64/post-set-payment-order-type.py b/account_banking_nl_clieop/migrations/6.1.0.64/post-set-payment-order-type.py similarity index 100% rename from account_banking_nl_clieop/migrations/0.64/post-set-payment-order-type.py rename to account_banking_nl_clieop/migrations/6.1.0.64/post-set-payment-order-type.py diff --git a/account_direct_debit/migrations/7.0.2/post-migration.py b/account_direct_debit/migrations/7.0.2/post-migration.py new file mode 100644 index 000000000..a6ec3af59 --- /dev/null +++ b/account_direct_debit/migrations/7.0.2/post-migration.py @@ -0,0 +1,38 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# Copyright (C) 2013 Therp BV (). +# +# All other contributions are (C) by their respective contributors +# +# All Rights Reserved +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . +# +############################################################################## + +def migrate(cr, version): + if not version: + return + cr.execute( + """ + UPDATE payment_line + SET transit_move_line_id = banking_addons_61_debit_move_line_id + """) + cr.execute( + """ + ALTER TABLE "payment_line" + DROP COLUMN "banking_addons_61_debit_move_line_id" + """ + ) diff --git a/account_direct_debit/migrations/7.0.2/pre-migration.py b/account_direct_debit/migrations/7.0.2/pre-migration.py index 3dd113401..a167bca53 100644 --- a/account_direct_debit/migrations/7.0.2/pre-migration.py +++ b/account_direct_debit/migrations/7.0.2/pre-migration.py @@ -22,6 +22,9 @@ # ############################################################################## +import logging +logger = logging.getLogger() + def rename_columns(cr, column_spec): """ Rename table columns. Taken from OpenUpgrade. @@ -41,17 +44,8 @@ def migrate(cr, version): if not version: return - # workflow state moved to another module - cr.execute( - """ - UPDATE ir_model_data - SET module = 'account_banking_payment' - WHERE name = 'trans_done_sent' - AND module = 'account_direct_debit' - """) - # rename field debit_move_line_id rename_columns(cr, { 'payment_line': [ - ('debit_move_line_id', 'transit_move_line_id'), + ('debit_move_line_id', 'banking_addons_61_debit_move_line_id'), ]})