Skip to content

[17.0][OU-FIX] openupgrade_framework: tolerate field type changes in _process_ondelete#8

Open
eantones wants to merge 1 commit into
17.0from
17.0-fix-process-ondelete-field-type-changes
Open

[17.0][OU-FIX] openupgrade_framework: tolerate field type changes in _process_ondelete#8
eantones wants to merge 1 commit into
17.0from
17.0-fix-process-ondelete-field-type-changes

Conversation

@eantones

@eantones eantones commented Jul 7, 2026

Copy link
Copy Markdown
Member

Problem

The _process_ondelete monkey-patch in openupgrade_framework already tolerates selection values whose model vanished from the registry, but _process_end still crashes the whole upgrade when the field vanished or changed type between versions:

AttributeError: 'Boolean' object has no attribute 'ondelete'

Triggers found on a real 16→17 upgrade, all orphaned ir.model.fields.selection records:

  • stock.picking.type.force_set_number_of_packages — OCA delivery_package_number redefined it selection → boolean in 17.0
  • reference-field selection rows that became orphans in 17: ir.ui.menu.action, sale.report.order_reference, theme.ir.ui.view.inherit_id

Fix

Extend the existing guard: skip records whose field is missing from the registry or is no longer a fields.Selection — the ondelete machinery no longer applies to them; the unlink itself is what cleans them up.

…ss_ondelete

The _process_ondelete patch already tolerates selection values whose
MODEL vanished from the registry, but still crashes when the FIELD
vanished or changed type between versions:

    AttributeError: 'Boolean' object has no attribute 'ondelete'

This happens in _process_end when deleting orphaned
ir.model.fields.selection records of fields that are no longer
Selection fields on the target version — e.g. a module redefining a
selection field as boolean, or reference-field selection rows that
became orphans (ir.ui.menu.action, sale.report.order_reference,
theme.ir.ui.view.inherit_id all surface this on a 16->17 upgrade).

Skip those records: the ondelete machinery no longer applies to them,
the unlink itself is what cleans them up.
@eantones eantones added the upstream-candidate Generic fix, submit to OCA/OpenUpgrade when validated label Jul 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

upstream-candidate Generic fix, submit to OCA/OpenUpgrade when validated

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant