Skip to content

Commit

Permalink
[OU-IMP] account: need to fill analytic_distribution when
Browse files Browse the repository at this point in the history
analytic_account_id is specify
  • Loading branch information
duong77476-viindoo committed Jul 17, 2023
1 parent 896c674 commit e5108b4
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions openupgrade_scripts/scripts/account/16.0.1.2/pre-migration.py
Original file line number Diff line number Diff line change
Expand Up @@ -549,13 +549,6 @@ def _dynamic_fast_fill_analytic_distribution_when_inherit_analytic_mixin(
GROUP BY
{table_name}.id
"""
if is_having_analytic_account_id_col:
select_query += f"""
, {table_name}.analytic_account_id AS account_analytic_account
"""
groupby_query += f"""
, {table_name}.analytic_account_id
"""
openupgrade.logged_query(
env.cr,
f"""
Expand Down Expand Up @@ -603,6 +596,18 @@ def _dynamic_fast_fill_analytic_distribution_when_inherit_analytic_mixin(
WHERE {table_name}.id = analytic_distribution_sub.id
""",
)
if is_having_analytic_account_id_col:
openupgrade.logged_query(
env.cr,
"""
UPDATE {}
SET analytic_distribution =
analytic_distribution || jsonb_build_object({}::text, 100)
WHERE analytic_account_id IS NOT NULL
""".format(
table_name, table_name + ".analytic_account_id"
),
)


@openupgrade.migrate()
Expand Down

0 comments on commit e5108b4

Please sign in to comment.