mirror of
https://github.com/OCA/intrastat-extrastat.git
synced 2025-02-16 17:13:41 +02:00
[MIG] intrastat_product: add migration script
This commit is contained in:
18
intrastat_product/migrations/11.0.1.0.0/post-migration.py
Normal file
18
intrastat_product/migrations/11.0.1.0.0/post-migration.py
Normal file
@@ -0,0 +1,18 @@
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
|
||||
# Copyright 2021 ForgeFlow <http://www.forgeflow.com>
|
||||
|
||||
from openupgradelib import openupgrade # pylint: disable=W7936
|
||||
|
||||
|
||||
def update_intrastat_product_declaration_year(env):
|
||||
openupgrade.logged_query(
|
||||
env.cr, """
|
||||
UPDATE intrastat_product_declaration
|
||||
SET year = {integer_year} || ''
|
||||
""".format(integer_year=openupgrade.get_legacy_name("year"))
|
||||
)
|
||||
|
||||
|
||||
@openupgrade.migrate()
|
||||
def migrate(env, version):
|
||||
update_intrastat_product_declaration_year(env)
|
||||
12
intrastat_product/migrations/11.0.1.0.0/pre-migration.py
Normal file
12
intrastat_product/migrations/11.0.1.0.0/pre-migration.py
Normal file
@@ -0,0 +1,12 @@
|
||||
# Copyright 2021 ForgeFlow <http://www.forgeflow.com>
|
||||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
|
||||
from openupgradelib import openupgrade
|
||||
|
||||
_column_renames = {
|
||||
"intrastat_product_declaration": [("year", None)],
|
||||
}
|
||||
|
||||
|
||||
@openupgrade.migrate()
|
||||
def migrate(env, version):
|
||||
openupgrade.rename_columns(env.cr, _column_renames)
|
||||
Reference in New Issue
Block a user