New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Core: Remove name_get and use display_name instead #122085
Closed
Closed
Conversation
This file contains 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
ryv-odoo
force-pushed
the
master-remove-name_get-core-ryv
branch
3 times, most recently
from
May 30, 2023 12:57
76aa1c4
to
6d6d275
Compare
ryv-odoo
force-pushed
the
master-remove-name_get-core-ryv
branch
7 times, most recently
from
June 7, 2023 08:33
1e007e5
to
81503d2
Compare
ryv-odoo
force-pushed
the
master-remove-name_get-core-ryv
branch
6 times, most recently
from
June 15, 2023 09:28
d8e3abd
to
bd9109e
Compare
ryv-odoo
added a commit
to odoo/documentation
that referenced
this pull request
Jun 15, 2023
ryv-odoo
force-pushed
the
master-remove-name_get-core-ryv
branch
6 times, most recently
from
June 19, 2023 10:14
3cc3ef2
to
24a617b
Compare
hugocarlier
pushed a commit
to odoo-dev/odoo
that referenced
this pull request
Oct 5, 2023
Impacted modules: - hr - hr_skills - resource This commits introduces avatar card preview for resource.resource records in Planning similar to what has been done in mail for res.users records (see odoo#121943) and in hr for hr.employee records (see odoo#131622). The following widgets/components are created to display the popover card when hovering on the avatar of the resource.resource record: - widget many2one_avatar_resource (based on many2one_avatar_user) - widget many2many_avatar_resource (based on many2many_avatar_user) - component PlanningEmployeeAvatarAvatar (based on Avatar) The behavior implemented when hovering on a resource.resource record's avatar is the following: - If the resource is human, a popover card is displayed. A click on the avatar still opens the live chat is a user is associated to the record. - If the resource is material, a popover card is displayed only if it has at least two roles. A click on the resource icon does not trigger anything. The design of the popover card is changed for resource.resource records by displaying: - Roles (for human and material resources) - Skills (for human resources) A compute needs to be added on display_name for hr.employee.skill model as the skills of (human) resources need to be displayed as tags. The dependencies on the compute method are kept on first level dependecies as suggested by odoo#122085 task-3457031
juliusc2066
added a commit
to odoo-dev/odoo
that referenced
this pull request
Oct 25, 2023
This commit removes all usages of the nameGet method of the orm service following changes introduced by odoo#122085 task-3377209
@luisg123v @hugho-ad FYI |
This was referenced Mar 11, 2024
xmglord
added a commit
to vauxoo-dev/addons-vauxoo
that referenced
this pull request
Apr 4, 2024
- Adapt the use of name_get as part of [1]. - Change qty_done to quantity and picked = True as part of [2]. [1] odoo/odoo#122085 [2] odoo/odoo#137864
xmglord
added a commit
to vauxoo-dev/addons-vauxoo
that referenced
this pull request
Apr 4, 2024
- Adapt the use of name_get as part of [1]. - Adapt the tests. [1] odoo/odoo#122085
xmglord
added a commit
to vauxoo-dev/addons-vauxoo
that referenced
this pull request
Apr 4, 2024
- Adapt the use of name_get as part of [1]. - Change qty_done to quantity and picked = True as part of [2]. [1] odoo/odoo#122085 [2] odoo/odoo#137864
xmglord
added a commit
to vauxoo-dev/addons-vauxoo
that referenced
this pull request
Apr 4, 2024
- Adapt the use of name_get as part of [1]. - Adapt the tests. [1] odoo/odoo#122085
xmglord
added a commit
to vauxoo-dev/addons-vauxoo
that referenced
this pull request
Apr 4, 2024
- Adapt the use of name_get as part of [1]. [1] odoo/odoo#122085
xmglord
added a commit
to vauxoo-dev/addons-vauxoo
that referenced
this pull request
Apr 4, 2024
- Adapt the use of name_get as part of [1]. [1] odoo/odoo#122085
xmglord
added a commit
to vauxoo-dev/addons-vauxoo
that referenced
this pull request
Apr 4, 2024
- Adapt the use of name_get as part of [1]. - Change qty_done to quantity and picked = True as part of [2]. [1] odoo/odoo#122085 [2] odoo/odoo#137864
xmglord
added a commit
to vauxoo-dev/addons-vauxoo
that referenced
this pull request
Apr 4, 2024
- Adapt the use of name_get as part of [1]. [1] odoo/odoo#122085
luisg123v
pushed a commit
to Vauxoo/addons-vauxoo
that referenced
this pull request
Apr 4, 2024
- Adapt the use of name_get as part of [1]. - Change qty_done to quantity and picked = True as part of [2]. [1] odoo/odoo#122085 [2] odoo/odoo#137864
xmglord
added a commit
to vauxoo-dev/addons-vauxoo
that referenced
this pull request
Apr 8, 2024
- Adapt the use of name_get as part of [1]. [1] odoo/odoo#122085
xmglord
added a commit
to vauxoo-dev/addons-vauxoo
that referenced
this pull request
Apr 22, 2024
- Adapt the use of name_get as part of [1]. [1] odoo/odoo#122085
luisg123v
pushed a commit
to Vauxoo/addons-vauxoo
that referenced
this pull request
Apr 24, 2024
- Adapt the use of name_get as part of [1]. [1] odoo/odoo#122085
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.
[REM] core: remove
name_get
APIRationale
Since v8, the
display_name
field is present on all models. By default,display_name
usesname_get
which has pretty much the same purpose (return record name used by the web client). Gradually, many (backend) developers (and the ORM: 6da1c3a) started usingdisplay_name
(more convenient thanrecord.name_get()[0][1]
) but it still had thename_get
override. It becomes more complex than necessary and poeple start to misunderstand the two (and sometimes override both, leading to inconstiencies betweendisplay_name
/name_get
).To simplify the ORM and the API, we decided to keep only one of them, the
display_name
field:record.name_get()[0][1]
vsrecord.display_name
)_compute_display_name
with any extra dependencies)name_get
is replaced byread(['display_name'])
(API perceptive), which can actually be more efficient (ifdisplay_name
's depends are correct, the ORM will only fetch the fields it needs instead of every prefetchable field)Changes
name_get
for the v17 and based the method ondisplay_name
(the opposite of before)name_get
name_get
are now overrides of_compute_display_name
res.partner
, rename the field storedisplay_name
intocomplete_name
becausedisplay_name
context-dependent and it makes no sense to have a compute store that is context-dependent.name_get
, but it was tricky and most of the usage of thisname_get
didn't take this into account. The only example of this is thename_get
ofproduct.product
(now use", ".join(<names>)
).[IMP] core: fetch
display_name
duringname_search
The
name_search
makes at least 2 SQL requests, one to find the records and one to read fields needed to compute thedisplay_name
. With the default_compute_display_name
, it only needs to fetch the_rec_name
field (if there is one), but the ORM perfetch field mechanism will also fetch every prefetchable field (see_fetch_field
).Then, to avoid running two queries and fetching too many fields, we add the dependency fields (with
_determine_fields_to_fetch
) to the select clause of theQuery
returned by_name_search
.[IMP] *: add dependencies to
display_name
fieldThe previous commit introduced an optimization to reduce the number of queries and fields fetched when we call
name_search
. But it works much better when the dependencies ofdisplay_name
contain field names used in the calculation (on the same record/model).Then, to improve the performance and the cache coherency, add
depends
anddepends_context
depending on the custom_compute_display_name
. Add only the first level of dependencies (never traverse relational field) because only these have a positive impact on the previous optimization and the cost is very low (seemodified
).https://github.com/odoo/enterprise/pull/42599
https://github.com/odoo/upgrade/pull/4780
odoo/documentation#4639