[17.0][OU-FIX] openupgrade_framework: tolerate field type changes in _process_ondelete#8
Open
eantones wants to merge 1 commit into
Open
[17.0][OU-FIX] openupgrade_framework: tolerate field type changes in _process_ondelete#8eantones wants to merge 1 commit into
eantones wants to merge 1 commit into
Conversation
…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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The
_process_ondeletemonkey-patch inopenupgrade_frameworkalready tolerates selection values whose model vanished from the registry, but_process_endstill crashes the whole upgrade when the field vanished or changed type between versions:Triggers found on a real 16→17 upgrade, all orphaned
ir.model.fields.selectionrecords:stock.picking.type.force_set_number_of_packages— OCAdelivery_package_numberredefined it selection → boolean in 17.0ir.ui.menu.action,sale.report.order_reference,theme.ir.ui.view.inherit_idFix
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.