Skip to content

Commit 6a5aacf

Browse files
committed
[FIX] orm: adapt indentation of python examples
This commit fixes the current indentation of python blocks, as they're not valid.
1 parent 788ed4e commit 6a5aacf

File tree

1 file changed

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

1 file changed

+14
-8
lines changed

content/developer/reference/backend/orm.rst

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1227,18 +1227,20 @@ 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)
1231+
1232+
.. code-block:: python
12311233
12321234
class Extension0(models.Model):
1233-
_name = 'extension.0'
1234-
_description = 'Extension zero'
1235+
_name = 'extension.0'
1236+
_description = 'Extension zero'
12351237
1236-
name = fields.Char(default="A")
1238+
name = fields.Char(default="A")
12371239
12381240
class Extension0(models.Model):
1239-
_inherit = ['extension.0']
1241+
_inherit = 'extension.0'
12401242
1241-
description = fields.Char(default="Extended")
1243+
description = fields.Char(default="Extended")
12421244
12431245
.. code-block:: python3
12441246
@@ -1270,7 +1272,9 @@ model.
12701272

12711273
The main difference is in the meaning. When using Delegation, the model
12721274
**has one** instead of **is one**, turning the relationship in a composition
1273-
instead of inheritance::
1275+
instead of inheritance
1276+
1277+
.. code-block:: python
12741278
12751279
class Screen(models.Model):
12761280
_name = 'delegation.screen'
@@ -1338,7 +1342,9 @@ In that case, the attributes of the field are taken from the parent class
13381342
and overridden by the ones given in subclasses.
13391343

13401344
For instance, the second class below only adds a tooltip on the field
1341-
``state``::
1345+
``state``
1346+
1347+
.. code-block:: python
13421348
13431349
class FirstFoo(models.Model):
13441350
state = fields.Selection([...], required=True)

0 commit comments

Comments
 (0)