From 7af6e25aa3affeff2ce8b9dfa014feea77d30a71 Mon Sep 17 00:00:00 2001 From: Don Kendall Date: Thu, 14 May 2026 20:55:02 -0400 Subject: [PATCH 1/3] [ADD] l10n_fr: drop obsolete res.partner.siret + orphan view --- .../l10n_fr/19.0.2.1/post-migration.py | 6 +++ .../scripts/l10n_fr/19.0.2.1/pre-migration.py | 42 +++++++++++++++++++ .../19.0.2.1/upgrade_analysis_work.txt | 30 +++++++++++++ 3 files changed, 78 insertions(+) create mode 100644 openupgrade_scripts/scripts/l10n_fr/19.0.2.1/post-migration.py 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/post-migration.py b/openupgrade_scripts/scripts/l10n_fr/19.0.2.1/post-migration.py new file mode 100644 index 000000000000..3d9038b96b95 --- /dev/null +++ b/openupgrade_scripts/scripts/l10n_fr/19.0.2.1/post-migration.py @@ -0,0 +1,6 @@ +from openupgradelib import openupgrade + + +@openupgrade.migrate() +def migrate(env, version): + openupgrade.load_data(env, "l10n_fr", "19.0.2.1/noupdate_changes.xml") 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..3b815386d39f --- /dev/null +++ b/openupgrade_scripts/scripts/l10n_fr/19.0.2.1/upgrade_analysis_work.txt @@ -0,0 +1,30 @@ +---Models in module 'l10n_fr'--- + + +---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) From 8849175c8d21d63b782d73857deaf2582e7671b9 Mon Sep 17 00:00:00 2001 From: Don Kendall Date: Wed, 10 Jun 2026 19:46:29 -0400 Subject: [PATCH 2/3] =?UTF-8?q?[FIX]=20docsource:=20mark=20l10n=5Ffr=20Don?= =?UTF-8?q?e=20=E2=80=94=20scripts=20ship=20in=20this=20PR?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docsource/modules180-190.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docsource/modules180-190.rst b/docsource/modules180-190.rst index fd4b86e2175e..b704767f5c93 100644 --- a/docsource/modules180-190.rst +++ b/docsource/modules180-190.rst @@ -390,7 +390,7 @@ Module coverage 18.0 -> 19.0 +---------------------------------------------------+----------------------+-------------------------------------------------+ | l10n_fi_sale | | | +---------------------------------------------------+----------------------+-------------------------------------------------+ -| l10n_fr | | | +| l10n_fr |Done | | +---------------------------------------------------+----------------------+-------------------------------------------------+ | l10n_fr_account | | | +---------------------------------------------------+----------------------+-------------------------------------------------+ From 29358125083b603f790ab6f966557f0e1d9a33c6 Mon Sep 17 00:00:00 2001 From: Don Kendall Date: Wed, 10 Jun 2026 20:18:38 -0400 Subject: [PATCH 3/3] [FIX] l10n_fr: migrate siret values to company_registry The 19.0 replacement for the dropped res.partner.siret is core company_registry (l10n_fr_pdp validates SIREN/SIRET on it); without the copy real identifiers strand in an orphan column. Also drop the ineffective field-xmlid delete (the helper can't unlink non-manual fields; the module update prunes the row itself). --- .../scripts/l10n_fr/19.0.2.1/pre-migration.py | 34 ++++++++++++++----- .../19.0.2.1/upgrade_analysis_work.txt | 17 +++++----- 2 files changed, 34 insertions(+), 17 deletions(-) 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 index 42b6a46863b4..65a2b94ca942 100644 --- 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 @@ -13,25 +13,40 @@ # 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): +def migrate_siret_to_company_registry(env): + """19.0 drops res.partner.siret; its replacement is core + company_registry (l10n_fr_pdp validates the SIREN/SIRET regex on it). + Carry the values over instead of stranding them in an orphan column.""" + if openupgrade.column_exists(env.cr, "res_partner", "siret"): + openupgrade.logged_query( + env.cr, + """ + UPDATE res_partner + SET company_registry = siret + WHERE COALESCE(siret, '') != '' + AND COALESCE(company_registry, '') = '' + """, + ) + + +def cleanup_obsolete_l10n_fr_siret_view(env): """ - Drop the stale res.partner.siret field metadata and the orphan - partner-form inheritance view. See upgrade_analysis_work.txt. + Drop 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). + + The stale ir_model_fields row needs no explicit delete: the helper + can't unlink non-manual fields anyway (UserError caught), and the + module's own update prunes it. """ - 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 ) @@ -39,4 +54,5 @@ def cleanup_obsolete_l10n_fr_siret(env): @openupgrade.migrate() def migrate(env, version): - cleanup_obsolete_l10n_fr_siret(env) + migrate_siret_to_company_registry(env) + cleanup_obsolete_l10n_fr_siret_view(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 index 3b815386d39f..a7d40a28a077 100644 --- 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 @@ -4,13 +4,14 @@ ---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"'). +# DONE: siret values migrated to core company_registry in pre-migration +# (the 19.0 replacement; l10n_fr_pdp reads SIRET from it), and the orphan +# inheritance view (res_partner_form_l10n_fr, referenced under XML records +# below) deleted. Without the view delete it survives the standard upgrade +# and trips cross-cutting view validation when later modules' data XML +# loads (reproduced on l10n_ae/data/account_tax_report_data.xml:3 with +# 'Field "siret" does not exist in model "res.partner"'). The stale +# ir_model_fields row is pruned by the module's own update. ---XML records in module 'l10n_fr'--- NEW ir.ui.view: l10n_fr.view_partner_form_inherit_l10n_fr @@ -19,7 +20,7 @@ NEW ir.ui.view: l10n_fr.view_partner_form_inherit_l10n_fr DEL ir.ui.view: l10n_fr.res_partner_form_l10n_fr -# DONE: explicitly deleted in pre-migration (see field cleanup above). +# DONE: explicitly deleted in pre-migration (see siret handling above). res.country.group: l10n_fr.fr_and_mc (noupdate) (noupdate switched)