summaryrefslogtreecommitdiff
path: root/doc/reference
diff options
context:
space:
mode:
authorHiral Bhavsar <hbh@odoo.com>2019-02-04 06:18:08 +0000
committerMartin Geubelle <mge@odoo.com>2019-05-03 10:19:40 +0000
commitb2de618f9ff9969ff0644f3be10752f23d9738dc (patch)
treea7f54bb16273f3b626a96d363e0f54bf19bb4ba3 /doc/reference
parentb29d4da037fbf73717cccdfcdf76d96e5b1b009b (diff)
[IMP] base,mail: allow to customize the activity view
The activity view has been greatly improved to allow to customize it more easily. It works quite similarly to the kanban view, defining `<field>` tags at the top and using these fields in the `<template>` section. The template name used to define the activity cards is `activity-box`. Note that these activity cards are rendered using `KanbanRecord` widget (this has implied that ActivityView inherits from `BasicView`). Also note that the view validation has been moved in base to include the common grammar. Task 1894990
Diffstat (limited to 'doc/reference')
-rw-r--r--doc/reference/views.rst47
1 files changed, 36 insertions, 11 deletions
diff --git a/doc/reference/views.rst b/doc/reference/views.rst
index 767bb8bbe5b..bd81e623d63 100644
--- a/doc/reference/views.rst
+++ b/doc/reference/views.rst
@@ -478,9 +478,9 @@ system. Available semantic components are:
``field``
renders (and allow edition of, possibly) a single field of the current
- record. Using several times a field in a form view is supported and the fields
+ record. Using several times a field in a form view is supported and the fields
can receive different values for modifiers 'invisible' and 'readonly'. However,
- 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:
``name`` (mandatory)
@@ -1697,26 +1697,51 @@ Activity
The Activity view is used to display the activities linked to the records. The
data are displayed in a chart with the records forming the rows and the activity
-types the columns. When clicking on a cell, a detailed description of all
-activities of the same type for the record is displayed.
+types the columns. The first cell of each row displays a (customizable, see
+``templates``, quite similarly to :ref:`reference/views/kanban`) card representing
+the corresponding record. When clicking on others cells, a detailed description
+of all activities of the same type for the record is displayed.
.. warning::
The Activity view is only available when the ``mail`` module is installed,
and for the models that inherit from the ``mail.activity.mixin``.
-For example, here is a very simple Activity view:
-
-.. code-block:: xml
-
- <activity string="Activities"/>
-
-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:
- ``string`` (mandatory)
A title, which should describe the view
+Possible children of the view element are:
+
+``field``
+ 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.
+
+ Possible attributes are:
+
+ ``name`` (required)
+ the name of the field to fetch
+
+``templates``
+ defines the :ref:`reference/qweb` templates. Cards definition may be
+ split into multiple templates for clarity, but activity views *must* define at
+ least one root template ``activity-box``, which will be rendered once for each
+ record.
+
+ The activity view uses mostly-standard :ref:`javascript qweb
+ <reference/qweb/javascript>` and provides the following context variables
+ (see :ref:`reference/views/kanban` for more details):
+
+ ``widget``
+ the current :js:class:`ActivityRecord`, can be used to fetch some
+ meta-information. These methods are also available directly in the
+ template context and don't need to be accessed via ``widget``
+ ``record``
+ an object with all the requested fields as its attributes. Each field has
+ two attributes ``value`` and ``raw_value``
+
.. _reference/views/search:
Search