[FIX] base: missing xmlid for mixin fields - #52275
Closed
Julien00859 wants to merge 1 commit into
Closed
Conversation
Member
Author
|
My little finger's telling me this may be incomplete... While this indeed fixes #49354, I'm not 100% sure I am not introducing new XMLIDs where we should not. Also, how could we test it ? |
rco-odoo
reviewed
Jun 17, 2020
rco-odoo
left a comment
Member
There was a problem hiding this comment.
This does not cover all cases, for instance when the mixin is not an abstract model, but the latter case is silly design. But if it covers our case, that's a step towards the good solution.
Maybe we could merge this into saas-13.4? @beledouxdenis
We want to create a XMLID for every first exhibition of a field in a model. That is, we just want one XMLID by field by model and not one XMLID by field by class. Previous implementation was determining the "first field exhibition" by making sure the field was created and used as part of the same module. This assumption is invalid when we consider mixins. A mixin is an abstract model that define fields and methods to be included in other models. As it is abstract, it does not exhibits the field by itself. The field will only be exhibited when included in a concrete model via inheritance. When it is included in another module, the XMLID creation is discarded. Take a module M1 that defines a model A, take another module M2 that defines a mixin X with a field X1. In a third module M3, extend A to inherit from X. While M3.A is the first model module to exhibit the field X1, the XMLID creation was discarded because `"M2" != "M3"`. See odoo#49354 (comment) Task: 2235368 Closes odoo#49354
Julien00859
force-pushed
the
master-2235368-field_without_xmlid-juc
branch
from
June 17, 2020 12:21
bca326d to
4307e00
Compare
Member
Author
|
Rebased in saas-13.4 |
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.
We want to create a XMLID for every first exhibition of a field in a
model. That is, we just want one XMLID by field by model and not one
XMLID by field by class. Previous implementation was determining the
"first field exhibition" by making sure the field was created and used
as part of the same module.
This assumption is invalid when we consider mixins. A mixin is an
abstract model that define fields and methods to be included in other
models. As it is abstract, it does not exhibits the field by itself. The
field will only be exhibited when included in a concrete model via
inheritance. When it is included in another module, the XMLID creation
is discarded.
Take a module M1 that defines a model A, take another module M2 that
defines a mixin X with a field X1. In a third module M3, extend A to
inherit from X. While M3.A is the first model module to exhibit the
field X1, the XMLID creation was discarded because
"M2" != "M3".See #49354 (comment)
Task: 2235368
Closes #49354