From 11b7857af63a35e81daa495bcb3522b3915f32ca Mon Sep 17 00:00:00 2001 From: Mathieu Duckerts-Antoine Date: Thu, 5 Jul 2018 17:09:33 +0200 Subject: [PATCH] [DOC] web: improve documentation of search view --- doc/reference/views.rst | 77 +++++++++++++++++++++++++++++++++++++++-- 1 file changed, 75 insertions(+), 2 deletions(-) diff --git a/doc/reference/views.rst b/doc/reference/views.rst index eca2a0ad73f..9093bc314c6 100644 --- a/doc/reference/views.rst +++ b/doc/reference/views.rst @@ -1423,12 +1423,85 @@ Possible children elements of the search view are: ``string`` (required) the label of the filter - ``domain`` + ``domain`` (optional) an Odoo :ref:`domain `, will be appended to the - action's domain as part of the search domain + action's domain as part of the search domain. + ``date`` (optional) + the name of a field of type ``date`` or ``datetime``. + Using this attribute has the effect to create + a set of filters available in a submenu + of the filters menu. + + Example: + + .. code-block:: xml + + + + The example above allows to easily search for records with creation date field + values in one of the periods below. + + .. code-block:: text + + Create Date > + Today + This Week + This Month + This Quarter + This Year + -------------- + Yesterday + Last Week + Last Month + Last Quarter + Last Year + -------------- + Last 7 Days + Last 30 Days + Last 365 Days + + Note that the generated domains are dynamic and can be saved as such (via the favorites menu). + + ``default_period`` (optional) + only makes sense for a filter with non empty ``date`` attribute. + determines which period is activated if the filter is in the + default set of filters activated at the view initialization. If not provided, + 'this_month' is used by default. + + To choose among the following options: + today, this_week, this_month, this_quarter, this_year, + yesterday, last_week, last_month, + last_quarter, last_year, last_7_days, last_30_days, last_365_days + + Example: + + .. code-block:: xml + + + ``context`` a Python dictionary, merged into the action's domain to generate the search domain + + The key ``group_by`` can be used to define a groupby available in the + 'Group By' menu. + The 'group_by' value can be a valid field name or a list of field names. + + .. code-block:: xml + + + + The groupby defined above allows to group data by category. + + When the field is of type ``date`` or ``datetime``, the records are grouped by month by default. + This can be modified by using one of the following options: day, week, quarter, year. + + Example: + + .. code-block:: xml + + + ``name`` logical name for the filter, can be used to :ref:`enable it by default `, can also be used as