[19.0][FIX] base_tier_validation_correction: restrict resource_ref to tier-validated models#34
Open
bosd wants to merge 2 commits into
Open
Conversation
…validated models The `resource_ref` Reference field on `tier.correction.item` listed every `ir.model` in the database in its selection callback. Two problems: - Performance: every time the field's dropdown was rendered, the callback ran `self.env["ir.model"].search([])` -- a full read of ir.model -- and built ~500 tuples on a stock Odoo install. On large databases with many custom modules the picker noticeably stalls. - Correctness / UX: the dropdown surfaced models that have nothing to do with tier validation (res.partner, res.country, ...), letting an admin reference a record on a model that cannot have tier reviews in the first place. Restrict the selection to the same model set the `tier.correction` form already uses for its `model_id` Many2one -- the result of `tier.definition._get_tier_validation_model_names()`. The picker now only offers models that actually support tier validation, and the underlying query is bounded to that set.
Contributor
|
Hi @kittiu, |
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.
Summary
The
resource_refReference field ontier.correction.itemlisted everyir.modelin its selection callback. Two problems:self.env["ir.model"].search([])and built ~500 tuples per dropdown render. Noticeable stall on installations with many custom modules.Restrict the selection to the same model set the
tier.correctionform already uses for itsmodel_idMany2one —tier.definition._get_tier_validation_model_names(). Picker now only offers models that actually support tier validation; the underlying query is bounded to that set.Test plan
tier.correction.itemform. The Resource reference dropdown now only includes models that have atier.definition(e.g.account.movewhenaccount_move_tier_validationis installed), not every model in the system.