[IMP] orm: add 'any' and 'not any' operators
- Add descriptions of the 'any' and 'not any' operators
- Simplify the example for searching partners
- Add an example using the 'any' operator for the sale.order model
closes odoo/documentation#8348
Closes: #7620
X-original-commit: 7353d7b2cc
Signed-off-by: Rémy Voet (ryv) <ryv@odoo.com>
This commit is contained in:
parent
b3c7592fbb
commit
e1809b3e2c
@ -939,6 +939,16 @@ A domain is a list of criteria, each criterion being a triple (either a
|
|||||||
Takes the semantics of the model into account (i.e following the
|
Takes the semantics of the model into account (i.e following the
|
||||||
relationship field named by
|
relationship field named by
|
||||||
:attr:`~odoo.models.Model._parent_name`).
|
:attr:`~odoo.models.Model._parent_name`).
|
||||||
|
``any``
|
||||||
|
matches if any record in the relationship traversal through
|
||||||
|
``field_name`` (:class:`~odoo.fields.Many2one`,
|
||||||
|
:class:`~odoo.fields.One2many`, or :class:`~odoo.fields.Many2many`)
|
||||||
|
satisfies the provided domain ``value``.
|
||||||
|
``not any``
|
||||||
|
matches if no record in the relationship traversal through
|
||||||
|
``field_name`` (:class:`~odoo.fields.Many2one`,
|
||||||
|
:class:`~odoo.fields.One2many`, or :class:`~odoo.fields.Many2many`)
|
||||||
|
satisfies the provided domain ``value``.
|
||||||
|
|
||||||
* ``value``
|
* ``value``
|
||||||
variable type, must be comparable (through ``operator``) to the named
|
variable type, must be comparable (through ``operator``) to the named
|
||||||
@ -960,21 +970,16 @@ Domain criteria can be combined using logical operators in *prefix* form:
|
|||||||
|
|
||||||
.. example::
|
.. example::
|
||||||
|
|
||||||
To search for partners named *ABC*, from belgium or germany, whose language
|
To search for partners named *ABC*, with a phone or mobile number containing *7620*::
|
||||||
is not english::
|
|
||||||
|
|
||||||
[('name', '=', 'ABC'),
|
[('name', '=', 'ABC'),
|
||||||
('language.code','!=','en_US'),
|
'|', ('phone','ilike','7620'), ('mobile', 'ilike', '7620')]
|
||||||
'|',('country_id.code','=','be'),
|
|
||||||
('country_id.code','=','de')]
|
|
||||||
|
|
||||||
This domain is interpreted as:
|
To search sales orders to invoice that have at least one line with
|
||||||
|
a product that is out of stock::
|
||||||
|
|
||||||
.. code-block:: text
|
[('invoice_status', '=', 'to invoice'),
|
||||||
|
('order_line', 'any', [('product_id.qty_available', '<=', 0)])]
|
||||||
(name is 'ABC')
|
|
||||||
AND (language is NOT english)
|
|
||||||
AND (country is Belgium OR Germany)
|
|
||||||
|
|
||||||
Unlink
|
Unlink
|
||||||
------
|
------
|
||||||
|
Loading…
Reference in New Issue
Block a user