mirror of
https://github.com/odoo/documentation.git
synced 2025-12-12 07:29:27 +07:00
[FIX] orm: adapt indentation of python examples
This commit fixes the current indentation of python blocks, as they're not valid.
closes odoo/documentation#15075
X-original-commit: 0afc64eb25
Signed-off-by: Emanuele Maruzzi (emi) <emi@odoo.com>
This commit is contained in:
@@ -1227,18 +1227,20 @@ When using :attr:`~odoo.models.Model._inherit` but leaving out
|
||||
:attr:`~odoo.models.Model._name`, the new model replaces the existing one,
|
||||
essentially extending it in-place. This is useful to add new fields or methods
|
||||
to existing models (created in other modules), or to customize or reconfigure
|
||||
them (e.g. to change their default sort order)::
|
||||
them (e.g. to change their default sort order)
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
class Extension0(models.Model):
|
||||
_name = 'extension.0'
|
||||
_description = 'Extension zero'
|
||||
_name = 'extension.0'
|
||||
_description = 'Extension zero'
|
||||
|
||||
name = fields.Char(default="A")
|
||||
name = fields.Char(default="A")
|
||||
|
||||
class Extension0(models.Model):
|
||||
_inherit = ['extension.0']
|
||||
_inherit = 'extension.0'
|
||||
|
||||
description = fields.Char(default="Extended")
|
||||
description = fields.Char(default="Extended")
|
||||
|
||||
.. code-block:: python3
|
||||
|
||||
@@ -1270,7 +1272,9 @@ model.
|
||||
|
||||
The main difference is in the meaning. When using Delegation, the model
|
||||
**has one** instead of **is one**, turning the relationship in a composition
|
||||
instead of inheritance::
|
||||
instead of inheritance
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
class Screen(models.Model):
|
||||
_name = 'delegation.screen'
|
||||
@@ -1338,7 +1342,9 @@ In that case, the attributes of the field are taken from the parent class
|
||||
and overridden by the ones given in subclasses.
|
||||
|
||||
For instance, the second class below only adds a tooltip on the field
|
||||
``state``::
|
||||
``state``
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
class FirstFoo(models.Model):
|
||||
state = fields.Selection([...], required=True)
|
||||
|
||||
Reference in New Issue
Block a user