Skip to content

Commit

Permalink
Merge pull request #661 from Tecnativa/16.0-fix-pos_analytic_by_confi…
Browse files Browse the repository at this point in the history
…g-migration-scripts

[16.0][FIX] pos_analytic_by_config: migration scripts
  • Loading branch information
pedrobaeza authored May 31, 2024
2 parents 8f8c674 + bef07e3 commit eb44bc3
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def migrate(env, version):
"""
)
pos_configs_dict = {
env["pos.config"].browse(id): env["analytic.account"].browse(aa_id)
env["pos.config"].browse(id): env["account.analytic.account"].browse(aa_id)
for id, aa_id, *_ in env.cr.fetchall()
}
pos_configs = env["pos.config"].browse([pc.id for pc in pos_configs_dict.keys()])
Expand Down Expand Up @@ -54,11 +54,12 @@ def migrate(env, version):
)
for config in company_configs:
analytic_account = pos_configs_dict[config]
analytic_account.analytic_plan_id = analytic_plan.id
analytic_account.plan_id = analytic_plan.id
env["account.analytic.distribution.model"].create(
{
"account_prefix": default_account_revenue.code[:3],
"pos_config_id": config.id,
"analytic_distribution": {analytic_account.id: 100},
"company_id": company.id,
}
)

0 comments on commit eb44bc3

Please sign in to comment.