diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 50a3c4c531e8..5467b7c61c6f 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -88,7 +88,7 @@ jobs: sudo npm install -g less less-plugin-clean-css pip install -q -r odoo/requirements.txt pip install --ignore-installed \ - git+https://github.com/OCA/openupgradelib.git@master + git+https://github.com/duong77476/openupgradelib.git@master_imp_boostrap4_to_5_transformation # this is for v15 l10n_eg_edi_eta which crashes without it pip install asn1crypto - name: Test data diff --git a/openupgrade_scripts/scripts/website/16.0.1.0/post-migration.py b/openupgrade_scripts/scripts/website/16.0.1.0/post-migration.py index 5cd9fe86d683..f0da611d290c 100644 --- a/openupgrade_scripts/scripts/website/16.0.1.0/post-migration.py +++ b/openupgrade_scripts/scripts/website/16.0.1.0/post-migration.py @@ -3,5 +3,4 @@ @openupgrade.migrate() def migrate(env, version): - openupgrade.delete_records_safely_by_xml_id(env, ["website.website_menu"]) openupgrade.load_data(env.cr, "website", "16.0.1.0/noupdate_changes.xml") diff --git a/openupgrade_scripts/scripts/website/16.0.1.0/pre-migration.py b/openupgrade_scripts/scripts/website/16.0.1.0/pre-migration.py index ea94e2b4a721..1f1c90469619 100644 --- a/openupgrade_scripts/scripts/website/16.0.1.0/pre-migration.py +++ b/openupgrade_scripts/scripts/website/16.0.1.0/pre-migration.py @@ -34,40 +34,31 @@ def _fill_partner_id_if_null(env): openupgrade.logged_query( env.cr, """ - UPDATE website_visitor - SET partner_id = CASE - WHEN length(access_token) != 32 THEN CAST(access_token AS integer) - ELSE partner_id - END - WHERE partner_id IS NULL; + UPDATE website_visitor v + SET partner_id = p.id + FROM res_partner p + WHERE v.partner_id IS NULL + AND length(v.access_token) != 32 + AND p.id = CAST(v.access_token AS integer); """, ) def _fill_language_ids_if_null(env): - openupgrade.logged_query( - env.cr, - """ - INSERT INTO website_lang_rel (website_id, lang_id) - SELECT w.id, rl.id - FROM website w - CROSS JOIN res_lang rl - WHERE w.id NOT IN (SELECT website_id FROM website_lang_rel) - AND rl.active = true; - """, - ) + websites = env["website"].search([("language_ids", "=", False)]) + for website in websites: + website.write({"language_ids": [(4, website.default_lang_id.id)]}) -def keep_the_first_domain_when_duplicate(env): +def _fill_homepage_url(env): openupgrade.logged_query( env.cr, """ UPDATE website - SET domain = NULL - WHERE id NOT IN ( - SELECT MIN(id) - FROM website - GROUP BY domain + SET homepage_url = ( + SELECT url + FROM website_page + WHERE website_page.id = website.homepage_id ); """, ) @@ -96,5 +87,5 @@ def migrate(env, version): openupgrade.rename_xmlids(env.cr, _xmlids_renames) openupgrade.delete_records_safely_by_xml_id(env, _xmlids_delete) delete_constraint_website_visitor_partner_uniq(env) - keep_the_first_domain_when_duplicate(env) boostrap_5_migration(env) + _fill_homepage_url(env) diff --git a/openupgrade_scripts/scripts/website/16.0.1.0/upgrade_analysis_work.txt b/openupgrade_scripts/scripts/website/16.0.1.0/upgrade_analysis_work.txt index 0526868d7e83..2d7729bb3bfc 100644 --- a/openupgrade_scripts/scripts/website/16.0.1.0/upgrade_analysis_work.txt +++ b/openupgrade_scripts/scripts/website/16.0.1.0/upgrade_analysis_work.txt @@ -61,9 +61,6 @@ DEL ir.model.access: website.access_website_ir_ui_view_publisher # NOTHING TO DO NEW ir.model.constraint: website.constraint_website_domain_unique - -# DONE: Having duplicate domains will keep the first one in pre-migration - DEL ir.model.constraint: website.constraint_website_visitor_partner_uniq # DONE: safely delete pre-migration