-
-
Notifications
You must be signed in to change notification settings - Fork 309
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[OU-ADD] mis_builder: Add migration script to set the value of the an…
…alytic_domain field TT50696
- Loading branch information
1 parent
eaa937a
commit 81c61e8
Showing
1 changed file
with
25 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
) |