From efaa100b934a7aee1a2309f2a03fc4ecd9b4af9f Mon Sep 17 00:00:00 2001 From: Don Kendall Date: Sat, 20 Jun 2026 10:20:20 -0400 Subject: [PATCH] [OU-FIX] website_sale_collect: fix invalid SQL in pickup-address backfill MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit _mark_pickup_auxiliary_addresses built an UPDATE whose WHERE used comma-separated conditions instead of AND (plus `parent_id != False` and a trailing comma) — invalid SQL that raises syntax error the moment a pickup carrier (delivery_type='in_store') exists. CI is green only because the demo seed has no in_store carrier, so the loop never runs. Use AND, IS NOT DISTINCT FROM for the nullable state_id/country_id (matches pickup locations without a state/country), parent_id IS NOT NULL, and pass .id (not the recordset) for the relational params. Bug from OCA/OpenUpgrade#5740 (pedrobaeza). --- .../19.0.1.0/post-migration.py | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) 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 index 97a0e226b7a..8b0e8cc6f95 100644 --- 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 @@ -29,15 +29,14 @@ def _mark_pickup_auxiliary_addresses(env): """ UPDATE res_partner SET is_pickup_location = True - WHERE - street = %s, - city = %s, - state_id = %s, - country_id = %s, - parent_id != False, - type = 'delivery', + WHERE street = %s + AND city = %s + AND state_id IS NOT DISTINCT FROM %s + AND country_id IS NOT DISTINCT FROM %s + AND parent_id IS NOT NULL + AND type = 'delivery' """, - (p.street, p.city, p.state_id, p.country_id), + (p.street, p.city, p.state_id.id or None, p.country_id.id or None), )