Reviewers: ,
Please review this at http://codereview.tryton.org/669002/
Affected files:
A doc/topics/models/fields_on_change.rst
Index: doc/topics/models/fields_on_change.rst
===================================================================
new file mode 100644
--- /dev/null
+++ b/doc/topics/models/fields_on_change.rst
@@ -0,0 +1,37 @@
+.. _topcis-fields_on_change_value:
+
+=========================
+on_change value of fields
+=========================
+
+When you set a field's value thanks with an ``on_change`` or
``on_change_with``
+call. The return value of the corresponding method on the model differs
+according to the type of the field.
+
+Simple fields require the value to be of their own type: ``fields.Char``
will
+require an unicode string, ``fields.Date`` will accept ``datetime.Date``
+values, and so on …
+
+Relation fields require some more explanations:
+
+ - a ``field.Many2One`` or a ``field.One2One`` field will accept only an
+ integer denoting the ``id`` of the record to set
+
+ - a ``field.One2Many`` or a ``field.Many2Many`` will accept either:
+
+ - a list of ``id`` denoting the new value of the field
+
+ - a dictionnary composed of three keys: ``update``, ``add`` and
+ ``remove``.
+
+ The ``update`` and ``add`` keys will have as value a list of
+ dictionnary that denotes the new value of the fields. ``add``
will
+ create new lines while ``update`` modify existing lines that
matches
+ the ``id`` key found in the dictionnary.
+
+ The ``remove`` key will have as value a list of ids that will be
+ remove from the field.
+
+ Records that are not yet saved receive temporary ids (negative
+ integers) that you can use in your ``add`` or ``remove`` value to
+ interact with.
--
--
tryton-dev@googlegroups.com mailing list
---
You received this message because you are subscribed to the Google Groups "tryton-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to tryton-dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.