[IMP] developer/views: apply the new API references style

The documentation of view attributes was lacking visual structure to
help the reader figure out which attribute relates to which parent
element. Since this documentation was relying on RST block quotes to
represent the hierarchy of view attributes, we can apply the same new
styling that was added with commit 934f45cf and designed for autodoc,
and which relies on the exact same HTML structure as block quotes.

task-2755298

closes odoo/documentation#2329

Signed-off-by: Antoine Vandevenne (anv) <anv@odoo.com>
This commit is contained in:
Antoine Vandevenne (anv) 2022-06-21 12:45:35 +00:00
parent 85b5374995
commit 7f95e9e2e0
2 changed files with 217 additions and 133 deletions

View File

@ -274,6 +274,8 @@ There are three types of element locators for matching a target element:
The inheritance spec may have an optional ``position`` attribute specifying The inheritance spec may have an optional ``position`` attribute specifying
how the matched node should be altered: how the matched node should be altered:
.. rst-class:: o-definition-list
``inside`` (default) ``inside`` (default)
the content of the inheritance spec is appended to the matched node the content of the inheritance spec is appended to the matched node
``replace`` ``replace``
@ -354,17 +356,23 @@ of all activities of the same type for the record is displayed.
The root element of the Activity view is ``<activity>``, it accepts the following The root element of the Activity view is ``<activity>``, it accepts the following
attributes: attributes:
- ``string`` (mandatory) .. rst-class:: o-definition-list
``string`` (mandatory)
A title, which should describe the view A title, which should describe the view
Possible children of the view element are: Possible children of the view element are:
.. rst-class:: o-definition-list
``field`` ``field``
declares fields to use in activity *logic*. If the field is simply displayed declares fields to use in activity *logic*. If the field is simply displayed
in the activity view, it does not need to be pre-declared. in the activity view, it does not need to be pre-declared.
Possible attributes are: Possible attributes are:
.. rst-class:: o-definition-list
``name`` (required) ``name`` (required)
the name of the field to fetch the name of the field to fetch
@ -378,6 +386,8 @@ Possible children of the view element are:
<reference/qweb/javascript>` and provides the following context variables <reference/qweb/javascript>` and provides the following context variables
(see :ref:`reference/views/kanban` for more details): (see :ref:`reference/views/kanban` for more details):
.. rst-class:: o-definition-list
``widget`` ``widget``
the current :js:class:`ActivityRecord`, can be used to fetch some the current :js:class:`ActivityRecord`, can be used to fetch some
meta-information. These methods are also available directly in the meta-information. These methods are also available directly in the
@ -395,6 +405,8 @@ Calendar views display records as events in a daily, weekly, monthly or yearly
calendar. Their root element is ``<calendar>``. Available attributes on the calendar. Their root element is ``<calendar>``. Available attributes on the
calendar view are: calendar view are:
.. rst-class:: o-definition-list
``date_start`` (required) ``date_start`` (required)
name of the record's field holding the start date for the event name of the record's field holding the start date for the event
``date_stop`` ``date_stop``
@ -430,24 +442,26 @@ calendar view are:
``scales`` ``scales``
Comma-separated list of scales to provide. By default, all scales are Comma-separated list of scales to provide. By default, all scales are
available. See mode for possible scale values. available. See mode for possible scale values.
``create``, ``delete``
allows disabling the corresponding action in the view by setting the
corresponding attribute to ``false``
``<field>`` ``<field>``
declares fields to aggregate or to use in kanban *logic*. If the field is declares fields to aggregate or to use in kanban *logic*. If the field is
simply displayed in the calendar cards. simply displayed in the calendar cards.
Fields can have additional attributes: Fields can have additional attributes:
* ``invisible`` .. rst-class:: o-definition-list
``invisible``
use "True" to hide the value in the cards use "True" to hide the value in the cards
* ``avatar_field`` ``avatar_field``
only for x2many field, to display the avatar instead of the display_name only for x2many field, to display the avatar instead of the display_name
in the cards in the cards
* ``write_model`` and ``write_field`` ``write_model`` and ``write_field``
you can add a filter and save the result in the defined model, the you can add a filter and save the result in the defined model, the
filter is added in the sidebar filter is added in the sidebar
* ``filter`` and ``color`` ``filter`` and ``color``
use "True" to add this field in filter in the sidebar. You can specify use "True" to add this field in filter in the sidebar. You can specify
a ``color`` field used to colorize the checkbox. a ``color`` field used to colorize the checkbox.
@ -482,34 +496,35 @@ For example, here is a very simple cohort view:
The root element of the Cohort view is <cohort>, it accepts the following The root element of the Cohort view is <cohort>, it accepts the following
attributes: attributes:
.. rst-class:: o-definition-list
- ``string`` (mandatory) ``string`` (mandatory)
A title, which should describe the view A title, which should describe the view
- ``date_start`` (mandatory) ``date_start`` (mandatory)
A valid date or datetime field. This field is understood by the view as the A valid date or datetime field. This field is understood by the view as the
beginning date of a record beginning date of a record
- ``date_stop`` (mandatory) ``date_stop`` (mandatory)
A valid date or datetime field. This field is understood by the view as the A valid date or datetime field. This field is understood by the view as the
end date of a record. This is the field that will determine the churn. end date of a record. This is the field that will determine the churn.
- ``mode`` (optional) ``mode`` (optional)
A string to describe the mode. It should be either 'churn' or A string to describe the mode. It should be either 'churn' or
'retention' (default). Churn mode will start at 0% and accumulate over time 'retention' (default). Churn mode will start at 0% and accumulate over time
whereas retention will start at 100% and decrease over time. whereas retention will start at 100% and decrease over time.
- ``timeline`` (optional) ``timeline`` (optional)
A string to describe the timeline. It should be either 'backward' or 'forward' (default). A string to describe the timeline. It should be either 'backward' or 'forward' (default).
Forward timeline will display data from date_start to date_stop, whereas backward timeline Forward timeline will display data from date_start to date_stop, whereas backward timeline
will display data from date_stop to date_start (when the date_start is in future / greater will display data from date_stop to date_start (when the date_start is in future / greater
than date_stop). than date_stop).
- ``interval`` (optional) ``interval`` (optional)
A string to describe a time interval. It should be 'day', 'week', 'month'' A string to describe a time interval. It should be 'day', 'week', 'month''
(default) or 'year'. (default) or 'year'.
- ``measure`` (optional) ``measure`` (optional)
A field that can be aggregated. This field will be used to compute the values A field that can be aggregated. This field will be used to compute the values
for each cell. If not set, the cohort view will count the number of occurrences. for each cell. If not set, the cohort view will count the number of occurrences.
@ -517,12 +532,14 @@ attributes:
allows to specify a particular field in order to manage it from the available measures, it's allows to specify a particular field in order to manage it from the available measures, it's
main use is for hiding a field from the selectable measures: main use is for hiding a field from the selectable measures:
- ``name`` (required) .. rst-class:: o-definition-list
``name`` (required)
the name of the field to use in the view. the name of the field to use in the view.
- ``string`` (optional) ``string`` (optional)
the name that would be used to display the field in the cohort view, overrides the the name that would be used to display the field in the cohort view, overrides the
default python String attribute of the field. default python String attribute of the field.
- ``invisible`` (optional) ``invisible`` (optional)
if true, the field will not appear either in the active measures nor in the selectable if true, the field will not appear either in the active measures nor in the selectable
measures (useful for fields that do not make sense aggregated, such as fields in different measures (useful for fields that do not make sense aggregated, such as fields in different
units, e.g. € and $). units, e.g. € and $).
@ -562,19 +579,23 @@ attributes.
There are 5 possible type of tags in a dashboard view: There are 5 possible type of tags in a dashboard view:
.. rst-class:: o-definition-list
``view`` ``view``
declares a sub view. declares a sub view.
Admissible attributes are: Admissible attributes are:
- ``type`` (mandatory) .. rst-class:: o-definition-list
``type`` (mandatory)
The type of the sub view. For example, *graph* or *pivot*. The type of the sub view. For example, *graph* or *pivot*.
- ``ref`` (optional) ``ref`` (optional)
An xml id for a view. If not given, the default view for the model will An xml id for a view. If not given, the default view for the model will
be used. be used.
- ``name`` (optional) ``name`` (optional)
A string which identifies this element. It is mostly A string which identifies this element. It is mostly
useful to be used as a target for an xpath. useful to be used as a target for an xpath.
@ -584,13 +605,15 @@ There are 5 possible type of tags in a dashboard view:
Admissible attributes are: Admissible attributes are:
- ``string`` (optional) .. rst-class:: o-definition-list
``string`` (optional)
A description which will be displayed as a group title. A description which will be displayed as a group title.
- ``colspan`` (optional) ``colspan`` (optional)
The number of subcolumns in this group tag. By default, 6. The number of subcolumns in this group tag. By default, 6.
- ``col`` (optional) ``col`` (optional)
The number of columns spanned by this group tag (only makes sense inside The number of columns spanned by this group tag (only makes sense inside
another group). By default, 6. another group). By default, 6.
@ -604,7 +627,9 @@ There are 5 possible type of tags in a dashboard view:
Admissible attributes are: Admissible attributes are:
- ``field`` (mandatory) .. rst-class:: o-definition-list
``field`` (mandatory)
The field name to use for computing the aggregate. Possible field types The field name to use for computing the aggregate. Possible field types
are: are:
@ -612,23 +637,23 @@ There are 5 possible type of tags in a dashboard view:
- ``float`` (default group operator is sum) - ``float`` (default group operator is sum)
- ``many2one`` (default group operator is count distinct) - ``many2one`` (default group operator is count distinct)
- ``name`` (mandatory) ``name`` (mandatory)
A string to identify this aggregate (useful for formulas) A string to identify this aggregate (useful for formulas)
- ``string`` (optional) ``string`` (optional)
A short description that will be displayed above the value. If not A short description that will be displayed above the value. If not
given, it will fall back to the field string. given, it will fall back to the field string.
- ``domain`` (optional) ``domain`` (optional)
An additional restriction on the set of records that we want to aggregate. An additional restriction on the set of records that we want to aggregate.
This domain will be combined with the current domain. This domain will be combined with the current domain.
- ``domain_label`` (optional) ``domain_label`` (optional)
When the user clicks on an aggregate with a domain, it will be added to When the user clicks on an aggregate with a domain, it will be added to
the search view as a facet. The string displayed for this facet can the search view as a facet. The string displayed for this facet can
be customized with this attribute. be customized with this attribute.
- ``group_operator`` (optional) ``group_operator`` (optional)
A valid postgreSQL aggregate function identifier to use when aggregating A valid postgreSQL aggregate function identifier to use when aggregating
values (see https://www.postgresql.org/docs/9.5/static/functions-aggregate.html). values (see https://www.postgresql.org/docs/9.5/static/functions-aggregate.html).
If not provided, By default, the group_operator from the field definition is used. If not provided, By default, the group_operator from the field definition is used.
@ -642,18 +667,18 @@ There are 5 possible type of tags in a dashboard view:
- ``col`` (optional) ``col`` (optional)
The number of columns spanned by this tag (only makes sense inside a The number of columns spanned by this tag (only makes sense inside a
group). By default, 1. group). By default, 1.
- ``widget`` (optional) ``widget`` (optional)
A widget to format the value (like the widget attribute for fields). A widget to format the value (like the widget attribute for fields).
For example, monetary. For example, monetary.
- ``help`` (optional) ``help`` (optional)
A help message to dipslay in a tooltip (equivalent of help for a field in python) A help message to dipslay in a tooltip (equivalent of help for a field in python)
- ``measure`` (optional) ``measure`` (optional)
This attribute is the name of a field describing the measure that has to be used This attribute is the name of a field describing the measure that has to be used
in the graph and pivot views when clicking on the aggregate. in the graph and pivot views when clicking on the aggregate.
The special value __count__ can be used to use the count measure. The special value __count__ can be used to use the count measure.
@ -662,12 +687,12 @@ There are 5 possible type of tags in a dashboard view:
<aggregate name="total_ojects" string="Total Objects" field="id" group_operator="count" measure="__count__"/> <aggregate name="total_ojects" string="Total Objects" field="id" group_operator="count" measure="__count__"/>
- ``clickable`` (optional) ``clickable`` (optional)
A boolean indicating if this aggregate should be clickable or not (default to true). A boolean indicating if this aggregate should be clickable or not (default to true).
Clicking on a clickable aggregate will change the measures used by the subviews Clicking on a clickable aggregate will change the measures used by the subviews
and add the value of the domain attribute (if any) to the search view. and add the value of the domain attribute (if any) to the search view.
- ``value_label`` (optional) ``value_label`` (optional)
A string put on the right of the aggregate value. A string put on the right of the aggregate value.
For example, it can be useful to indicate the unit of measure For example, it can be useful to indicate the unit of measure
of the aggregate value. of the aggregate value.
@ -680,30 +705,32 @@ There are 5 possible type of tags in a dashboard view:
Admissible attributes are: Admissible attributes are:
- ``value`` (mandatory) .. rst-class:: o-definition-list
``value`` (mandatory)
A string expression that will be evaluated, with the builtin python A string expression that will be evaluated, with the builtin python
evaluator (in the web client). Every aggregate can be used in the evaluator (in the web client). Every aggregate can be used in the
context, in the ``record`` variable. For example, context, in the ``record`` variable. For example,
``record.price_total / record.order_id``. ``record.price_total / record.order_id``.
- ``name`` (optional) ``name`` (optional)
A string to identify this formula A string to identify this formula
- ``string`` (optional) ``string`` (optional)
A short description that will be displayed above the formula. A short description that will be displayed above the formula.
- ``col`` (optional) ``col`` (optional)
The number of columns spanned by this tag (only makes sense inside a The number of columns spanned by this tag (only makes sense inside a
group). By default, 1. group). By default, 1.
- ``widget`` (optional) ``widget`` (optional)
A widget to format the value (like the widget attribute for fields). A widget to format the value (like the widget attribute for fields).
For example, monetary. By default, it is 'float'. For example, monetary. By default, it is 'float'.
- ``help`` (optional) ``help`` (optional)
A help message to dipslay in a tooltip (equivalent of help for a field in python) A help message to dipslay in a tooltip (equivalent of help for a field in python)
- ``value_label`` (optional) ``value_label`` (optional)
A string put on the right of the formula value. A string put on the right of the formula value.
For example, it can be useful to indicate the unit of measure For example, it can be useful to indicate the unit of measure
of the formula value. of the formula value.
@ -714,11 +741,13 @@ There are 5 possible type of tags in a dashboard view:
Admissible attributes are: Admissible attributes are:
- ``name`` (mandatory) .. rst-class:: o-definition-list
``name`` (mandatory)
A string to identify which widget should be instantiated. The view will A string to identify which widget should be instantiated. The view will
look into the ``widget_registry`` to get the proper class. look into the ``widget_registry`` to get the proper class.
- ``col`` (optional) ``col`` (optional)
The number of columns spanned by this tag (only makes sense inside a The number of columns spanned by this tag (only makes sense inside a
group). By default, 1. group). By default, 1.
@ -737,15 +766,19 @@ Structural components
Structural components provide structure or "visual" features with little Structural components provide structure or "visual" features with little
logic. They are used as elements or sets of elements in form views. logic. They are used as elements or sets of elements in form views.
.. rst-class:: o-definition-list
``notebook`` ``notebook``
defines a tabbed section. Each tab is defined through a ``page`` child defines a tabbed section. Each tab is defined through a ``page`` child
element. Pages can have the following attributes: element. Pages can have the following attributes:
* ``string`` (required) .. rst-class:: o-definition-list
``string`` (required)
the title of the tab the title of the tab
* ``accesskey`` ``accesskey``
an HTML accesskey_ an HTML accesskey_
* ``attrs`` ``attrs``
standard dynamic attributes based on record values standard dynamic attributes based on record values
.. note:: Note that ``notebook`` should not be placed within ``group`` .. note:: Note that ``notebook`` should not be placed within ``group``
@ -785,11 +818,15 @@ Semantic components
Semantic components tie into and allow interaction with the Odoo Semantic components tie into and allow interaction with the Odoo
system. Available semantic components are: system. Available semantic components are:
.. rst-class:: o-definition-list
``button`` ``button``
call into the Odoo system, similar to :ref:`list view buttons call into the Odoo system, similar to :ref:`list view buttons
<reference/views/list/button>`. In addition, the following attribute can be <reference/views/list/button>`. In addition, the following attribute can be
specified: specified:
.. rst-class:: o-definition-list
``special`` ``special``
for form views opened in dialogs: ``save`` to save the record and close the for form views opened in dialogs: ``save`` to save the record and close the
dialog, ``cancel`` to close the dialog without saving. dialog, ``cancel`` to close the dialog without saving.
@ -804,6 +841,8 @@ system. Available semantic components are:
the behavior is not guaranteed when several fields exist with different values the behavior is not guaranteed when several fields exist with different values
for modifier 'required'. Possible attributes of the field node are: for modifier 'required'. Possible attributes of the field node are:
.. rst-class:: o-definition-list
``name`` (mandatory) ``name`` (mandatory)
the name of the field to render the name of the field to render
``id`` ``id``
@ -825,6 +864,8 @@ system. Available semantic components are:
``class`` ``class``
HTML class to set on the generated element, common field classes are: HTML class to set on the generated element, common field classes are:
.. rst-class:: o-definition-list
``oe_inline`` ``oe_inline``
prevent the usual line break following fields prevent the usual line break following fields
``oe_left``, ``oe_right`` ``oe_left``, ``oe_right``
@ -886,6 +927,8 @@ system. Available semantic components are:
displayed alongside its value. The ``label`` component is the manual alternative displayed alongside its value. The ``label`` component is the manual alternative
of displaying the label of a field. Possible attributes are: of displaying the label of a field. Possible attributes are:
.. rst-class:: o-definition-list
``for`` (mandatory) ``for`` (mandatory)
the reference to the field associated with the label. Can be either the name the reference to the field associated with the label. Can be either the name
of a field, or its id (``id`` attribute set on the ``field``). When there are of a field, or its id (``id`` attribute set on the ``field``). When there are
@ -953,6 +996,8 @@ Gantt views appropriately display Gantt charts (for scheduling).
The root element of gantt views is ``<gantt/>``, it has no children but can The root element of gantt views is ``<gantt/>``, it has no children but can
take the following attributes: take the following attributes:
.. rst-class:: o-definition-list
``date_start`` (required) ``date_start`` (required)
name of the field providing the start datetime of the event for each name of the field providing the start datetime of the event for each
record. record.
@ -1021,27 +1066,27 @@ take the following attributes:
``precision`` ``precision``
JSON object specifying snapping precisions for the pills in each scale. JSON object specifying snapping precisions for the pills in each scale.
* Possible values for scale ``day`` are (default: ``hour``): Possible values for scale ``day`` are (default: ``hour``):
``hour``: records times snap to full hours (ex: 7:12 becomes 8:00) - ``hour``: records times snap to full hours (ex: 7:12 becomes 8:00)
``hour:half``: records times snap to half hours (ex: 7:12 becomes 7:30) - ``hour:half``: records times snap to half hours (ex: 7:12 becomes 7:30)
``hour:quarter``: records times snap to half hours (ex: 7:12 becomes 7:15) - ``hour:quarter``: records times snap to half hours (ex: 7:12 becomes 7:15)
* Possible values for scale ``week`` are (default: ``day:half``): Possible values for scale ``week`` are (default: ``day:half``):
``day``: records times snap to full days (ex: 7:28 AM becomes 11:59:59 PM of the previous day, 10:32 PM becomes 12:00 PM of the current day) - ``day``: records times snap to full days (ex: 7:28 AM becomes 11:59:59 PM of the previous day, 10:32 PM becomes 12:00 PM of the current day)
``day:half``: records times snap to half hours (ex: 7:28 AM becomes 12:00 PM) - ``day:half``: records times snap to half hours (ex: 7:28 AM becomes 12:00 PM)
* Possible values for scale ``month`` are (default: ``day:half``): Possible values for scale ``month`` are (default: ``day:half``):
``day``: records times snap to full days (ex: 7:28 AM becomes 11:59:59 PM of the previous day, 10:32 PM becomes 12:00 PM of the current day) - ``day``: records times snap to full days (ex: 7:28 AM becomes 11:59:59 PM of the previous day, 10:32 PM becomes 12:00 PM of the current day)
``day:half``: records times snap to half hours (ex: 7:28 AM becomes 12:00 PM) - ``day:half``: records times snap to half hours (ex: 7:28 AM becomes 12:00 PM)
* Scale ``year`` always snap to full day. Scale ``year`` always snap to full day.
Example of precision attribute: ``{"day": "hour:quarter", "week": "day:half", "month": "day"}`` Example of precision attribute: ``{"day": "hour:quarter", "week": "day:half", "month": "day"}``
``total_row`` ``total_row``
@ -1073,14 +1118,16 @@ take the following attributes:
The gantt view uses mostly-standard :ref:`javascript qweb The gantt view uses mostly-standard :ref:`javascript qweb
<reference/qweb/javascript>` and provides the following context variables: <reference/qweb/javascript>` and provides the following context variables:
.. rst-class:: o-definition-list
``widget`` ``widget``
the current :js:class:`GanttRow`, can be used to fetch some the current :js:class:`GanttRow`, can be used to fetch some
meta-information. The ``getColor`` method to convert in a color integer is meta-information. The ``getColor`` method to convert in a color integer is
also available directly in the template context without using ``widget``. also available directly in the template context without using ``widget``.
``on_create`` ``on_create``
If specified when clicking the add button on the view, instead of opening a generic dialog, launch a client action. If specified when clicking the add button on the view, instead of opening a generic dialog, launch a client action.
this should hold the xmlid of the action (eg: ``on_create="%(my_module.my_wizard)d"`` this should hold the xmlid of the action (eg: ``on_create="%(my_module.my_wizard)d"``
``form_view_id`` ``form_view_id``
view to open when the user create or edit a record. Note that if this attribute view to open when the user create or edit a record. Note that if this attribute
@ -1119,6 +1166,8 @@ The graph view is used to visualize aggregations over a number of records or
record groups. Its root element is ``<graph>`` which can take the following record groups. Its root element is ``<graph>`` which can take the following
attributes: attributes:
.. rst-class:: o-definition-list
``type`` ``type``
one of ``bar`` (default), ``pie`` and ``line``, the type of graph to use one of ``bar`` (default), ``pie`` and ``line``, the type of graph to use
``stacked`` ``stacked``
@ -1134,6 +1183,8 @@ attributes:
The only allowed element within a graph view is ``field`` which can have the The only allowed element within a graph view is ``field`` which can have the
following attributes: following attributes:
.. rst-class:: o-definition-list
``name`` (required) ``name`` (required)
the name of a field to use in the view. If used for grouping (rather the name of a field to use in the view. If used for grouping (rather
than aggregating) than aggregating)
@ -1149,6 +1200,8 @@ following attributes:
indicates whether the field should be used as a grouping criteria or as an indicates whether the field should be used as a grouping criteria or as an
aggregated value within a group. Possible values are: aggregated value within a group. Possible values are:
.. rst-class:: o-definition-list
``row`` (default) ``row`` (default)
groups by the specified field. All graph types support at least one level groups by the specified field. All graph types support at least one level
of grouping, some may support more. of grouping, some may support more.
@ -1189,6 +1242,8 @@ work-progress management), or ungrouped (used simply to visualize records).
The root element of the Kanban view is ``<kanban>``, it can use the following The root element of the Kanban view is ``<kanban>``, it can use the following
attributes: attributes:
.. rst-class:: o-definition-list
``default_group_by`` ``default_group_by``
whether the kanban view should be grouped if no grouping is specified via whether the kanban view should be grouped if no grouping is specified via
the action or the current search. Should be the name of the field to group the action or the current search. Should be the name of the field to group
@ -1224,12 +1279,16 @@ attributes:
Possible children of the view element are: Possible children of the view element are:
.. rst-class:: o-definition-list
``field`` ``field``
declares fields to use in kanban *logic*. If the field is simply displayed in declares fields to use in kanban *logic*. If the field is simply displayed in
the kanban view, it does not need to be pre-declared. the kanban view, it does not need to be pre-declared.
Possible attributes are: Possible attributes are:
.. rst-class:: o-definition-list
``name`` (required) ``name`` (required)
the name of the field to fetch the name of the field to fetch
@ -1238,6 +1297,8 @@ Possible children of the view element are:
Possible attributes are: Possible attributes are:
.. rst-class:: o-definition-list
``field`` (required) ``field`` (required)
the name of the field whose values are used to subgroup column's records in the name of the field whose values are used to subgroup column's records in
the progressbar the progressbar
@ -1260,6 +1321,8 @@ Possible children of the view element are:
The kanban view uses mostly-standard :ref:`javascript qweb The kanban view uses mostly-standard :ref:`javascript qweb
<reference/qweb/javascript>` and provides the following context variables: <reference/qweb/javascript>` and provides the following context variables:
.. rst-class:: o-definition-list
``widget`` ``widget``
the current :js:class:`KanbanRecord`, can be used to fetch some the current :js:class:`KanbanRecord`, can be used to fetch some
meta-information. These methods are also available directly in the meta-information. These methods are also available directly in the
@ -1295,6 +1358,8 @@ Possible children of the view element are:
behavior depends on the corresponding widget. Possible values are (among behavior depends on the corresponding widget. Possible values are (among
others): others):
.. rst-class:: o-definition-list
``handle`` ``handle``
for ``sequence`` (or ``integer``) fields by which records are for ``sequence`` (or ``integer``) fields by which records are
sorted, allows to drag&drop records to reorder them. sorted, allows to drag&drop records to reorder them.
@ -1304,6 +1369,8 @@ Possible children of the view element are:
* buttons and links with a ``type`` attribute become perform Odoo-related * buttons and links with a ``type`` attribute become perform Odoo-related
operations rather than their standard HTML function. Possible types are: operations rather than their standard HTML function. Possible types are:
.. rst-class:: o-definition-list
``action``, ``object`` ``action``, ``object``
standard behavior for :ref:`Odoo buttons standard behavior for :ref:`Odoo buttons
<reference/views/list/button>`, most attributes relevant to standard <reference/views/list/button>`, most attributes relevant to standard
@ -1320,53 +1387,7 @@ Possible children of the view element are:
* kanban-specific CSS * kanban-specific CSS
* kanban structures/widgets (vignette, details, ...) * kanban structures/widgets (vignette, details, ...)
If you need to extend the Kanban view, see :js:class::`the JS API <KanbanRecord>`. If you need to extend the Kanban view, see :js:class:`KanbanRecord`.
Calendar
~~~~~~~~
Calendar views display records as events in a daily, weekly or monthly
calendar. Their root element is ``<calendar>``. Available attributes on the
calendar view are:
``date_start`` (required)
name of the record's field holding the start date for the event
``date_stop``
name of the record's field holding the end date for the event, if
``date_stop`` is provided records become movable (via drag and drop)
directly in the calendar
``date_delay``
alternative to ``date_stop``, provides the duration of the event instead of
its end date (unit: day)
``color``
name of a record field to use for *color segmentation*. Records in the
same color segment are allocated the same highlight color in the calendar,
colors are allocated semi-randomly.
Displayed the display_name/avatar of the visible record in the sidebar
``form_view_id``
view to open when the user create or edit an event. Note that if this attribute
is not set, the calendar view will fall back to the id of the form view in the
current action, if any.
``event_open_popup``
If the option 'event_open_popup' is set to true, then the calendar view will
open events (or records) in a FormViewDialog. Otherwise, it will open events
in a new form view (with a do_action)
``quick_add``
enables quick-event creation on click: only asks the user for a ``name``
and tries to create a new event with just that and the clicked event
time. Falls back to a full form dialog if the quick creation fails
``all_day``
name of a boolean field on the record indicating whether the corresponding
event is flagged as day-long (and duration is irrelevant)
``mode``
Default display mode when loading the calendar.
Possible attributes are: ``day``, ``week``, ``month``
``create``, ``delete``
allows *dis*\ abling the corresponding action in the view by setting the
corresponding attribute to ``false``
``<field>``
declares fields to aggregate or to use in kanban *logic*. If the field is
simply displayed in the calendar cards.
.. _reference/views/list: .. _reference/views/list:
@ -1376,6 +1397,8 @@ List
The root element of list views is ``<tree>``\ [#treehistory]_. The list view's The root element of list views is ``<tree>``\ [#treehistory]_. The list view's
root can have the following attributes: root can have the following attributes:
.. rst-class:: o-definition-list
``editable`` ``editable``
by default, selecting a list view's row opens the corresponding by default, selecting a list view's row opens the corresponding
:ref:`form view <reference/views/form>`. The ``editable`` attributes makes :ref:`form view <reference/views/form>`. The ``editable`` attributes makes
@ -1428,9 +1451,13 @@ Possible children elements of the list view are:
.. _reference/views/list/button: .. _reference/views/list/button:
.. rst-class:: o-definition-list
``button`` ``button``
displays a button in a list cell displays a button in a list cell
.. rst-class:: o-definition-list
``icon`` ``icon``
icon to use to display the button icon to use to display the button
``string`` ``string``
@ -1439,6 +1466,8 @@ Possible children elements of the list view are:
``type`` ``type``
type of button, indicates how it clicking it affects Odoo: type of button, indicates how it clicking it affects Odoo:
.. rst-class:: o-definition-list
``object`` ``object``
call a method on the list's model. The button's ``name`` is the call a method on the list's model. The button's ``name`` is the
method, which is called with the current row's record id and the method, which is called with the current row's record id and the
@ -1488,6 +1517,8 @@ Possible children elements of the list view are:
defines a column where the corresponding field should be displayed for defines a column where the corresponding field should be displayed for
each record. Can use the following attributes: each record. Can use the following attributes:
.. rst-class:: o-definition-list
``name`` ``name``
the name of the field to display in the current model. A given name the name of the field to display in the current model. A given name
can only be used once per view can only be used once per view
@ -1504,6 +1535,8 @@ Possible children elements of the list view are:
alternate representations for a field's display. Possible list view alternate representations for a field's display. Possible list view
values are (among others): values are (among others):
.. rst-class:: o-definition-list
``progressbar`` ``progressbar``
displays ``float`` fields as a progress bar. displays ``float`` fields as a progress bar.
``handle`` ``handle``
@ -1567,6 +1600,8 @@ Possible children elements of the list view are:
`groupby` which can be used for modifiers. These fields thus belong on the `groupby` which can be used for modifiers. These fields thus belong on the
many2one comodel. These extra fields will be fetched in batch. many2one comodel. These extra fields will be fetched in batch.
.. rst-class:: o-definition-list
``name`` ``name``
the name of a many2one field (on the current model). Custom header will be the name of a many2one field (on the current model). Custom header will be
displayed when grouping the view on this field name. displayed when grouping the view on this field name.
@ -1589,14 +1624,20 @@ Possible children elements of the list view are:
Does not support any attribute, but can have children: Does not support any attribute, but can have children:
.. rst-class:: o-definition-list
``create`` ``create``
adds a button to create a new element on the current list. adds a button to create a new element on the current list.
.. rst-class:: o-definition-list
.. note:: If any ``create`` is defined, it will overwrite the default .. note:: If any ``create`` is defined, it will overwrite the default
"add a line" button. "add a line" button.
The following attributes are supported: The following attributes are supported:
.. rst-class:: o-definition-list
``string`` (required) ``string`` (required)
The text displayed on the button. The text displayed on the button.
@ -1666,6 +1707,9 @@ Structural components
The view's root element is ``<map>`` multiple attributes are allowed The view's root element is ``<map>`` multiple attributes are allowed
.. rst-class:: o-definition-list
``res_partner`` ``res_partner``
Contains the res.partner many2one. If not provided the view will resort to create an empty map. Contains the res.partner many2one. If not provided the view will resort to create an empty map.
``default_order`` ``default_order``
@ -1679,6 +1723,8 @@ The view's root element is ``<map>`` multiple attributes are allowed
The ``<map>`` element can contain multiple ``<field>`` elements. Each ``<field>`` element will be interpreted as a line in the marker's popup. The field's attributes are the following: The ``<map>`` element can contain multiple ``<field>`` elements. Each ``<field>`` element will be interpreted as a line in the marker's popup. The field's attributes are the following:
.. rst-class:: o-definition-list
``name`` ``name``
The field to display. The field to display.
``string`` ``string``
@ -1703,6 +1749,8 @@ Pivot
The pivot view is used to visualize aggregations as a `pivot table`_. Its root The pivot view is used to visualize aggregations as a `pivot table`_. Its root
element is ``<pivot>`` which can take the following attributes: element is ``<pivot>`` which can take the following attributes:
.. rst-class:: o-definition-list
``disable_linking`` ``disable_linking``
Set to ``True`` to remove table cell's links to list view. Set to ``True`` to remove table cell's links to list view.
``display_quantity`` ``display_quantity``
@ -1720,6 +1768,8 @@ element is ``<pivot>`` which can take the following attributes:
The only allowed element within a pivot view is ``field`` which can have the The only allowed element within a pivot view is ``field`` which can have the
following attributes: following attributes:
.. rst-class:: o-definition-list
``name`` (required) ``name`` (required)
the name of a field to use in the view. If used for grouping (rather the name of a field to use in the view. If used for grouping (rather
than aggregating) than aggregating)
@ -1732,6 +1782,8 @@ following attributes:
indicates whether the field should be used as a grouping criteria or as an indicates whether the field should be used as a grouping criteria or as an
aggregated value within a group. Possible values are: aggregated value within a group. Possible values are:
.. rst-class:: o-definition-list
``row`` (default) ``row`` (default)
groups by the specified field, each group gets its own row. groups by the specified field, each group gets its own row.
``col`` ``col``
@ -1798,6 +1850,8 @@ The main additions of qweb-as-view to the basic qweb-as-template are:
* qweb-as-view rendering adds several items to the standard qweb rendering * qweb-as-view rendering adds several items to the standard qweb rendering
context: context:
.. rst-class:: o-definition-list
``model`` ``model``
the model to which the qweb view is bound the model to which the qweb view is bound
``domain`` ``domain``
@ -1833,6 +1887,8 @@ The root element of search views is ``<search>``. It takes no attributes.
Possible children elements of the search view are: Possible children elements of the search view are:
.. rst-class:: o-definition-list
``field`` ``field``
fields define domains or contexts with user-provided values. When search fields define domains or contexts with user-provided values. When search
domains are generated, field domains are composed with one another and domains are generated, field domains are composed with one another and
@ -1840,6 +1896,8 @@ Possible children elements of the search view are:
Fields can have the following attributes: Fields can have the following attributes:
.. rst-class:: o-definition-list
``name`` ``name``
the name of the field to filter on the name of the field to filter on
``string`` ``string``
@ -1887,6 +1945,8 @@ Possible children elements of the search view are:
Filters can have the following attributes: Filters can have the following attributes:
.. rst-class:: o-definition-list
``string`` (required) ``string`` (required)
the label of the filter the label of the filter
``domain`` (optional) ``domain`` (optional)
@ -2021,16 +2081,23 @@ Possible children elements of the search view are:
By default, the list and kanban views have the searchpanel enabled. By default, the list and kanban views have the searchpanel enabled.
The search panel can be activated on other views with the attribute: The search panel can be activated on other views with the attribute:
* ``view_types`` a comma separated list of view types on which to enable the search panel .. rst-class:: o-definition-list
``view_types``
a comma separated list of view types on which to enable the search panel
default: 'tree,kanban' default: 'tree,kanban'
This tool allows to quickly filter data on the basis of given fields. The fields This tool allows to quickly filter data on the basis of given fields. The fields
are specified as direct children of the ``searchpanel`` with tag name ``field``, are specified as direct children of the ``searchpanel`` with tag name ``field``,
and the following attributes: and the following attributes:
* ``name`` (mandatory) the name of the field to filter on .. rst-class:: o-definition-list
* ``select`` determines the behavior and display. Possible values are ``name`` (mandatory)
the name of the field to filter on
``select``
determines the behavior and display. Possible values are
* ``one`` (default) at most one value can be selected. Supported field types are * ``one`` (default) at most one value can be selected. Supported field types are
many2one and selection. many2one and selection.
@ -2038,41 +2105,58 @@ Possible children elements of the search view are:
* ``multi`` several values can be selected (checkboxes). Supported field * ``multi`` several values can be selected (checkboxes). Supported field
types are many2one, many2many and selection. types are many2one, many2many and selection.
* ``groups``: restricts to specific users ``groups``
restricts to specific users
* ``string``: determines the label to display ``string``
determines the label to display
* ``icon``: specifies which icon is used ``icon``
specifies which icon is used
* ``color``: determines the icon color ``color``
determines the icon color
* ``enable_counters``: default is false. If set to true the record counters will be computed and Additional optional attributes are available in the ``multi`` case:
displayed if non-zero.
This feature has been implemented in case performances would be too bad. .. rst-class:: o-definition-list
Another way to solve performance issues is to properly override the ``enable_counters``
``search_panel_select_range`` and ``search_panel_select_multi_range`` methods. default is false. If set to true the record counters will be computed and
displayed if non-zero.
* ``expand``: default is false. If set to false categories or filters with 0 records will be hidden. This feature has been implemented in case performances would be too bad.
* ``limit``: default is 200. Integer determining the maximal number of values to fetch for the field. Another way to solve performance issues is to properly override the
If the limit is reached, no values will be displayed in the search panel and an error message will ``search_panel_select_range`` and ``search_panel_select_multi_range`` methods.
appear instead because we consider that is useless / bad performance-wise. All values will be
fetched if set to 0.
Additional optional attributes are available according to the chosen case: ``expand``
default is false. If set to false categories or filters with 0 records will be hidden.
For the ``one`` case: ``limit``
default is 200. Integer determining the maximal number of values to fetch for the field.
If the limit is reached, no values will be displayed in the search panel and an error message will
appear instead because we consider that is useless / bad performance-wise. All values will be
fetched if set to 0.
* ``hierarchize``: (only available for many2one fields) default is true. Handles the display style of categories : Additional optional attributes are available according to the chosen case:
If set to true child categories will appear under their related parent. - For the ``one`` case:
If not, all categories will be displayed on the same level.
For the ``multi`` case: .. rst-class:: o-definition-list
* ``domain``: determines conditions that the comodel records have to satisfy. ``hierarchize``
(only available for many2one fields) default is true. Handles the display style of categories :
If set to true child categories will appear under their related parent.
If not, all categories will be displayed on the same level.
- For the ``multi`` case:
.. rst-class:: o-definition-list
``domain``:
determines conditions that the comodel records have to satisfy.
A domain might be used to express a dependency on another field (with select="one") A domain might be used to express a dependency on another field (with select="one")
of the search panel. Consider of the search panel. Consider

View File

@ -666,7 +666,7 @@ header {
@extend code; @extend code;
} }
dl.py, dl.js { dl.py, dl.js, dl.o-definition-list {
> dd { > dd {
border-left: 3px solid $gray-lighter; border-left: 3px solid $gray-lighter;
margin: 0; margin: 0;