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", 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..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 @@ -6,3 +6,11 @@ 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, archived ones included. + accounts = ( + env["account.analytic.account"] + .with_context(active_test=False) + .search([("root_plan_id", "=", False)]) + ) + accounts._compute_root_plan() 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(