Skip to content

Commit

Permalink
Merge pull request #360 from lefilament/fix-fill_anal_distrib
Browse files Browse the repository at this point in the history
[FIX] fill_analytic_distribution get analytic account column
  • Loading branch information
pedrobaeza authored Feb 14, 2024
2 parents 2911395 + 6cbeca7 commit 6cc596c
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions openupgradelib/openupgrade_160.py
Original file line number Diff line number Diff line change
Expand Up @@ -422,6 +422,7 @@ def fill_analytic_distribution(
m2m_column1,
m2m_column2="account_analytic_tag_id",
column="analytic_distribution",
analytic_account_column="analytic_account_id",
):
"""Convert v15 analytic tags with distributions to v16 analytic distributions.
Expand All @@ -434,6 +435,8 @@ def fill_analytic_distribution(
the record of the analytic tag. By default, it's "account_analytic_tag_id".
:param column: (Optional) Name of the column in the main table for storing the new
analytic distribution. By default, it's "analytic_distribution".
:param analytic_account_column: (Optional) Name of the column in the main table for
storing the old analytic account. By default, it's analytic_account_id.
"""
logged_query(
env.cr,
Expand All @@ -455,8 +458,8 @@ def fill_analytic_distribution(
100 AS percentage
FROM {table} line
JOIN account_analytic_account account
ON account.id = line.analytic_account_id
WHERE line.analytic_account_id IS NOT NULL
ON account.id = line.{analytic_account_column}
WHERE line.{analytic_account_column} IS NOT NULL
UNION ALL
Expand Down

0 comments on commit 6cc596c

Please sign in to comment.