From 81c61e8d0473d6725d6c2e865f83bf1c512c3ebd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADctor=20Mart=C3=ADnez?= Date: Wed, 4 Sep 2024 09:07:17 +0200 Subject: [PATCH] [OU-ADD] mis_builder: Add migration script to set the value of the analytic_domain field TT50696 --- .../migrations/16.0.1.0.1/post-migration.py | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 mis_builder/migrations/16.0.1.0.1/post-migration.py diff --git a/mis_builder/migrations/16.0.1.0.1/post-migration.py b/mis_builder/migrations/16.0.1.0.1/post-migration.py new file mode 100644 index 000000000..e812f09f7 --- /dev/null +++ b/mis_builder/migrations/16.0.1.0.1/post-migration.py @@ -0,0 +1,25 @@ +# Copyright 2024 Tecnativa - Víctor Martínez +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). + +from openupgradelib import openupgrade + + +@openupgrade.migrate() +def migrate(env, version): + """Set the value of the analytic_domain field.""" + openupgrade.logged_query( + env.cr, + """ + UPDATE mis_report_instance_period + SET analytic_domain = CONCAT('[("analytic_distribution_search", "in", [', analytic_account_id::VARCHAR, '])]') + WHERE analytic_account_id IS NOT NULL + """, # noqa: E501 + ) + openupgrade.logged_query( + env.cr, + """ + UPDATE mis_report_instance + SET analytic_domain = CONCAT('[("analytic_distribution_search", "in", [', analytic_account_id::VARCHAR, '])]') + WHERE analytic_account_id IS NOT NULL + """, # noqa: E501 + )