[FIX] analyse: chercher la liste de prix, pas son identifiant externe

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
This commit is contained in:
Mathieu Benoit 2026-08-25 00:58:14 -04:00
parent 67a59d0522
commit c96f679858

View file

@ -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",