From e2207d332016d8e7470ec57483c014cff4cc09f2 Mon Sep 17 00:00:00 2001 From: Roy Le Date: Tue, 29 Sep 2026 16:42:19 +0700 Subject: [PATCH 1/4] [FIX] apriori: merge the modules of Viindoo removed in 16.0 Installed on databases coming from 15.0, without code in 16.0, so far left "to upgrade" for good ("not installable, skipped" at every later migration). - to_sale_wallet, to_wallet_adjustment, to_wallet_currency_conversion_diff -> to_wallet: the wallet extensions removed in 16.0 (b56e788a2c); to_sale_wallet was renamed to_wallet_sale, removed too - to_odoo_saas_product_wallet -> to_odoo_saas_product and to_odoo_saas_wallet -> to_odoo_saas_sale: installable False in 16.0 (7d798428), gone in 17.0 - l10n_vn_viin_account_asset_sale -> l10n_vn_viin_account_asset: removed at 16.0 (81063c6b5) - to_cost_revenue_deferred -> viin_account_auto_transfer: use the viin_account_auto_transfer module instead (95f460416). The deferrals themselves are not converted: their tables stay, like the ones of every obsolete model - to_website_docs_odoo_docs -> to_website_docs_odoo_data: removed (94d9c284) --- openupgrade_scripts/apriori.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/openupgrade_scripts/apriori.py b/openupgrade_scripts/apriori.py index 1227a5cfd9df..9049d9a66d1f 100644 --- a/openupgrade_scripts/apriori.py +++ b/openupgrade_scripts/apriori.py @@ -179,6 +179,10 @@ "viin_hr_holidays_patch1": "viin_hr_holidays", "viin_social_facebook_page_setting": "viin_social_facebook", "viin_social_facebook_page_setting_patch1": "viin_social_facebook", + # the wallet extensions removed in 16.0 (b56e788a2c), to_wallet stays + "to_sale_wallet": "to_wallet", + "to_wallet_adjustment": "to_wallet", + "to_wallet_currency_conversion_diff": "to_wallet", # Viindoo/enterprise "to_account_asset_patch1": "to_account_asset", "to_mrp_account_patch1": "viin_mrp_account", @@ -211,14 +215,20 @@ "viin_mrp_gantt": "viin_mrp", "viin_mrp_split_merge": "mrp", # Feature available in odoo v16.0 "viin_mrp_standard_consumption": "viin_mrp", + "l10n_vn_viin_account_asset_sale": "l10n_vn_viin_account_asset", + # 95f460416: use viin_account_auto_transfer instead (the deferrals are not converted) + "to_cost_revenue_deferred": "viin_account_auto_transfer", # Viindoo/saas-infrastructure "viin_odoo_module_sale_subscription": "viin_odoo_module_subscription", "viin_saas_sale_subscription_free_product": "viin_saas_sale_subscription_loyalty", + "to_odoo_saas_product_wallet": "to_odoo_saas_product", + "to_odoo_saas_wallet": "to_odoo_saas_sale", # Viindoo/odoo-tvtma "viin_saas_membership": "viin_saas_reseller", "viin_saas_reseller_portal": "viin_saas_reseller", "viin_viindoo_membership_white_label": "viin_viindoo_saas_reseller", "viin_website_product_add_to_cart_snippet": "website_sale", + "to_website_docs_odoo_docs": "to_website_docs_odoo_data", # Viindoo/branding "viin_brand_web": "viin_brand_common", "viin_brand_web_editor": "web_editor", From 202aeaadfc5e7848bad3fbe73e2acd82ba6c08f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADctor=20Mart=C3=ADnez?= Date: Wed, 14 May 2025 08:37:14 +0200 Subject: [PATCH 2/4] [OU-IMP] analytic: Define the appropriate value for the root_plan_id field TT56324 (cherry picked from commit dac0d0b78876cb2c373b511e5b9bc8406263e21d) --- .../scripts/analytic/16.0.1.1/post-migration.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/openupgrade_scripts/scripts/analytic/16.0.1.1/post-migration.py b/openupgrade_scripts/scripts/analytic/16.0.1.1/post-migration.py index 91814c497bbf..b85db243845b 100644 --- a/openupgrade_scripts/scripts/analytic/16.0.1.1/post-migration.py +++ b/openupgrade_scripts/scripts/analytic/16.0.1.1/post-migration.py @@ -6,3 +6,7 @@ def migrate(env, version): openupgrade.delete_records_safely_by_xml_id( env, ["analytic.analytic_tag_comp_rule", "analytic.analytic_group_comp_rule"] ) + # Define the appropriate value for the root_plan_id field. Necessary for accounts + # that previously had an account.analytic.group defined. + accounts = env["account.analytic.account"].search([("root_plan_id", "=", False)]) + accounts._compute_root_plan() From 38782a3e2d62387c19684a5d083f7581aa6334c1 Mon Sep 17 00:00:00 2001 From: Roy Le Date: Wed, 30 Sep 2026 11:03:59 +0700 Subject: [PATCH 3/4] [FIX] analytic: set the root plan of archived accounts too The search of the previous commit skips archived accounts: those of a former analytic group keep an empty root plan. At 17.0 the budget lines of such an account are then taken for lines of another plan than the project plan by the migration of to_account_budget, which moves the account out of the project column and loses it. --- .../scripts/analytic/16.0.1.1/post-migration.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/openupgrade_scripts/scripts/analytic/16.0.1.1/post-migration.py b/openupgrade_scripts/scripts/analytic/16.0.1.1/post-migration.py index b85db243845b..acaccf46e14c 100644 --- a/openupgrade_scripts/scripts/analytic/16.0.1.1/post-migration.py +++ b/openupgrade_scripts/scripts/analytic/16.0.1.1/post-migration.py @@ -7,6 +7,10 @@ def migrate(env, version): env, ["analytic.analytic_tag_comp_rule", "analytic.analytic_group_comp_rule"] ) # Define the appropriate value for the root_plan_id field. Necessary for accounts - # that previously had an account.analytic.group defined. - accounts = env["account.analytic.account"].search([("root_plan_id", "=", False)]) + # that previously had an account.analytic.group defined, archived ones included. + accounts = ( + env["account.analytic.account"] + .with_context(active_test=False) + .search([("root_plan_id", "=", False)]) + ) accounts._compute_root_plan() From f416c64a1f948ab83120be11069c21d8c1ae5869 Mon Sep 17 00:00:00 2001 From: Roy Le Date: Wed, 30 Sep 2026 11:11:33 +0700 Subject: [PATCH 4/4] [FIX] analytic: give the analytic lines of the Legacy accounts their plan The plan of an analytic line is stored related to the one of its account, the accounts without analytic group get the Legacy plan with SQL: their lines kept no plan. The migration to 17.0 only moves the lines of a plan to the column of that plan: those lines were left in the project column. --- .../scripts/analytic/16.0.1.1/pre-migration.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/openupgrade_scripts/scripts/analytic/16.0.1.1/pre-migration.py b/openupgrade_scripts/scripts/analytic/16.0.1.1/pre-migration.py index 290bf2809d66..8bdfeb57bc83 100644 --- a/openupgrade_scripts/scripts/analytic/16.0.1.1/pre-migration.py +++ b/openupgrade_scripts/scripts/analytic/16.0.1.1/pre-migration.py @@ -52,6 +52,21 @@ def analytic_account_set_plan_id_if_null(env): """, {"plan_id": plan_id}, ) + # The plan of analytic lines is stored related to the one of their account: the + # lines of the accounts above have no plan otherwise, and are not moved to the + # column of the plan when migrating to 17.0 + openupgrade.logged_query( + env.cr, + """ + UPDATE account_analytic_line aal + SET plan_id = aaa.plan_id + FROM account_analytic_account aaa + WHERE aal.account_id = aaa.id + AND aaa.plan_id = %(plan_id)s + AND aal.plan_id IS NULL + """, + {"plan_id": plan_id}, + ) # Manually update parent_path for legacy plan that we have created # or else we will get error when accessing it openupgrade.logged_query(