Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FIX] fill_analytic_distribution get analytic account column #360

Merged
merged 1 commit into from
Feb 14, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading