From c96f679858bf0784f2c16ec592647fc2dc8414db Mon Sep 17 00:00:00 2001 From: Mathieu Benoit Date: Tue, 25 Aug 2026 00:58:14 -0400 Subject: [PATCH] [FIX] analyse: chercher la liste de prix, pas son identifiant externe MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Deuxième constat faux du même outil, et la même cause : un indicateur jamais confronté à la vraie condition. Le contrôle cherchait l'xmlid `product.list0`. Or la réparation laisse Odoo créer « Par défaut » SANS le poser. Mesuré sur la migration qui vient de tourner : une liste de prix bien présente, quatre modèles de rapprochement recréés, et mon rapport annonçait toujours « absente ». Il aurait signalé de même la base d'un client ayant créé la sienne à la main. On cherche donc une LIGNE dans product_pricelist, protégée par to_regclass pour le cas où le module n'est pas installé. --- EN --- Second false finding from the same tool, and the same cause: a proxy never checked against the real condition. It looked for the xmlid `product.list0`. But the repair lets Odoo create « Par défaut » WITHOUT setting it. Measured on the migration that just ran: a pricelist plainly there, four reconciliation models recreated — and my report still said "missing". It would have flagged a customer database whose pricelist was made by hand just the same. So we look for a ROW in product_pricelist, guarded by to_regclass in case the module is not installed. Assisted-by: Claude Opus 5 --- script/analyse/check_migration_residue.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/script/analyse/check_migration_residue.py b/script/analyse/check_migration_residue.py index b171851..f2ef0e3 100755 --- a/script/analyse/check_migration_residue.py +++ b/script/analyse/check_migration_residue.py @@ -134,10 +134,15 @@ CONTROLES = ( "title": "Default pricelist missing while product is installed", "why": "product.list0 was declared up to Odoo 16 only; nothing" " recreates it, and a quotation has no price list to pick.", + # On cherche une LISTE, pas son xmlid. Mesuré : la réparation + # laisse Odoo créer « Par défaut » sans poser `product.list0` — + # chercher l'xmlid signalait donc une base parfaitement saine, et + # aurait signalé de même celle d'un client qui a créé la sienne à + # la main. "sql": "SELECT CASE WHEN EXISTS (SELECT 1 FROM ir_module_module" " WHERE name='product' AND state='installed')" - " AND NOT EXISTS (SELECT 1 FROM ir_model_data" - " WHERE module='product' AND name='list0')" + " AND to_regclass('public.product_pricelist') IS NOT NULL" + " AND NOT EXISTS (SELECT 1 FROM product_pricelist)" " THEN 1 ELSE 0 END", "gravity": "broken", "repair": "script/odoo/migration/restore_config_defaults.py --apply",