Skip to content

[19.0][MIG] l10n_fr: cleanup obsolete res.partner.siret + orphan form view#5632

Closed
dnplkndll wants to merge 1 commit into
OCA:19.0from
ledoent:19.0-fix-l10n-fr-cleanup
Closed

[19.0][MIG] l10n_fr: cleanup obsolete res.partner.siret + orphan form view#5632
dnplkndll wants to merge 1 commit into
OCA:19.0from
ledoent:19.0-fix-l10n-fr-cleanup

Conversation

@dnplkndll
Copy link
Copy Markdown

What

Add openupgrade_scripts/scripts/l10n_fr/19.0.2.1/:

  • pre-migration.py with cleanup_obsolete_l10n_fr_siret(env)
  • upgrade_analysis_work.txt annotating the analysis blocks

The pre-migration deletes the stale ir_model_fields row for
res.partner.siret plus the orphan inheritance view
res_partner_form_l10n_fr. Both are marked DEL in the existing
upgrade_analysis.txt but were not actually pruned by Odoo's standard
upgrade flow.

Why

The 18.0 l10n_fr module added res.partner.siret (the French
SIRET tax identifier) plus a partner form inheritance view that exposed
it. In 19.0 both are removed from source. The directory previously
contained only the auto-generated upgrade_analysis.txt, so the
migration relied on Odoo's standard upgrade flow to drop the DEL field
and DEL view. That doesn't actually happen — the rows survive and the
view's arch_db retains <field name=\"siret\"/>, which causes
cross-cutting view validation to raise:

```
Field "siret" does not exist in model "res.partner"
```

when any later module's data XML load triggers the validation.
Reproduced on a fresh 18.0 → 19.0 install (odoo -i all then
-u all): the crash hits at module 217/608 (l10n_ae) while
parsing l10n_ae/data/account_tax_report_data.xml:3, after the
loyalty (#5629), hr (#5630), and partner_autocomplete
(#5631) companion fixes are applied.

How

cleanup_obsolete_l10n_fr_siret(env) lists the two known-obsolete
xml_ids and passes them to openupgrade.delete_records_safely_by_xml_id.
That deletes the ir_model_data backrefs + the underlying
ir_model_fields / ir_ui_view records together, falling back to
noupdate=True if a record can't be removed (per the helper's
existing behaviour).

The companion upgrade_analysis_work.txt annotates the field DEL and
the view DEL blocks with # DONE comments cross-referencing the
helper, and marks the remaining XML-records entries as
# NOTHING TO DO (the standard upgrade handles them: NEW view is
auto-created, noupdate flip is standard, dom-tom group rename is in
apriori).

Test plan

  • Reproduced on a fresh 18.0 CE-all install with the three
    companion fixes applied. Without this patch, migration crashes at
    module 217/608 (l10n_ae) on the siret field reference.
  • With this patch: the migration progresses past the
    l10n_fr-related crash. (Any subsequent failure is a different
    module's analogous gap.)
  • OCA CI green.

Related

This fix continues the pattern surfaced by the comprehensive
CE-install benchmark: modules whose 19.0 upgrade_analysis.txt lists
DEL entries that Odoo's standard upgrade flow doesn't actually prune.

A separate small PR may be needed for l10n_fr_account which also
DEL's a partner-form view (res_partner_form_l10n_fr) on the same
analysis — that script directory similarly contains only the
auto-generated analysis file.

@OCA-git-bot OCA-git-bot added mod:openupgrade_scripts Module openupgrade_scripts series:19.0 labels May 15, 2026
@dnplkndll dnplkndll changed the title [ADD] l10n_fr: cleanup obsolete res.partner.siret + orphan form view [19.0][MIG] l10n_fr: cleanup obsolete res.partner.siret + orphan form view May 15, 2026
dnplkndll added a commit to ledoent/OpenUpgrade that referenced this pull request May 15, 2026
Add the merges introduced by today's PR series so the auto-built image
includes them and the lab can `OPENUPGRADE_PULL_POLICY=always` again:

 - 19.0-fix-hr-null-write-date                 (OCA#5628)
 - 19.0-fix-loyalty-stale-mail-template-fields (OCA#5629)
 - 19.0-fix-hr-obsolete-fields-cleanup         (OCA#5630)
 - 19.0-fix-partner-autocomplete-cleanup       (OCA#5631)
 - 19.0-fix-l10n-fr-cleanup                    (OCA#5632)

The companion lab repos.yaml is updated separately so local
`make sync-repos` matches.
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
<field name="siret"/>) 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.
@dnplkndll dnplkndll force-pushed the 19.0-fix-l10n-fr-cleanup branch from 354a2fc to 4f2aecd Compare May 15, 2026 01:46
Copy link
Copy Markdown
Member

@pedrobaeza pedrobaeza left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dnplkndll
Copy link
Copy Markdown
Author

Closing per maintainer guidance in #5631 (comment).

Understood: OpenUpgrade aims to preserve previous information, the natural -u all after migration sweeps orphan views, and database_cleanup is the right place for residual field/column/table tidy-up (delayed until the new version is in use).

For the specific failure mode that motivated these PRs (cross-cutting view validation triggered by l10n_ae/data/account_tax_report_data.xml:3 during -u all raising Field X does not exist on res.partner / hr.employee etc.), I'll continue investigating outside this PR and may open separate issues with concrete reproductions if I can isolate the trigger to upstream Odoo or to a specific OpenUpgrade gap that needs strict (rather than cleanup-style) handling.

Thanks for the clear philosophical guidance — saved me from writing another 100+ similar PRs.

@dnplkndll dnplkndll closed this May 15, 2026
@pedrobaeza
Copy link
Copy Markdown
Member

You are welcome 😄

dnplkndll added a commit to ledoent/OpenUpgrade that referenced this pull request May 16, 2026
Add the merges introduced by today's PR series so the auto-built image
includes them and the lab can `OPENUPGRADE_PULL_POLICY=always` again:

 - 19.0-fix-hr-null-write-date                 (OCA#5628)
 - 19.0-fix-loyalty-stale-mail-template-fields (OCA#5629)
 - 19.0-fix-hr-obsolete-fields-cleanup         (OCA#5630)
 - 19.0-fix-partner-autocomplete-cleanup       (OCA#5631)
 - 19.0-fix-l10n-fr-cleanup                    (OCA#5632)

The companion lab repos.yaml is updated separately so local
`make sync-repos` matches.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

mod:openupgrade_scripts Module openupgrade_scripts series:19.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants