[IMP] add correction on l10n_fr_secure_sequence_number field to avoid missing sequence number

This commit is contained in:
Stéphan Sainléger
2026-02-09 12:10:33 +01:00
parent 25fff3da5d
commit 30ad1e22f2

View File

@@ -121,8 +121,38 @@ EOF
echo "Fixing company-dependent columns for Odoo 18..."
query_postgres_container "$COMPANY_DEPENDENT_FIX_SQL" ou18 || exit 1
# ============================================================================
# CLEAN: Reset l10n_fr_secure_sequence_number field from table pos_order
# In Odoo 18, several checks are done concerning the pos order, for instance
# that there is no missing number in the order sequence. BUT, if add-on l10n_fr_pos_cert
# has been installer AFTER the creation of some pos orders, then the l10n_fr_secure_sequence_number
# is not filled correctly for all the pos order, and v18 checks fails.
# Solution: reset all the l10n_fr_secure_sequence_number values so that there
# is no missing sequence.
# ============================================================================
RESET_SECURE_SEQUENCE_NUMBER_SQL=$(cat <<'EOF'
DO $$
BEGIN
-- res.partner.barcode (base module)
IF EXISTS (SELECT 1 FROM information_schema.columns
WHERE table_name = 'pos_order' AND column_name = 'l10n_fr_secure_sequence_number') THEN
UPDATE pos_order t
SET l10n_fr_secure_sequence_number = r.num
FROM (
SELECT id,
ROW_NUMBER() OVER (ORDER BY date_order ASC) AS num
FROM pos_order
) r
WHERE t.id = r.id;
END IF;
END $$;
EOF
)
echo "Reset l10n_fr_secure_sequence_number values to avoid missing sequence value for Odoo 18..."
query_postgres_container "$RESET_SECURE_SEQUENCE_NUMBER_SQL" ou18 || exit 1
# Execute SQL pre-migration commands
PRE_MIGRATE_SQL=$(cat <<'EOF'