Document on_change methods under ModelView instead of Model

This commit is contained in:
Cédric Krier
2023-07-04 18:39:28 +02:00
parent 1353212f31
commit a40be04d82
2 changed files with 22 additions and 20 deletions
+20 -18
View File
@@ -106,24 +106,6 @@ Class methods:
Instance methods:
.. method:: Model.on_change(fieldnames)
Return the list of changes by calling ``on_change`` method of each field.
.. method:: Model.on_change_with(fieldnames)
Return the new values of all fields by calling ``on_change_with`` method of
each field.
.. method:: Model.on_change_notify(fieldnames)
Returns a list of type and message couple to display on the client side.
Available types are ``info``, ``warning`` and ``error``.
.. note::
To be called by the client, this method must be decorated
by :meth:`~trytond.model.fields.depends` with the fields needed.
.. method:: Model.pre_validate()
Validate the instance before being stored.
@@ -228,6 +210,26 @@ Class methods:
This method is public mainly to allow modification the existing XML of
the view by code.
Instance methods:
.. method:: ModelView.on_change(fieldnames)
Return the list of changes by calling ``on_change`` method of each field.
.. method:: ModelView.on_change_with(fieldnames)
Return the new values of all fields by calling ``on_change_with`` method of
each field.
.. method:: ModelView.on_change_notify(fieldnames)
Returns a list of type and message couple to display on the client side.
Available types are ``info``, ``warning`` and ``error``.
.. note::
To be called by the client, this method must be decorated
by :meth:`~trytond.model.fields.depends` with the fields needed.
ModelStorage
============
+2 -2
View File
@@ -123,8 +123,8 @@ StateView
.. note::
The difference between default values and values is that the client calls
:meth:`~trytond.model.Model.on_change` and
:meth:`~trytond.model.Model.on_change_with` for the default values.
:meth:`~trytond.model.ModelView.on_change` and
:meth:`~trytond.model.ModelView.on_change_with` for the default values.
Instance attributes are: