[FIX] developer/orm: related fields default values

* readonly is True for related fields.

Since Odoo 12: 52a8ed3c0c

This commit also highlights all the default values of related fields, fixing
the misleading message about related computed in sudo mode (since it can
be disabled with compute_sudo or related_sudo = False)

---

task-2451749
This commit is contained in:
Ivan Yelizariev 2021-05-21 15:55:28 +02:00 committed by vfe-odoo
parent 86cefde583
commit 4d0f63e3eb

View File

@ -334,19 +334,23 @@ relational fields and reading a field on the reached model. The complete
sequence of fields to traverse is specified by the ``related`` attribute.
Some field attributes are automatically copied from the source field if
they are not redefined: ``string``, ``help``, ``readonly``, ``required`` (only
they are not redefined: ``string``, ``help``, ``required`` (only
if all fields in the sequence are required), ``groups``, ``digits``, ``size``,
``translate``, ``sanitize``, ``selection``, ``comodel_name``, ``domain``,
``context``. All semantic-free attributes are copied from the source
field.
By default, the values of related fields are not stored to the database.
By default, related fields are:
* not stored
* not copied
* readonly
* computed in superuser mode
Add the attribute ``store=True`` to make it stored, just like computed
fields. Related fields are automatically recomputed when their
dependencies are modified.
.. note:: The related fields are computed in sudo mode.
.. warning::
You cannot chain :class:`~odoo.fields.Many2many` or :class:`~odoo.fields.One2many` fields in ``related`` fields dependencies.