Merge pull request #324 from Tecnativa/9.0-mig-account_banking_pain_base

[9.0][MIG] account_banking_pain_base: Script OpenUPgrade
This commit is contained in:
Pedro M. Baeza
2016-12-27 09:51:55 +01:00
committed by GitHub
3 changed files with 31 additions and 15 deletions

View File

@@ -1,15 +0,0 @@
# -*- coding: utf-8 -*-
# © 2015 Akretion - Alexis de Lattre <alexis.delattre@akretion.com>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from openerp.addons.account_banking_pain_base.post_install\
import set_default_initiating_party
from openerp import pooler
def migrate(cr, version):
if not version:
return
pool = pooler.get_pool(cr.dbname)
set_default_initiating_party(cr, pool)

View File

@@ -0,0 +1,16 @@
# -*- coding: utf-8 -*-
# © 2016 Sergio Teruel <sergio.teruel@tecnativa.com>
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html
from openupgradelib import openupgrade
def migrate(cr, version):
"""Copy convert_to_ascii to account_payment_method."""
sql = """
UPDATE account_payment_method p_method
SET convert_to_ascii=p_mode.%s
FROM account_payment_mode p_mode
WHERE p_mode.payment_method_id=p_method.id
""" % openupgrade.get_legacy_name('convert_to_ascii')
openupgrade.logged_query(cr, sql)

View File

@@ -0,0 +1,15 @@
# -*- coding: utf-8 -*-
# © 2016 Sergio Teruel <sergio.teruel@tecnativa.com>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from openupgradelib import openupgrade
column_renames = {
'account_payment_mode': [
('convert_to_ascii', None),
],
}
def migrate(cr, version):
openupgrade.rename_columns(cr, column_renames)