Odoo ORM - vec-ltd/odoo-docs GitHub Wiki

Many2many relations

In Python you can use these operators:

(0, _, values)

Adds a new record created from the provided value dict.

(1, id, values)

Updates an existing record of id id with the values in values. Can not be used in create().

(2, id, _)

Removes the record of id id from the set, then deletes it (from the database). Can not be used in create().

(3, id, _)

Removes the record of id id from the set, but does not delete it. Can not be used on One2many. Can not be used in create().

(4, id, _)

Adds an existing record of id id to the set. Can not be used on One2many.

(5, _, _)

Removes all records from the set, equivalent to using the command 3 on every record explicitly. Can not be used on One2many. Can not be used in create().

(6, _, ids)

Replaces all existing records in the set by the ids list, equivalent to using the command 5 followed by a command 4 for each id in ids.


In the JS ORM you apply them like so: