summaryrefslogtreecommitdiff
path: root/doc/reference
diff options
context:
space:
mode:
authorTymoteusz Motylewski <t.motylewski@gmail.com>2014-10-13 21:41:51 +0200
committerXavier Morel <xmo@openerp.com>2014-10-14 11:14:06 +0200
commit2b8cb4fa89c3ef80d6c35de59c0a5d7288348866 (patch)
tree685844f0d6a11ce69563c63cd6e3aebbac967be7 /doc/reference
parentd7f2cc24834f86247b732505d8aa5fd7f478d428 (diff)
[ADD] doc: document domain operators, fix typos
* Add description for all allowed operators. * Improve wording of domain documentation and fix spelling.
Diffstat (limited to 'doc/reference')
-rw-r--r--doc/reference/orm.rst48
1 files changed, 45 insertions, 3 deletions
diff --git a/doc/reference/orm.rst b/doc/reference/orm.rst
index a8a44f67f00..03548d1e399 100644
--- a/doc/reference/orm.rst
+++ b/doc/reference/orm.rst
@@ -409,7 +409,7 @@ and it's possible to write directly on the delegated field:
Domains
=======
-A domain is a list of criterion, each criterion being a triple (either a
+A domain is a list of criteria, each criterion being a triple (either a
``list`` or a ``tuple``) of ``(field_name, operator, value)`` where:
``field_name`` (``str``)
@@ -417,9 +417,51 @@ A domain is a list of criterion, each criterion being a triple (either a
a :class:`~openerp.fields.Many2one` using dot-notation e.g. ``'street'``
or ``'partner_id.country'``
``operator`` (``str``)
- a comparison operator between the criterion's field and value.
+ an operator used to compare the ``field_name`` with the ``value``. Valid
+ operators are:
+
+ ``=``
+ equals to
+ ``!=``
+ not equals to
+ ``>``
+ greater than
+ ``>=``
+ greater than or equal to
+ ``<``
+ less than
+ ``<=``
+ less than or equal to
+ ``=?``
+ unset or equals to (returns true if ``value`` is either ``None`` or
+ ``False``, otherwise behaves like ``=``)
+ ``=like``
+ matches ``field_name`` against the ``value`` pattern. An underscore
+ ``_`` in the pattern stands for (matches) any single character; a
+ percent sign ``%`` matches any string of zero or more characters.
+ ``like``
+ matches ``field_name`` against the ``%value%`` pattern. Similar to
+ ``=like`` but wraps ``value`` with '%' before matching
+ ``not like``
+ doesn't match against the ``%value%`` pattern
+ ``ilike``
+ case insensitive ``like``
+ ``not ilike``
+ case insensitive ``not like``
+ ``=ilike``
+ case insensitive ``=like``
+ ``in``
+ is equal to any of the items from ``value``, ``value`` should be a
+ list of items
+ ``not in``
+ is unequal to all of the items from ``value``
+ ``child_of``
+ is a child (descendant) of a ``value`` record.
+
+ Takes the semantics of the model into account (i.e following the
+ relationship field named by
+ :attr:`~openerp.models.Model._parent_name`).
- .. todo:: list and detail operators, original list is way incomplete
``value``
variable type, must be comparable (through ``operator``) to the named
field