Skip to content

Commit

Permalink
[IMP] orm: name_get into display_name
Browse files Browse the repository at this point in the history
  • Loading branch information
ryv-odoo committed Jun 15, 2023
1 parent d0ca9fb commit f3de6cc
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 18 deletions.
2 changes: 1 addition & 1 deletion content/contributing/development/coding_guidelines.rst
Expand Up @@ -904,7 +904,7 @@ Symbols and Conventions
def _onchange_date_begin(self):
...
# CRUD methods (and name_get, name_search, ...) overrides
# CRUD methods (and name_search, _search, ...) overrides
def create(self, values):
...
Expand Down
16 changes: 7 additions & 9 deletions content/developer/reference/backend/orm.rst
Expand Up @@ -407,6 +407,13 @@ Automatic fields

Raise an Error otherwise.

.. attribute:: Model.display_name

Name :class:`field <odoo.fields.String>` displayed by default in the web client

By default, it equals to :attr:`~odoo.models.BaseModel._rec_name` value field
but the behavior can be customize by overriding :attr:`~odoo.models.BaseModel._compute_display_name`

.. _reference/fields/automatic/log_access:

Access Log fields
Expand Down Expand Up @@ -471,13 +478,6 @@ behavior is desired:
.. automethod:: Model.action_archive
.. automethod:: Model.action_unarchive

.. .. attribute:: sequence
.. Alterable ordering criteria, allows drag-and-drop reordering of models
.. in list views.
.. :class:`~odoo.fields.Integer`
.. attribute:: Model.state

lifecycle stages of the object, used by the ``states`` attribute on
Expand Down Expand Up @@ -995,8 +995,6 @@ Record(set) information

.. automethod:: Model.ensure_one

.. automethod:: Model.name_get

.. automethod:: Model.get_metadata

.. _reference/orm/records/operations:
Expand Down
6 changes: 6 additions & 0 deletions content/developer/reference/backend/orm/changelog.rst
Expand Up @@ -4,6 +4,12 @@
Changelog
=========

Odoo Online version 16.4
========================

- `odoo.models.Model.name_get` has been deprecated with
TODO. Instead read display_name.

Odoo Online version 16.3
========================

Expand Down
10 changes: 5 additions & 5 deletions content/developer/reference/external_api.rst
Expand Up @@ -760,20 +760,20 @@ a record).

models.execute_kw(db, uid, password, 'res.partner', 'write', [[id], {'name': "Newer partner"}])
# get record name after having changed it
models.execute_kw(db, uid, password, 'res.partner', 'name_get', [[id]])
models.execute_kw(db, uid, password, 'res.partner', 'read', [[id], ['display_name']])

.. code-tab:: ruby

models.execute_kw(db, uid, password, 'res.partner', 'write', [[id], {name: "Newer partner"}])
# get record name after having changed it
models.execute_kw(db, uid, password, 'res.partner', 'name_get', [[id]])
models.execute_kw(db, uid, password, 'res.partner', 'read', [[id], ['display_name']])

.. code-tab:: php

$models->execute_kw($db, $uid, $password, 'res.partner', 'write', array(array($id), array('name'=>"Newer partner")));
// get record name after having changed it
$models->execute_kw($db, $uid, $password,
'res.partner', 'name_get', array(array($id)));
'res.partner', 'read', array(array($id), array('display_name')));

.. code-tab:: java

Expand All @@ -788,8 +788,8 @@ a record).
// get record name after having changed it
asList((Object[])models.execute("execute_kw", asList(
db, uid, password,
"res.partner", "name_get",
asList(asList(id))
"res.partner", "read",
asList(asList(id), asList("display_name"))
)));

Result:
Expand Down
6 changes: 3 additions & 3 deletions content/developer/reference/frontend/javascript_reference.rst
Expand Up @@ -1856,7 +1856,7 @@ radio (FieldRadio)
valid choices as radio buttons.
Note that if used on a many2one records, then more rpcs will be done to fetch
the name_gets of the related records.
the display_name of the related records.
- Supported field types: *selection, many2one*
Expand Down Expand Up @@ -1900,8 +1900,8 @@ many2one (FieldMany2One)
- no_create_edit: hide the "Create and Edit..." dropdown menu item (default: false)
- create_name_field: when creating a related record, if this option is set, the value of the *create_name_field* will be filled with the value of the input (default: *name*)
- always_reload: boolean, default to false. If true, the widget will always
do an additional name_get to fetch its name value. This is used for the
situations where the name_get method is overridden (please do not do that)
do an additional read to fetch its display_name value. This is used for the
situations where the _compute_display_name method is overridden
- no_open: boolean, default to false. If set to true, the many2one will not
redirect on the record when clicking on it (in readonly mode)
Expand Down

0 comments on commit f3de6cc

Please sign in to comment.