From 8e3e2fc560305c90f47cd8954dee4b6c14c4f3d9 Mon Sep 17 00:00:00 2001 From: migodoo <jordan> Date: Thu, 5 May 2022 14:09:25 +0200 Subject: [PATCH] [fix] migration script --- migrations/13.0.1.0.0/post-migration.py | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 migrations/13.0.1.0.0/post-migration.py diff --git a/migrations/13.0.1.0.0/post-migration.py b/migrations/13.0.1.0.0/post-migration.py new file mode 100644 index 0000000..d44fb48 --- /dev/null +++ b/migrations/13.0.1.0.0/post-migration.py @@ -0,0 +1,24 @@ +# © 2022 Le Filament (<http://www.le-filament.com>) +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). + +from openupgradelib import openupgrade # pylint: disable=W7936 +from psycopg2 import sql + + +def scop_account_arescop_map_values(env): + env.cr.execute( + sql.SQL( + """ + UPDATE account_move am + SET + arescop_group_id = ai.arescop_group_id, + is_arescop_invoiced = ai.is_arescop_invoiced + FROM account_invoice ai + WHERE ai.id = am.old_invoice_id; + """ + ), + ) + +@openupgrade.migrate() +def migrate(env, version): + scop_account_arescop_map_values(env) -- GitLab