diff --git a/content/developer/reference/backend/orm.rst b/content/developer/reference/backend/orm.rst index 9ef88bc1e2..ae88e09206 100644 --- a/content/developer/reference/backend/orm.rst +++ b/content/developer/reference/backend/orm.rst @@ -950,26 +950,20 @@ A domain can be a simple condition ``(field_expr, operator, value)`` where: ``=?`` unset or equals to (returns true if ``value`` is either ``None`` or ``False``, otherwise behaves like ``=``) - ``=like`` + ``=like`` (and ``not =like``) matches ``field_expr`` 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`` + ``like`` (and ``not like``) matches ``field_expr`` against the ``%value%`` pattern. Similar to ``=like`` but wraps ``value`` with '%' before matching - ``not like`` - doesn't match against the ``%value%`` pattern - ``ilike`` + ``ilike`` (and ``not ilike``) case insensitive ``like`` - ``not ilike`` - case insensitive ``not like`` - ``=ilike`` + ``=ilike`` (and ``not =ilike``) case insensitive ``=like`` - ``in`` + ``in`` (and ``not in``) is equal to any of the items from ``value``, ``value`` should be a collection of items - ``not in`` - is unequal to all of the items from ``value`` ``child_of`` is a child (descendant) of a ``value`` record (value can be either one item or a list of items). @@ -984,17 +978,14 @@ A domain can be a simple condition ``(field_expr, operator, value)`` where: Takes the semantics of the model into account (i.e following the relationship field named by :attr:`~odoo.models.Model._parent_name`). - ``any`` + ``any`` (and ``not any``) matches if any record in the relationship traversal through ``field_expr`` (:class:`~odoo.fields.Many2one`, :class:`~odoo.fields.One2many`, or :class:`~odoo.fields.Many2many`) satisfies the provided domain ``value``. The ``field_expr`` should be a field name. - ``not any`` - matches if no record in the relationship traversal through - ``field_expr`` (:class:`~odoo.fields.Many2one`, - :class:`~odoo.fields.One2many`, or :class:`~odoo.fields.Many2many`) - satisfies the provided domain ``value``. + ``any!`` (and ``not any!``) + like ``any``, but bypasses access checks. * ``value`` variable type, must be comparable (through ``operator``) to the named @@ -1043,6 +1034,37 @@ and you can negate 1 using ``'!'`` (NOT). .. automethod:: odoo.fields.Domain.validate +.. _reference/orm/dynamic_values: + +Dynamic time values +~~~~~~~~~~~~~~~~~~~ + +In the context of search domains, for +:ref:`date and datetime fields `, the value can be a +moment relative to *now* in the timezone of the user. A simple language is +provided to specify these dates. It is a space-separated string of terms. +The first term is optional and is "today" (at midnight) or "now". +Then, each term starts with "+" (add), "-" (subtract) or "=" (set), followed by +an integer and date unit or a lower-case weekday. + +The date units are: "d" (days), "w" (weeks), "m" (months), "y" (years), +"H" (hours), "M" (minutes), "S" (seconds). +For weekdays, "+" and "-" mean next and previous weekday (unless we are already +in that weekday) and "=" means in current week starting on Monday. +When setting a date, the lower-units (hours, minutes and seconds) are set to 0. + +.. example:: + + .. code-block:: python + + Domain('some_date', '<', 'now') # now + Domain('some_date', '<', 'today') # today at midnight + Domain('some_date', '<', '-3d +1H') # now - 3 days + 1 hour + Domain('some_date', '<', '=3H') # today at 3:00:00 + Domain('some_date', '<', '=5d') # 5th day of current month at midnight + Domain('some_date', '<', '=1m') # January, same day of month at midnight + Domain('some_date', '>=', '=monday -1w') # Monday of the previous week + Unlink ------ diff --git a/content/developer/reference/backend/orm/changelog.rst b/content/developer/reference/backend/orm/changelog.rst index 3b15ccb166..7ffb62bab0 100644 --- a/content/developer/reference/backend/orm/changelog.rst +++ b/content/developer/reference/backend/orm/changelog.rst @@ -4,11 +4,24 @@ Changelog ========= +Odoo version 19.0 +================= + +- Add support for ``GROUPING SETS`` for pivot views. + See `#194413 `_. +- Adding support for dynamic dates in domains. + See `#216665 `_. +- Deprecated `odoo.osv` in `#217708 `_. +- Deprecated `record._cr`, `record._context`, `record._uid` in `#193636 `_. + + Odoo Online version 18.4 ======================== - The `reinit` option is added to the CLI to reinitialize modules. See `#206408 `_. +- Possibility to write and combine custom domains for injecting arbitrary SQL. + See `#205208 `_. Odoo Online version 18.3 ========================