Skip to content

Commit

Permalink
new x2many api
Browse files Browse the repository at this point in the history
  • Loading branch information
yelizariev committed Feb 18, 2021
1 parent 75bbfd9 commit f4b2801
Showing 1 changed file with 26 additions and 1 deletion.
27 changes: 26 additions & 1 deletion docs/dev/py/x2many.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,31 @@ x2many values filling

To fill or manipulate one2many or many2many field with according values (records) you need to use special command as says below.


Odoo 15.0+
----------

First import ``Command``

.. code-block:: python
from odoo.fields import Command
Then assign list of following commands to a x2many field:

* ``Command.create(values)``
* ``Command.update(id, values)``
* ``Command.delete(id)``
* ``Command.unlink(id)``
* ``Command.link(id)``
* ``Command.clear()``
* ``Command.set(ids)``

Based on https://github.com/odoo/odoo/blob/84f89d6ff887e750ea79656328362333cfce27fd/odoo/fields.py#L2868-L2982

Odoo 14.0-
----------

This format is a list of triplets executed sequentially, where each triplet is a command to execute on the set of records. Not all
commands apply in all situations. Possible commands are:

Expand All @@ -16,4 +41,4 @@ commands apply in all situations. Possible commands are:

.. note:: Values marked as **_** in the list above are ignored and can be anything, generally **0** or **False**.

Based on https://github.com/odoo/odoo/blob/master/odoo/models.py
Based on https://github.com/odoo/odoo/blob/14.0/odoo/models.py

0 comments on commit f4b2801

Please sign in to comment.