[IMP] orm: name_get into display_name
odoo/odoo#122085 odoo/enterprise#42599 odoo/upgrade#4780 closes odoo/documentation#4639 Signed-off-by: Rémy Voet (ryv) <ryv@odoo.com>
This commit is contained in:
parent
9e54525d61
commit
13544bca17
@ -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):
|
||||
...
|
||||
|
||||
|
@ -407,6 +407,13 @@ Automatic fields
|
||||
|
||||
Raise an Error otherwise.
|
||||
|
||||
.. attribute:: Model.display_name
|
||||
|
||||
Name :class:`field <odoo.fields.Char>` 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 customized by overriding :attr:`~odoo.models.BaseModel._compute_display_name`
|
||||
|
||||
.. _reference/fields/automatic/log_access:
|
||||
|
||||
Access Log fields
|
||||
@ -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
|
||||
@ -995,8 +995,6 @@ Record(set) information
|
||||
|
||||
.. automethod:: Model.ensure_one
|
||||
|
||||
.. automethod:: Model.name_get
|
||||
|
||||
.. automethod:: Model.get_metadata
|
||||
|
||||
.. _reference/orm/records/operations:
|
||||
|
@ -4,6 +4,13 @@
|
||||
Changelog
|
||||
=========
|
||||
|
||||
Odoo Online version 16.4
|
||||
========================
|
||||
|
||||
- `odoo.models.Model.name_get` has been deprecated with
|
||||
`#122085 <https://github.com/odoo/odoo/pull/122085>`_.
|
||||
Read `display_name` instead.
|
||||
|
||||
Odoo Online version 16.3
|
||||
========================
|
||||
|
||||
|
@ -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
|
||||
|
||||
@ -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:
|
||||
|
@ -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*
|
||||
|
||||
@ -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)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user