Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docsource/modules180-190.rst
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,7 @@ Module coverage 18.0 -> 19.0
+---------------------------------------------------+----------------------+-------------------------------------------------+
| l10n_fi_sale | | |
+---------------------------------------------------+----------------------+-------------------------------------------------+
| l10n_fr | | |
| l10n_fr |Done | |
+---------------------------------------------------+----------------------+-------------------------------------------------+
| l10n_fr_account | | |
+---------------------------------------------------+----------------------+-------------------------------------------------+
Expand Down
Original file line number Diff line number Diff line change
@@ -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")
58 changes: 58 additions & 0 deletions openupgrade_scripts/scripts/l10n_fr/19.0.2.1/pre-migration.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# 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_view_xmlid = "l10n_fr.res_partner_form_l10n_fr"


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 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_view_xmlid], delete_childs=True
)


@openupgrade.migrate()
def migrate(env, version):
migrate_siret_to_company_registry(env)
cleanup_obsolete_l10n_fr_siret_view(env)
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
---Models in module 'l10n_fr'---


---Fields in module 'l10n_fr'---
l10n_fr / res.partner / siret (char) : DEL

# 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

# 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 siret handling 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)
Loading