From 4f2aecd05a796b70d7e0b18effaf992636f006ce Mon Sep 17 00:00:00 2001 From: Don Kendall Date: Thu, 14 May 2026 20:55:02 -0400 Subject: [PATCH] [ADD] l10n_fr: cleanup obsolete res.partner.siret + orphan form view MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The 18.0 l10n_fr module added res.partner.siret (a French SIRET tax identifier) plus a partner form inheritance view (res_partner_form_l10n_fr) that exposed it. Both are DEL per upgrade_analysis.txt: res.partner.siret (char) : DEL ir.ui.view: res_partner_form_l10n_fr : DEL The script directory previously contained only the auto-generated upgrade_analysis.txt. The migration relied on Odoo's standard upgrade flow to clean up the DEL field and DEL view. That doesn't actually prune them — the stale ir_model_fields row and orphan view (with arch_db retaining ) survive, and trip cross-cutting view validation when later modules' data XML loads (reproduced on a fresh 18 → 19 install with the loyalty / hr / partner_autocomplete companion fixes applied — l10n_ae/data/account_tax_report_data.xml:3 then raises 'Field "siret" does not exist in model "res.partner"'). Add pre-migration cleanup_obsolete_l10n_fr_siret using openupgrade.delete_records_safely_by_xml_id over both the field xml_id and the view xml_id, plus a companion upgrade_analysis_work.txt annotating the analysis blocks. --- .../scripts/l10n_fr/19.0.2.1/pre-migration.py | 42 +++++++++++++++++++ .../19.0.2.1/upgrade_analysis_work.txt | 31 ++++++++++++++ 2 files changed, 73 insertions(+) create mode 100644 openupgrade_scripts/scripts/l10n_fr/19.0.2.1/pre-migration.py create mode 100644 openupgrade_scripts/scripts/l10n_fr/19.0.2.1/upgrade_analysis_work.txt diff --git a/openupgrade_scripts/scripts/l10n_fr/19.0.2.1/pre-migration.py b/openupgrade_scripts/scripts/l10n_fr/19.0.2.1/pre-migration.py new file mode 100644 index 000000000000..42b6a46863b4 --- /dev/null +++ b/openupgrade_scripts/scripts/l10n_fr/19.0.2.1/pre-migration.py @@ -0,0 +1,42 @@ +# Copyright 2026 ledoent +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +from openupgradelib import openupgrade + +# The 18.0 l10n_fr module added res.partner.siret (a French SIRET tax +# identifier) plus a partner form inheritance view that exposed it. Both +# are DEL'd per upgrade_analysis.txt: +# res.partner.siret (char) : DEL +# ir.ui.view: res_partner_form_l10n_fr : DEL +# Odoo's standard module upgrade does not actually prune the stale +# ir_model_fields row + the orphan view; both survive and trip +# cross-cutting view validation when later modules' data XML loads +# (reproduced on l10n_ae/data/account_tax_report_data.xml:3 with the +# error 'Field "siret" does not exist in model "res.partner"'). +_obsolete_field_xmlids = [ + "l10n_fr.field_res_partner__siret", +] + +_obsolete_view_xmlid = "l10n_fr.res_partner_form_l10n_fr" + + +def cleanup_obsolete_l10n_fr_siret(env): + """ + Drop the stale res.partner.siret field metadata and the orphan + partner-form inheritance view. See upgrade_analysis_work.txt. + + The view has a child view in l10n_fr_account (also named + res_partner_form_l10n_fr) that inherits from this one — so pass + delete_childs=True so the helper cascades and doesn't fall back to + setting noupdate=True (which would leave the orphan in place and + still trip view validation downstream). + """ + openupgrade.delete_records_safely_by_xml_id(env, _obsolete_field_xmlids) + openupgrade.delete_records_safely_by_xml_id( + env, [_obsolete_view_xmlid], delete_childs=True + ) + + +@openupgrade.migrate() +def migrate(env, version): + cleanup_obsolete_l10n_fr_siret(env) diff --git a/openupgrade_scripts/scripts/l10n_fr/19.0.2.1/upgrade_analysis_work.txt b/openupgrade_scripts/scripts/l10n_fr/19.0.2.1/upgrade_analysis_work.txt new file mode 100644 index 000000000000..b3f2aebfe61e --- /dev/null +++ b/openupgrade_scripts/scripts/l10n_fr/19.0.2.1/upgrade_analysis_work.txt @@ -0,0 +1,31 @@ +---Models in module 'l10n_fr'--- + +# NOTHING TO DO + +---Fields in module 'l10n_fr'--- +l10n_fr / res.partner / siret (char) : DEL + +# DONE: stale ir_model_fields row and the orphan inheritance view +# (res_partner_form_l10n_fr, referenced under XML records below) are +# deleted in pre-migration via cleanup_obsolete_l10n_fr_siret. Without +# this, the rows survive the standard upgrade and trip cross-cutting +# view validation when later modules' data XML loads (reproduced on +# l10n_ae/data/account_tax_report_data.xml:3 with the error +# 'Field "siret" does not exist in model "res.partner"'). + +---XML records in module 'l10n_fr'--- +NEW ir.ui.view: l10n_fr.view_partner_form_inherit_l10n_fr + +# NOTHING TO DO: created by the 19.0 module on install/upgrade + +DEL ir.ui.view: l10n_fr.res_partner_form_l10n_fr + +# DONE: explicitly deleted in pre-migration (see field cleanup above). + +res.country.group: l10n_fr.fr_and_mc (noupdate) (noupdate switched) + +# NOTHING TO DO: noupdate flag flip is handled by the standard upgrade + +DEL res.country.group: l10n_fr.dom-tom [renamed to base module] + +# NOTHING TO DO: rename handled in apriori (or follow-up if not)