Skip to content

Commit 547e499

Browse files
authored
fixes after code review
1 parent f2cf46c commit 547e499

File tree

1 file changed

+10
-8
lines changed
  • content/developer/reference/backend

1 file changed

+10
-8
lines changed

content/developer/reference/backend/orm.rst

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1227,7 +1227,7 @@ When using :attr:`~odoo.models.Model._inherit` but leaving out
12271227
:attr:`~odoo.models.Model._name`, the new model replaces the existing one,
12281228
essentially extending it in-place. This is useful to add new fields or methods
12291229
to existing models (created in other modules), or to customize or reconfigure
1230-
them (e.g. to change their default sort order)::
1230+
them (e.g. to change their default sort order)
12311231

12321232
.. code-block:: python
12331233
@@ -1251,11 +1251,12 @@ will yield::
12511251

12521252
{'name': "A", 'description': "Extended"}
12531253

1254-
.. warning:: if you use :attr:`~odoo.models.Model._inherit` with a list
1255-
but leaving out :attr:`~odoo.models.Model._name`, the class
1256-
name will be used to infer the model you're extending.
1257-
This is not the case when :attr:`~odoo.models.Model._inherit`
1258-
is a ``string``
1254+
.. warning:: When :attr:`~odoo.models.Model._inherit` is set using a string,
1255+
this will also set the value of :attr:`~odoo.models.Model._name`.
1256+
In all the other cases the :attr:`~odoo.models.Model._name` is set by
1257+
the attribute itself or by the class name (i.e: ``class MyModel(models.Model)`` will be
1258+
translated into ``_name = 'my.model'``, even if not explicitly set)
1259+
12591260

12601261

12611262
.. note::
@@ -1275,7 +1276,7 @@ model.
12751276

12761277
The main difference is in the meaning. When using Delegation, the model
12771278
**has one** instead of **is one**, turning the relationship in a composition
1278-
instead of inheritance::
1279+
instead of inheritance
12791280

12801281
.. code-block:: python
12811282
@@ -1345,9 +1346,10 @@ In that case, the attributes of the field are taken from the parent class
13451346
and overridden by the ones given in subclasses.
13461347

13471348
For instance, the second class below only adds a tooltip on the field
1348-
``state``::
1349+
``state``
13491350

13501351
.. code-block:: python
1352+
13511353
class FirstFoo(models.Model):
13521354
state = fields.Selection([...], required=True)
13531355

0 commit comments

Comments
 (0)