From 85203dd69758b1a517b6cab92608acb8974d5b60 Mon Sep 17 00:00:00 2001 From: "Pedro M. Baeza" Date: Wed, 17 Jun 2026 16:26:50 +0200 Subject: [PATCH] [OU-ADD] website_sale_collect: Migration scripts TT63193 --- .../19.0.1.0/post-migration.py | 47 +++++++++++++++++++ .../19.0.1.0/upgrade_analysis_work.txt | 6 +++ 2 files changed, 53 insertions(+) create mode 100644 openupgrade_scripts/scripts/website_sale_collect/19.0.1.0/post-migration.py create mode 100644 openupgrade_scripts/scripts/website_sale_collect/19.0.1.0/upgrade_analysis_work.txt diff --git a/openupgrade_scripts/scripts/website_sale_collect/19.0.1.0/post-migration.py b/openupgrade_scripts/scripts/website_sale_collect/19.0.1.0/post-migration.py new file mode 100644 index 000000000000..97a0e226b7ab --- /dev/null +++ b/openupgrade_scripts/scripts/website_sale_collect/19.0.1.0/post-migration.py @@ -0,0 +1,47 @@ +# Copyright 2026 Tecnativa - Pedro M. Baeza +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +from openupgradelib import openupgrade + + +def _mark_pickup_auxiliary_addresses(env): + """Mark as pickup locations those delivery addresses of partners that match with the + address data of the pickup locations. This is because this version has a patch for + avoiding to show that auto-created addresses into the checkout form, which wasn't + available in 18. + + More info at https://github.com/odoo/odoo/commit/1d24fc854fbb25fbf979f14ecc6a6507fba + + Meanwhile, in 18, it was fixed through OPW putting the record as archived: + + https://github.com/odoo/odoo/pull/242876 + + For having consistency, let's put the flag even if they are archived. + """ + pickup_locations = ( + env["delivery.carrier"] + .search([("delivery_type", "=", "in_store")]) + .warehouse_ids.partner_id + ) + for p in pickup_locations: + openupgrade.logged_query( + env.cr, + """ + UPDATE res_partner + SET is_pickup_location = True + WHERE + street = %s, + city = %s, + state_id = %s, + country_id = %s, + parent_id != False, + type = 'delivery', + """, + (p.street, p.city, p.state_id, p.country_id), + ) + + +@openupgrade.migrate() +def migrate(env, version): + openupgrade.load_data(env, "website_sale_collect", "19.0.1.0/noupdate_changes.xml") + _mark_pickup_auxiliary_addresses(env) diff --git a/openupgrade_scripts/scripts/website_sale_collect/19.0.1.0/upgrade_analysis_work.txt b/openupgrade_scripts/scripts/website_sale_collect/19.0.1.0/upgrade_analysis_work.txt new file mode 100644 index 000000000000..10c32c882c6a --- /dev/null +++ b/openupgrade_scripts/scripts/website_sale_collect/19.0.1.0/upgrade_analysis_work.txt @@ -0,0 +1,6 @@ +---Models in module 'website_sale_collect'--- +---Fields in module 'website_sale_collect'--- +website_sale_collect / payment.provider / custom_mode (False) : selection_keys added: [cash_on_delivery] (most likely nothing to do) +NOTHING TO DO + +---XML records in module 'website_sale_collect'---