From f2246cf5689c4e9a73e7e9f0c7083b22c1cfcc27 Mon Sep 17 00:00:00 2001 From: cubells Date: Thu, 11 May 2017 10:46:42 +0200 Subject: [PATCH] [ADD] currency_rate_update migration script --- .../migrations/9.0.1.1/post-migration.py | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 currency_rate_update/migrations/9.0.1.1/post-migration.py diff --git a/currency_rate_update/migrations/9.0.1.1/post-migration.py b/currency_rate_update/migrations/9.0.1.1/post-migration.py new file mode 100644 index 000000000..96f658e55 --- /dev/null +++ b/currency_rate_update/migrations/9.0.1.1/post-migration.py @@ -0,0 +1,20 @@ +# -*- coding: utf-8 -*- +# Copyright 2017 Tecnativa - Vicent Cubells +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). + +from openupgradelib import openupgrade + + +def migrate_currency_rate_update(env): + """ Update field value because service selection field has changed """ + query = """ + UPDATE currency_rate_update_service + SET {0}=replace({0}, '_getter', '') + WHERE {0} like '%_getter' + """ + env.cr.execute(query.format('service')) + + +@openupgrade.migrate(use_env=True) +def migrate(env, version): + migrate_currency_rate_update(env)