changeset fa9f7d4695e6 in trytond:default
details: https://hg.tryton.org/trytond?cmd=changeset&node=fa9f7d4695e6
description:
Document field types used for low level APIs
issue11754
review423971003
diffstat:
doc/ref/fields.rst | 29 +++++++++++++++++++++--------
doc/ref/models.rst | 3 ++-
2 files changed, 23 insertions(+), 9 deletions(-)
diffs (94 lines):
diff -r 124b4c6031af -r fa9f7d4695e6 doc/ref/fields.rst
--- a/doc/ref/fields.rst Sun Oct 09 18:33:16 2022 +0200
+++ b/doc/ref/fields.rst Sun Oct 09 18:51:02 2022 +0200
@@ -694,7 +694,10 @@
.. class:: Many2One(model_name, string[, left[, right[, path[, ondelete[,
datetime_field[, target_search[, search_order[, search_context[,
\**options]]]]]]]]])
- A many-to-one relation field.
+ A many-to-one relation field that refers to a record of the named model.
+
+ A :py:class:`integer <int>` as :attr:`~trytond.model.Model.id` is used for
+ low level APIs.
:class:`Many2One` has some extra arguments:
@@ -801,12 +804,16 @@
.. class:: One2Many(model_name, field, string[, add_remove[, order[,
datetime_field[, size[, search_order[, search_context[, \**options]]]]]]])
- A one-to-many relation field.
+ A one-to-many relation field that refers to records of the named model.
It requires to have the opposite :class:`Many2One` field or a
:class:`Reference` field defined on the target model.
-:class:`One2Many` accepts as written value a list of tuples like this:
+ A :py:class:`tuple <tuple>` composed of :py:class:`integer <int>` as
+ :attr:`~trytond.model.Model.id` is used for low level APIs.
+
+:class:`One2Many` accepts as written and created value a :py:class:`list
+<list>` of :py:class:`tuples <tuple>` like this:
- ``('create', [{<field name>: value, ...}, ...])``:
create new target records and link them to this one.
@@ -897,14 +904,17 @@
.. class:: Many2Many(relation_name, origin, target, string[, order[,
datetime_field[, size[, search_order[, search_context[, \**options]]]]]])
- A many-to-many relation field.
+ A many-to-many relation field that refers to records of the targeted model.
It requires to have the opposite origin :class:`Many2One` field or a
:class:`Reference` field defined on the relation model and a
:class:`Many2One` field pointing to the target.
-:class:`Many2Many` accepts as written value a list of tuples like the
-:class:`One2Many`.
+ A :py:class:`tuple <tuple>` composed of :py:class:`integer <int>` as
+ :attr:`~trytond.model.Model.id` is used for low level APIs.
+
+:class:`Many2Many` accepts as written and created value a :py:class:`list
+<list>` of :py:class:`tuples <tuple>` like the :class:`One2Many`.
:class:`Many2Many` has some extra arguments:
@@ -982,12 +992,15 @@
.. class:: One2One(relation_name, origin, target, string[, datetime_field[,
\**options]])
- A one-to-one relation field.
+ A one-to-one relation field that refers to a record of the targeted model.
.. warning::
It is on the relation_name :class:`~trytond.model.Model` that the unicity
of the couple (origin, target) must be checked.
+ A :py:class:`integer <int>` as :attr:`~trytond.model.Model.id` is used for
+ low level APIs.
+
:class:`One2One` has some extra arguments:
.. attribute:: One2One.datetime_field
@@ -1124,7 +1137,7 @@
.. class:: Dict(schema_model[, \**options])
- A dictionary field with predefined keys.
+ A :py:class:`dictionary <dict>` field with predefined keys.
.. note::
It is possible to store the dict as JSON in the database if the backend
diff -r 124b4c6031af -r fa9f7d4695e6 doc/ref/models.rst
--- a/doc/ref/models.rst Sun Oct 09 18:33:16 2022 +0200
+++ b/doc/ref/models.rst Sun Oct 09 18:51:02 2022 +0200
@@ -40,7 +40,8 @@
.. attribute:: Model.id
- The definition of the field ``id`` of records.
+ The definition of the :class:`~trytond.model.fields.Integer` field ``id`` of
+ records.
.. attribute:: Model.__queue__