mirror of https://github.com/OCA/web.git
[IMP] web_timeline: pre-commit auto fixes
parent
8de0b1776b
commit
d9e66b6132
|
@ -17,18 +17,19 @@ Web timeline
|
||||||
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
|
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
|
||||||
:alt: License: AGPL-3
|
:alt: License: AGPL-3
|
||||||
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fweb-lightgray.png?logo=github
|
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fweb-lightgray.png?logo=github
|
||||||
:target: https://github.com/OCA/web/tree/16.0/web_timeline
|
:target: https://github.com/OCA/web/tree/17.0/web_timeline
|
||||||
:alt: OCA/web
|
:alt: OCA/web
|
||||||
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
|
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
|
||||||
:target: https://translation.odoo-community.org/projects/web-16-0/web-16-0-web_timeline
|
:target: https://translation.odoo-community.org/projects/web-17-0/web-17-0-web_timeline
|
||||||
:alt: Translate me on Weblate
|
:alt: Translate me on Weblate
|
||||||
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
|
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
|
||||||
:target: https://runboat.odoo-community.org/builds?repo=OCA/web&target_branch=16.0
|
:target: https://runboat.odoo-community.org/builds?repo=OCA/web&target_branch=17.0
|
||||||
:alt: Try me on Runboat
|
:alt: Try me on Runboat
|
||||||
|
|
||||||
|badge1| |badge2| |badge3| |badge4| |badge5|
|
|badge1| |badge2| |badge3| |badge4| |badge5|
|
||||||
|
|
||||||
Define a new view displaying events in an interactive visualization chart.
|
Define a new view displaying events in an interactive visualization
|
||||||
|
chart.
|
||||||
|
|
||||||
The widget is based on the external library
|
The widget is based on the external library
|
||||||
https://visjs.github.io/vis-timeline/examples/timeline
|
https://visjs.github.io/vis-timeline/examples/timeline
|
||||||
|
@ -41,155 +42,219 @@ https://visjs.github.io/vis-timeline/examples/timeline
|
||||||
Configuration
|
Configuration
|
||||||
=============
|
=============
|
||||||
|
|
||||||
You need to define a view with the tag <timeline> as base element. These are
|
You need to define a view with the tag <timeline> as base element. These
|
||||||
the possible attributes for the tag:
|
are the possible attributes for the tag:
|
||||||
|
|
||||||
+--------------------+-----------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
+------------------+-----------+-------------------------------------+
|
||||||
| Attribute | Required? | Description |
|
| Attribute | Required? | Description |
|
||||||
+====================+===========+===========================================================================================================================================================================================================================================================================+
|
+==================+===========+=====================================+
|
||||||
| date_start | **Yes** | Defines the name of the field of type date that contains the start of the event. |
|
| date_start | **Yes** | Defines the name of the field of |
|
||||||
+--------------------+-----------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
| | | type date that contains the start |
|
||||||
| date_stop | No | Defines the name of the field of type date that contains the end of the event. The date_stop can be equal to the attribute date_start to display events has 'point' on the Timeline (instantaneous event). |
|
| | | of the event. |
|
||||||
+--------------------+-----------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
+------------------+-----------+-------------------------------------+
|
||||||
| date_delay | No | Defines the name of the field of type float/integer that contain the duration in hours of the event, default = 1. |
|
| date_stop | No | Defines the name of the field of |
|
||||||
+--------------------+-----------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
| | | type date that contains the end of |
|
||||||
| default_group_by | **Yes** | Defines the name of the field that will be taken as default group by when accessing the view or when no other group by is selected. |
|
| | | the event. The date_stop can be |
|
||||||
+--------------------+-----------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
| | | equal to the attribute date_start |
|
||||||
| zoomKey | No | Specifies whether the Timeline is only zoomed when an additional key is down. Available values are '' (does not apply), 'altKey', 'ctrlKey', or 'metaKey'. Set this option if you want to be able to use the scroll to navigate vertically on views with a lot of events. |
|
| | | to display events has 'point' on |
|
||||||
+--------------------+-----------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
| | | the Timeline (instantaneous event). |
|
||||||
| mode | No | Specifies the initial visible window. Available values are: 'day' to display the current day, 'week', 'month' and 'fit'. Default value is 'fit' to adjust the visible window such that it fits all items. |
|
+------------------+-----------+-------------------------------------+
|
||||||
+--------------------+-----------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
| date_delay | No | Defines the name of the field of |
|
||||||
| margin | No | Specifies the margins around the items. It should respect the JSON format. For example '{"item":{"horizontal":-10}}'. Available values are: '{"axis":<number>}' (The minimal margin in pixels between items and the time axis) |
|
| | | type float/integer that contain the |
|
||||||
| | | '{"item":<number>}' (The minimal margin in pixels between items in both horizontal and vertical direction), '{"item":{"horizontal":<number>}}' (The minimal horizontal margin in pixels between items), |
|
| | | duration in hours of the event, |
|
||||||
| | | '{"item":{"vertical":<number>}}' (The minimal vertical margin in pixels between items), '{"item":{"horizontal":<number>,"vertical":<number>}}' (Combination between horizontal and vertical margins in pixels between items). |
|
| | | default = 1. |
|
||||||
+--------------------+-----------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
+------------------+-----------+-------------------------------------+
|
||||||
| event_open_popup | No | When set to true, it allows to edit the events in a popup. If not (default value), the record is edited changing to form view. |
|
| default_group_by | **Yes** | Defines the name of the field that |
|
||||||
+--------------------+-----------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
| | | will be taken as default group by |
|
||||||
| stack | No | When set to false, items will not be stacked on top of each other such that they do overlap. |
|
| | | when accessing the view or when no |
|
||||||
+--------------------+-----------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
| | | other group by is selected. |
|
||||||
| colors | No | Allows to set certain specific colors if the expressed condition (JS syntax) is met. |
|
+------------------+-----------+-------------------------------------+
|
||||||
+--------------------+-----------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
| zoomKey | No | Specifies whether the Timeline is |
|
||||||
| dependency_arrow | No | Set this attribute to a x2many field to draw arrows between the records referenced in the x2many field. |
|
| | | only zoomed when an additional key |
|
||||||
+--------------------+-----------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
| | | is down. Available values are '' |
|
||||||
|
| | | (does not apply), 'altKey', |
|
||||||
|
| | | 'ctrlKey', or 'metaKey'. Set this |
|
||||||
|
| | | option if you want to be able to |
|
||||||
|
| | | use the scroll to navigate |
|
||||||
|
| | | vertically on views with a lot of |
|
||||||
|
| | | events. |
|
||||||
|
+------------------+-----------+-------------------------------------+
|
||||||
|
| mode | No | Specifies the initial visible |
|
||||||
|
| | | window. Available values are: 'day' |
|
||||||
|
| | | to display the current day, 'week', |
|
||||||
|
| | | 'month' and 'fit'. Default value is |
|
||||||
|
| | | 'fit' to adjust the visible window |
|
||||||
|
| | | such that it fits all items. |
|
||||||
|
+------------------+-----------+-------------------------------------+
|
||||||
|
| margin | No | Specifies the margins around the |
|
||||||
|
| | | items. It should respect the JSON |
|
||||||
|
| | | format. For example |
|
||||||
|
| | | '{"item":{"horizontal":-10}}'. |
|
||||||
|
| | | Available values are: |
|
||||||
|
| | | '{"axis":<number>}' (The minimal |
|
||||||
|
| | | margin in pixels between items and |
|
||||||
|
| | | the time axis) '{"item":<number>}' |
|
||||||
|
| | | (The minimal margin in pixels |
|
||||||
|
| | | between items in both horizontal |
|
||||||
|
| | | and vertical direction), |
|
||||||
|
| | | '{"item":{"horizontal":<number>}}' |
|
||||||
|
| | | (The minimal horizontal margin in |
|
||||||
|
| | | pixels between items), |
|
||||||
|
| | | '{"item":{"vertical":<number>}}' |
|
||||||
|
| | | (The minimal vertical margin in |
|
||||||
|
| | | pixels between items), |
|
||||||
|
| | | '{"item":{"horizont |
|
||||||
|
| | | al":<number>,"vertical":<number>}}' |
|
||||||
|
| | | (Combination between horizontal and |
|
||||||
|
| | | vertical margins in pixels between |
|
||||||
|
| | | items). |
|
||||||
|
+------------------+-----------+-------------------------------------+
|
||||||
|
| event_open_popup | No | When set to true, it allows to edit |
|
||||||
|
| | | the events in a popup. If not |
|
||||||
|
| | | (default value), the record is |
|
||||||
|
| | | edited changing to form view. |
|
||||||
|
+------------------+-----------+-------------------------------------+
|
||||||
|
| stack | No | When set to false, items will not |
|
||||||
|
| | | be stacked on top of each other |
|
||||||
|
| | | such that they do overlap. |
|
||||||
|
+------------------+-----------+-------------------------------------+
|
||||||
|
| colors | No | Allows to set certain specific |
|
||||||
|
| | | colors if the expressed condition |
|
||||||
|
| | | (JS syntax) is met. |
|
||||||
|
+------------------+-----------+-------------------------------------+
|
||||||
|
| dependency_arrow | No | Set this attribute to a x2many |
|
||||||
|
| | | field to draw arrows between the |
|
||||||
|
| | | records referenced in the x2many |
|
||||||
|
| | | field. |
|
||||||
|
+------------------+-----------+-------------------------------------+
|
||||||
|
|
||||||
Optionally you can declare a custom template, which will be used to render the
|
Optionally you can declare a custom template, which will be used to
|
||||||
timeline items. You have to name the template 'timeline-item'.
|
render the timeline items. You have to name the template
|
||||||
These are the variables available in template rendering:
|
'timeline-item'. These are the variables available in template
|
||||||
|
rendering:
|
||||||
|
|
||||||
* ``record``: to access the fields values selected in the timeline definition.
|
- ``record``: to access the fields values selected in the timeline
|
||||||
* ``field_utils``: used to format and parse values (see available functions in ``web.field_utils``).
|
definition.
|
||||||
|
- ``field_utils``: used to format and parse values (see available
|
||||||
|
functions in ``web.field_utils``).
|
||||||
|
|
||||||
You also need to declare the view in an action window of the involved model.
|
You also need to declare the view in an action window of the involved
|
||||||
|
model.
|
||||||
|
|
||||||
See ``web_timeline/demo/ir_cron_view.xml`` for a very basic timeline view example added onto cron tasks.
|
See ``web_timeline/demo/ir_cron_view.xml`` for a very basic timeline
|
||||||
|
view example added onto cron tasks.
|
||||||
|
|
||||||
More evolved example, from ``project_timeline``:
|
More evolved example, from ``project_timeline``:
|
||||||
|
|
||||||
.. code-block:: xml
|
.. code:: xml
|
||||||
|
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<odoo>
|
<odoo>
|
||||||
<record id="view_task_timeline" model="ir.ui.view">
|
<record id="view_task_timeline" model="ir.ui.view">
|
||||||
<field name="model">project.task</field>
|
<field name="model">project.task</field>
|
||||||
<field name="type">timeline</field>
|
<field name="type">timeline</field>
|
||||||
<field name="arch" type="xml">
|
<field name="arch" type="xml">
|
||||||
<timeline date_start="date_assign"
|
<timeline date_start="date_assign"
|
||||||
date_stop="date_end"
|
date_stop="date_end"
|
||||||
string="Tasks"
|
string="Tasks"
|
||||||
default_group_by="project_id"
|
default_group_by="project_id"
|
||||||
event_open_popup="true"
|
event_open_popup="true"
|
||||||
colors="white: user_ids == []; #2ecb71: kanban_state == 'done'; #ec7063: kanban_state == 'blocked'"
|
colors="white: user_ids == []; #2ecb71: kanban_state == 'done'; #ec7063: kanban_state == 'blocked'"
|
||||||
dependency_arrow="depend_on_ids"
|
dependency_arrow="depend_on_ids"
|
||||||
>
|
>
|
||||||
<field name="user_ids" />
|
<field name="user_ids" />
|
||||||
<field name="planned_hours" />
|
<field name="planned_hours" />
|
||||||
<templates>
|
<templates>
|
||||||
<t t-name="timeline-item">
|
<t t-name="timeline-item">
|
||||||
<div class="o_project_timeline_item">
|
<div class="o_project_timeline_item">
|
||||||
<t t-foreach="record.user_ids" t-as="user">
|
<t t-foreach="record.user_ids" t-as="user">
|
||||||
<img
|
<img
|
||||||
t-if="record.user_ids"
|
t-if="record.user_ids"
|
||||||
t-attf-src="/web/image/res.users/#{user}/image_128/16x16"
|
t-attf-src="/web/image/res.users/#{user}/image_128/16x16"
|
||||||
t-att-title="record.user"
|
t-att-title="record.user"
|
||||||
width="16"
|
width="16"
|
||||||
height="16"
|
height="16"
|
||||||
class="mr8"
|
class="mr8"
|
||||||
alt="User"
|
alt="User"
|
||||||
/>
|
/>
|
||||||
</t>
|
</t>
|
||||||
<span name="display_name">
|
<span name="display_name">
|
||||||
<t t-esc="record.display_name" />
|
<t t-esc="record.display_name" />
|
||||||
</span>
|
</span>
|
||||||
<small
|
<small
|
||||||
name="planned_hours"
|
name="planned_hours"
|
||||||
class="text-info ml4"
|
class="text-info ml4"
|
||||||
t-if="record.planned_hours"
|
t-if="record.planned_hours"
|
||||||
>
|
>
|
||||||
<t
|
<t
|
||||||
t-esc="field_utils.format.float_time(record.planned_hours)"
|
t-esc="field_utils.format.float_time(record.planned_hours)"
|
||||||
/>
|
/>
|
||||||
</small>
|
</small>
|
||||||
</div>
|
</div>
|
||||||
</t>
|
</t>
|
||||||
</templates>
|
</templates>
|
||||||
</timeline>
|
</timeline>
|
||||||
</field>
|
</field>
|
||||||
</record>
|
</record>
|
||||||
|
|
||||||
<record id="project.action_view_task" model="ir.actions.act_window">
|
<record id="project.action_view_task" model="ir.actions.act_window">
|
||||||
<field
|
<field
|
||||||
name="view_mode"
|
name="view_mode"
|
||||||
>kanban,tree,form,calendar,timeline,pivot,graph,activity</field>
|
>kanban,tree,form,calendar,timeline,pivot,graph,activity</field>
|
||||||
</record>
|
</record>
|
||||||
</odoo>
|
</odoo>
|
||||||
|
|
||||||
Usage
|
Usage
|
||||||
=====
|
=====
|
||||||
|
|
||||||
For accessing the timeline view, you have to click on the button with the clock
|
For accessing the timeline view, you have to click on the button with
|
||||||
icon in the view switcher. The first time you access to it, the timeline window
|
the clock icon in the view switcher. The first time you access to it,
|
||||||
is zoomed to fit all the current elements, the same as when you perform a
|
the timeline window is zoomed to fit all the current elements, the same
|
||||||
search, filter or group by operation.
|
as when you perform a search, filter or group by operation.
|
||||||
|
|
||||||
You can use the mouse scroll to zoom in or out in the timeline, and click on
|
You can use the mouse scroll to zoom in or out in the timeline, and
|
||||||
any free area and drag for panning the view in that direction.
|
click on any free area and drag for panning the view in that direction.
|
||||||
|
|
||||||
The records of your model will be shown as rectangles whose widths are the
|
The records of your model will be shown as rectangles whose widths are
|
||||||
duration of the event according our definition. You can select them clicking
|
the duration of the event according our definition. You can select them
|
||||||
on this rectangle. You can also use Ctrl or Shift keys for adding discrete
|
clicking on this rectangle. You can also use Ctrl or Shift keys for
|
||||||
or range selections. Selected records are hightlighted with a different color
|
adding discrete or range selections. Selected records are hightlighted
|
||||||
(but the difference will be more noticeable depending on the background color).
|
with a different color (but the difference will be more noticeable
|
||||||
Once selected, you can drag and move the selected records across the timeline.
|
depending on the background color). Once selected, you can drag and move
|
||||||
|
the selected records across the timeline.
|
||||||
|
|
||||||
When a record is selected, a red cross button appears on the upper left corner
|
When a record is selected, a red cross button appears on the upper left
|
||||||
that allows to remove that record. This doesn't work for multiple records
|
corner that allows to remove that record. This doesn't work for multiple
|
||||||
although they were selected.
|
records although they were selected.
|
||||||
|
|
||||||
Records are grouped in different blocks depending on the group by criteria
|
Records are grouped in different blocks depending on the group by
|
||||||
selected (if none is specified, then the default group by is applied).
|
criteria selected (if none is specified, then the default group by is
|
||||||
Dragging a record from one block to another change the corresponding field to
|
applied). Dragging a record from one block to another change the
|
||||||
the value that represents the block. You can also click on the group name to
|
corresponding field to the value that represents the block. You can also
|
||||||
edit the involved record directly.
|
click on the group name to edit the involved record directly.
|
||||||
|
|
||||||
Double-click on the record to edit it. Double-click in open area to create a
|
Double-click on the record to edit it. Double-click in open area to
|
||||||
new record with the group and start date linked to the area you clicked in.
|
create a new record with the group and start date linked to the area you
|
||||||
By holding the Ctrl key and dragging left to right, you can create a new record
|
clicked in. By holding the Ctrl key and dragging left to right, you can
|
||||||
with the dragged start and end date.
|
create a new record with the dragged start and end date.
|
||||||
|
|
||||||
Known issues / Roadmap
|
Known issues / Roadmap
|
||||||
======================
|
======================
|
||||||
|
|
||||||
* Implement a more efficient way of refreshing timeline after a record update;
|
- Implement a more efficient way of refreshing timeline after a record
|
||||||
* Make ``attrs`` attribute work;
|
update;
|
||||||
* When grouping by m2m and more than one record is set, the timeline item appears only
|
- Make ``attrs`` attribute work;
|
||||||
on one group. Allow showing in both groups.
|
- When grouping by m2m and more than one record is set, the timeline
|
||||||
* When grouping by m2m and dragging for changing the time or the group, the changes on
|
item appears only on one group. Allow showing in both groups.
|
||||||
the group will not be set, because it could make disappear the records not related
|
- When grouping by m2m and dragging for changing the time or the group,
|
||||||
with the changes that we want to make. When the item is showed in all groups change
|
the changes on the group will not be set, because it could make
|
||||||
the value according the group of the dragged item.
|
disappear the records not related with the changes that we want to
|
||||||
* When an item label does not fit in its date-range box: ✅ the label correctly overflows
|
make. When the item is showed in all groups change the value
|
||||||
the box; ✅ clicking anywhere on the label allows moving the box; ❌ double-clicking
|
according the group of the dragged item.
|
||||||
the label outside of the box does not open that item.
|
- When an item label does not fit in its date-range box: ✅ the label
|
||||||
|
correctly overflows the box; ✅ clicking anywhere on the label allows
|
||||||
|
moving the box; ❌ double-clicking the label outside of the box does
|
||||||
|
not open that item.
|
||||||
|
|
||||||
Bug Tracker
|
Bug Tracker
|
||||||
===========
|
===========
|
||||||
|
@ -197,7 +262,7 @@ Bug Tracker
|
||||||
Bugs are tracked on `GitHub Issues <https://github.com/OCA/web/issues>`_.
|
Bugs are tracked on `GitHub Issues <https://github.com/OCA/web/issues>`_.
|
||||||
In case of trouble, please check there if your issue has already been reported.
|
In case of trouble, please check there if your issue has already been reported.
|
||||||
If you spotted it first, help us to smash it by providing a detailed and welcomed
|
If you spotted it first, help us to smash it by providing a detailed and welcomed
|
||||||
`feedback <https://github.com/OCA/web/issues/new?body=module:%20web_timeline%0Aversion:%2016.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
|
`feedback <https://github.com/OCA/web/issues/new?body=module:%20web_timeline%0Aversion:%2017.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
|
||||||
|
|
||||||
Do not contact contributors directly about support or help with technical issues.
|
Do not contact contributors directly about support or help with technical issues.
|
||||||
|
|
||||||
|
@ -205,7 +270,7 @@ Credits
|
||||||
=======
|
=======
|
||||||
|
|
||||||
Authors
|
Authors
|
||||||
~~~~~~~
|
-------
|
||||||
|
|
||||||
* ACSONE SA/NV
|
* ACSONE SA/NV
|
||||||
* Tecnativa
|
* Tecnativa
|
||||||
|
@ -214,32 +279,32 @@ Authors
|
||||||
* Trobz
|
* Trobz
|
||||||
|
|
||||||
Contributors
|
Contributors
|
||||||
~~~~~~~~~~~~
|
------------
|
||||||
|
|
||||||
* Laurent Mignon <laurent.mignon@acsone.eu>
|
- Laurent Mignon <laurent.mignon@acsone.eu>
|
||||||
* Adrien Peiffer <adrien.peiffer@acsone.eu>
|
- Adrien Peiffer <adrien.peiffer@acsone.eu>
|
||||||
* Leonardo Donelli <donelli@webmonks.it>
|
- Leonardo Donelli <donelli@webmonks.it>
|
||||||
* Adrien Didenot <adrien.didenot@horanet.com>
|
- Adrien Didenot <adrien.didenot@horanet.com>
|
||||||
* Thong Nguyen Van <thongnv@trobz.com>
|
- Thong Nguyen Van <thongnv@trobz.com>
|
||||||
* Murtaza Mithaiwala <mmithaiwala@opensourceintegrators.com>
|
- Murtaza Mithaiwala <mmithaiwala@opensourceintegrators.com>
|
||||||
* Ammar Officewala <aofficewala@opensourceintegrators.com>
|
- Ammar Officewala <aofficewala@opensourceintegrators.com>
|
||||||
* `Tecnativa <https://www.tecnativa.com>`_:
|
- `Tecnativa <https://www.tecnativa.com>`__:
|
||||||
|
|
||||||
* Pedro M. Baeza
|
- Pedro M. Baeza
|
||||||
* Alexandre Díaz
|
- Alexandre Díaz
|
||||||
* César A. Sánchez
|
- César A. Sánchez
|
||||||
|
|
||||||
* `Onestein <https://www.onestein.nl>`_:
|
- `Onestein <https://www.onestein.nl>`__:
|
||||||
|
|
||||||
* Dennis Sluijk <d.sluijk@onestein.nl>
|
- Dennis Sluijk <d.sluijk@onestein.nl>
|
||||||
* Anjeel Haria
|
- Anjeel Haria
|
||||||
|
|
||||||
* `XCG Consulting <https://xcg-consulting.fr>`_:
|
- `XCG Consulting <https://xcg-consulting.fr>`__:
|
||||||
|
|
||||||
* Houzéfa Abbasbhay
|
- Houzéfa Abbasbhay
|
||||||
|
|
||||||
Maintainers
|
Maintainers
|
||||||
~~~~~~~~~~~
|
-----------
|
||||||
|
|
||||||
This module is maintained by the OCA.
|
This module is maintained by the OCA.
|
||||||
|
|
||||||
|
@ -259,6 +324,6 @@ Current `maintainer <https://odoo-community.org/page/maintainer-role>`__:
|
||||||
|
|
||||||
|maintainer-tarteo|
|
|maintainer-tarteo|
|
||||||
|
|
||||||
This module is part of the `OCA/web <https://github.com/OCA/web/tree/16.0/web_timeline>`_ project on GitHub.
|
This module is part of the `OCA/web <https://github.com/OCA/web/tree/17.0/web_timeline>`_ project on GitHub.
|
||||||
|
|
||||||
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
|
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
|
||||||
|
|
|
@ -0,0 +1,3 @@
|
||||||
|
[build-system]
|
||||||
|
requires = ["whool"]
|
||||||
|
build-backend = "whool.buildapi"
|
|
@ -0,0 +1,92 @@
|
||||||
|
You need to define a view with the tag \<timeline\> as base element.
|
||||||
|
These are the possible attributes for the tag:
|
||||||
|
|
||||||
|
| Attribute | Required? | Description |
|
||||||
|
|----|----|----|
|
||||||
|
| date_start | **Yes** | Defines the name of the field of type date that contains the start of the event. |
|
||||||
|
| date_stop | No | Defines the name of the field of type date that contains the end of the event. The date_stop can be equal to the attribute date_start to display events has 'point' on the Timeline (instantaneous event). |
|
||||||
|
| date_delay | No | Defines the name of the field of type float/integer that contain the duration in hours of the event, default = 1. |
|
||||||
|
| default_group_by | **Yes** | Defines the name of the field that will be taken as default group by when accessing the view or when no other group by is selected. |
|
||||||
|
| zoomKey | No | Specifies whether the Timeline is only zoomed when an additional key is down. Available values are '' (does not apply), 'altKey', 'ctrlKey', or 'metaKey'. Set this option if you want to be able to use the scroll to navigate vertically on views with a lot of events. |
|
||||||
|
| mode | No | Specifies the initial visible window. Available values are: 'day' to display the current day, 'week', 'month' and 'fit'. Default value is 'fit' to adjust the visible window such that it fits all items. |
|
||||||
|
| margin | No | Specifies the margins around the items. It should respect the JSON format. For example '{"item":{"horizontal":-10}}'. Available values are: '{"axis":\<number\>}' (The minimal margin in pixels between items and the time axis) '{"item":\<number\>}' (The minimal margin in pixels between items in both horizontal and vertical direction), '{"item":{"horizontal":\<number\>}}' (The minimal horizontal margin in pixels between items), '{"item":{"vertical":\<number\>}}' (The minimal vertical margin in pixels between items), '{"item":{"horizontal":\<number\>,"vertical":\<number\>}}' (Combination between horizontal and vertical margins in pixels between items). |
|
||||||
|
| event_open_popup | No | When set to true, it allows to edit the events in a popup. If not (default value), the record is edited changing to form view. |
|
||||||
|
| stack | No | When set to false, items will not be stacked on top of each other such that they do overlap. |
|
||||||
|
| colors | No | Allows to set certain specific colors if the expressed condition (JS syntax) is met. |
|
||||||
|
| dependency_arrow | No | Set this attribute to a x2many field to draw arrows between the records referenced in the x2many field. |
|
||||||
|
|
||||||
|
Optionally you can declare a custom template, which will be used to
|
||||||
|
render the timeline items. You have to name the template
|
||||||
|
'timeline-item'. These are the variables available in template
|
||||||
|
rendering:
|
||||||
|
|
||||||
|
- `record`: to access the fields values selected in the timeline
|
||||||
|
definition.
|
||||||
|
- `field_utils`: used to format and parse values (see available
|
||||||
|
functions in `web.field_utils`).
|
||||||
|
|
||||||
|
You also need to declare the view in an action window of the involved
|
||||||
|
model.
|
||||||
|
|
||||||
|
See `web_timeline/demo/ir_cron_view.xml` for a very basic timeline view
|
||||||
|
example added onto cron tasks.
|
||||||
|
|
||||||
|
More evolved example, from `project_timeline`:
|
||||||
|
|
||||||
|
``` xml
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<odoo>
|
||||||
|
<record id="view_task_timeline" model="ir.ui.view">
|
||||||
|
<field name="model">project.task</field>
|
||||||
|
<field name="type">timeline</field>
|
||||||
|
<field name="arch" type="xml">
|
||||||
|
<timeline date_start="date_assign"
|
||||||
|
date_stop="date_end"
|
||||||
|
string="Tasks"
|
||||||
|
default_group_by="project_id"
|
||||||
|
event_open_popup="true"
|
||||||
|
colors="white: user_ids == []; #2ecb71: kanban_state == 'done'; #ec7063: kanban_state == 'blocked'"
|
||||||
|
dependency_arrow="depend_on_ids"
|
||||||
|
>
|
||||||
|
<field name="user_ids" />
|
||||||
|
<field name="planned_hours" />
|
||||||
|
<templates>
|
||||||
|
<t t-name="timeline-item">
|
||||||
|
<div class="o_project_timeline_item">
|
||||||
|
<t t-foreach="record.user_ids" t-as="user">
|
||||||
|
<img
|
||||||
|
t-if="record.user_ids"
|
||||||
|
t-attf-src="/web/image/res.users/#{user}/image_128/16x16"
|
||||||
|
t-att-title="record.user"
|
||||||
|
width="16"
|
||||||
|
height="16"
|
||||||
|
class="mr8"
|
||||||
|
alt="User"
|
||||||
|
/>
|
||||||
|
</t>
|
||||||
|
<span name="display_name">
|
||||||
|
<t t-esc="record.display_name" />
|
||||||
|
</span>
|
||||||
|
<small
|
||||||
|
name="planned_hours"
|
||||||
|
class="text-info ml4"
|
||||||
|
t-if="record.planned_hours"
|
||||||
|
>
|
||||||
|
<t
|
||||||
|
t-esc="field_utils.format.float_time(record.planned_hours)"
|
||||||
|
/>
|
||||||
|
</small>
|
||||||
|
</div>
|
||||||
|
</t>
|
||||||
|
</templates>
|
||||||
|
</timeline>
|
||||||
|
</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record id="project.action_view_task" model="ir.actions.act_window">
|
||||||
|
<field
|
||||||
|
name="view_mode"
|
||||||
|
>kanban,tree,form,calendar,timeline,pivot,graph,activity</field>
|
||||||
|
</record>
|
||||||
|
</odoo>
|
||||||
|
```
|
|
@ -1,101 +0,0 @@
|
||||||
You need to define a view with the tag <timeline> as base element. These are
|
|
||||||
the possible attributes for the tag:
|
|
||||||
|
|
||||||
+--------------------+-----------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
||||||
| Attribute | Required? | Description |
|
|
||||||
+====================+===========+===========================================================================================================================================================================================================================================================================+
|
|
||||||
| date_start | **Yes** | Defines the name of the field of type date that contains the start of the event. |
|
|
||||||
+--------------------+-----------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
||||||
| date_stop | No | Defines the name of the field of type date that contains the end of the event. The date_stop can be equal to the attribute date_start to display events has 'point' on the Timeline (instantaneous event). |
|
|
||||||
+--------------------+-----------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
||||||
| date_delay | No | Defines the name of the field of type float/integer that contain the duration in hours of the event, default = 1. |
|
|
||||||
+--------------------+-----------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
||||||
| default_group_by | **Yes** | Defines the name of the field that will be taken as default group by when accessing the view or when no other group by is selected. |
|
|
||||||
+--------------------+-----------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
||||||
| zoomKey | No | Specifies whether the Timeline is only zoomed when an additional key is down. Available values are '' (does not apply), 'altKey', 'ctrlKey', or 'metaKey'. Set this option if you want to be able to use the scroll to navigate vertically on views with a lot of events. |
|
|
||||||
+--------------------+-----------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
||||||
| mode | No | Specifies the initial visible window. Available values are: 'day' to display the current day, 'week', 'month' and 'fit'. Default value is 'fit' to adjust the visible window such that it fits all items. |
|
|
||||||
+--------------------+-----------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
||||||
| margin | No | Specifies the margins around the items. It should respect the JSON format. For example '{"item":{"horizontal":-10}}'. Available values are: '{"axis":<number>}' (The minimal margin in pixels between items and the time axis) |
|
|
||||||
| | | '{"item":<number>}' (The minimal margin in pixels between items in both horizontal and vertical direction), '{"item":{"horizontal":<number>}}' (The minimal horizontal margin in pixels between items), |
|
|
||||||
| | | '{"item":{"vertical":<number>}}' (The minimal vertical margin in pixels between items), '{"item":{"horizontal":<number>,"vertical":<number>}}' (Combination between horizontal and vertical margins in pixels between items). |
|
|
||||||
+--------------------+-----------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
||||||
| event_open_popup | No | When set to true, it allows to edit the events in a popup. If not (default value), the record is edited changing to form view. |
|
|
||||||
+--------------------+-----------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
||||||
| stack | No | When set to false, items will not be stacked on top of each other such that they do overlap. |
|
|
||||||
+--------------------+-----------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
||||||
| colors | No | Allows to set certain specific colors if the expressed condition (JS syntax) is met. |
|
|
||||||
+--------------------+-----------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
||||||
| dependency_arrow | No | Set this attribute to a x2many field to draw arrows between the records referenced in the x2many field. |
|
|
||||||
+--------------------+-----------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
||||||
|
|
||||||
Optionally you can declare a custom template, which will be used to render the
|
|
||||||
timeline items. You have to name the template 'timeline-item'.
|
|
||||||
These are the variables available in template rendering:
|
|
||||||
|
|
||||||
* ``record``: to access the fields values selected in the timeline definition.
|
|
||||||
* ``field_utils``: used to format and parse values (see available functions in ``web.field_utils``).
|
|
||||||
|
|
||||||
You also need to declare the view in an action window of the involved model.
|
|
||||||
|
|
||||||
See ``web_timeline/demo/ir_cron_view.xml`` for a very basic timeline view example added onto cron tasks.
|
|
||||||
|
|
||||||
More evolved example, from ``project_timeline``:
|
|
||||||
|
|
||||||
.. code-block:: xml
|
|
||||||
|
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<odoo>
|
|
||||||
<record id="view_task_timeline" model="ir.ui.view">
|
|
||||||
<field name="model">project.task</field>
|
|
||||||
<field name="type">timeline</field>
|
|
||||||
<field name="arch" type="xml">
|
|
||||||
<timeline date_start="date_assign"
|
|
||||||
date_stop="date_end"
|
|
||||||
string="Tasks"
|
|
||||||
default_group_by="project_id"
|
|
||||||
event_open_popup="true"
|
|
||||||
colors="white: user_ids == []; #2ecb71: kanban_state == 'done'; #ec7063: kanban_state == 'blocked'"
|
|
||||||
dependency_arrow="depend_on_ids"
|
|
||||||
>
|
|
||||||
<field name="user_ids" />
|
|
||||||
<field name="planned_hours" />
|
|
||||||
<templates>
|
|
||||||
<t t-name="timeline-item">
|
|
||||||
<div class="o_project_timeline_item">
|
|
||||||
<t t-foreach="record.user_ids" t-as="user">
|
|
||||||
<img
|
|
||||||
t-if="record.user_ids"
|
|
||||||
t-attf-src="/web/image/res.users/#{user}/image_128/16x16"
|
|
||||||
t-att-title="record.user"
|
|
||||||
width="16"
|
|
||||||
height="16"
|
|
||||||
class="mr8"
|
|
||||||
alt="User"
|
|
||||||
/>
|
|
||||||
</t>
|
|
||||||
<span name="display_name">
|
|
||||||
<t t-esc="record.display_name" />
|
|
||||||
</span>
|
|
||||||
<small
|
|
||||||
name="planned_hours"
|
|
||||||
class="text-info ml4"
|
|
||||||
t-if="record.planned_hours"
|
|
||||||
>
|
|
||||||
<t
|
|
||||||
t-esc="field_utils.format.float_time(record.planned_hours)"
|
|
||||||
/>
|
|
||||||
</small>
|
|
||||||
</div>
|
|
||||||
</t>
|
|
||||||
</templates>
|
|
||||||
</timeline>
|
|
||||||
</field>
|
|
||||||
</record>
|
|
||||||
|
|
||||||
<record id="project.action_view_task" model="ir.actions.act_window">
|
|
||||||
<field
|
|
||||||
name="view_mode"
|
|
||||||
>kanban,tree,form,calendar,timeline,pivot,graph,activity</field>
|
|
||||||
</record>
|
|
||||||
</odoo>
|
|
|
@ -0,0 +1,16 @@
|
||||||
|
- Laurent Mignon \<<laurent.mignon@acsone.eu>\>
|
||||||
|
- Adrien Peiffer \<<adrien.peiffer@acsone.eu>\>
|
||||||
|
- Leonardo Donelli \<<donelli@webmonks.it>\>
|
||||||
|
- Adrien Didenot \<<adrien.didenot@horanet.com>\>
|
||||||
|
- Thong Nguyen Van \<<thongnv@trobz.com>\>
|
||||||
|
- Murtaza Mithaiwala \<<mmithaiwala@opensourceintegrators.com>\>
|
||||||
|
- Ammar Officewala \<<aofficewala@opensourceintegrators.com>\>
|
||||||
|
- [Tecnativa](https://www.tecnativa.com):
|
||||||
|
- Pedro M. Baeza
|
||||||
|
- Alexandre Díaz
|
||||||
|
- César A. Sánchez
|
||||||
|
- [Onestein](https://www.onestein.nl):
|
||||||
|
- Dennis Sluijk \<<d.sluijk@onestein.nl>\>
|
||||||
|
- Anjeel Haria
|
||||||
|
- [XCG Consulting](https://xcg-consulting.fr):
|
||||||
|
- Houzéfa Abbasbhay
|
|
@ -1,21 +0,0 @@
|
||||||
* Laurent Mignon <laurent.mignon@acsone.eu>
|
|
||||||
* Adrien Peiffer <adrien.peiffer@acsone.eu>
|
|
||||||
* Leonardo Donelli <donelli@webmonks.it>
|
|
||||||
* Adrien Didenot <adrien.didenot@horanet.com>
|
|
||||||
* Thong Nguyen Van <thongnv@trobz.com>
|
|
||||||
* Murtaza Mithaiwala <mmithaiwala@opensourceintegrators.com>
|
|
||||||
* Ammar Officewala <aofficewala@opensourceintegrators.com>
|
|
||||||
* `Tecnativa <https://www.tecnativa.com>`_:
|
|
||||||
|
|
||||||
* Pedro M. Baeza
|
|
||||||
* Alexandre Díaz
|
|
||||||
* César A. Sánchez
|
|
||||||
|
|
||||||
* `Onestein <https://www.onestein.nl>`_:
|
|
||||||
|
|
||||||
* Dennis Sluijk <d.sluijk@onestein.nl>
|
|
||||||
* Anjeel Haria
|
|
||||||
|
|
||||||
* `XCG Consulting <https://xcg-consulting.fr>`_:
|
|
||||||
|
|
||||||
* Houzéfa Abbasbhay
|
|
|
@ -1,4 +1,5 @@
|
||||||
Define a new view displaying events in an interactive visualization chart.
|
Define a new view displaying events in an interactive visualization
|
||||||
|
chart.
|
||||||
|
|
||||||
The widget is based on the external library
|
The widget is based on the external library
|
||||||
https://visjs.github.io/vis-timeline/examples/timeline
|
<https://visjs.github.io/vis-timeline/examples/timeline>
|
|
@ -0,0 +1,14 @@
|
||||||
|
- Implement a more efficient way of refreshing timeline after a record
|
||||||
|
update;
|
||||||
|
- Make `attrs` attribute work;
|
||||||
|
- When grouping by m2m and more than one record is set, the timeline
|
||||||
|
item appears only on one group. Allow showing in both groups.
|
||||||
|
- When grouping by m2m and dragging for changing the time or the group,
|
||||||
|
the changes on the group will not be set, because it could make
|
||||||
|
disappear the records not related with the changes that we want to
|
||||||
|
make. When the item is showed in all groups change the value according
|
||||||
|
the group of the dragged item.
|
||||||
|
- When an item label does not fit in its date-range box: ✅ the label
|
||||||
|
correctly overflows the box; ✅ clicking anywhere on the label allows
|
||||||
|
moving the box; ❌ double-clicking the label outside of the box does
|
||||||
|
not open that item.
|
|
@ -1,11 +0,0 @@
|
||||||
* Implement a more efficient way of refreshing timeline after a record update;
|
|
||||||
* Make ``attrs`` attribute work;
|
|
||||||
* When grouping by m2m and more than one record is set, the timeline item appears only
|
|
||||||
on one group. Allow showing in both groups.
|
|
||||||
* When grouping by m2m and dragging for changing the time or the group, the changes on
|
|
||||||
the group will not be set, because it could make disappear the records not related
|
|
||||||
with the changes that we want to make. When the item is showed in all groups change
|
|
||||||
the value according the group of the dragged item.
|
|
||||||
* When an item label does not fit in its date-range box: ✅ the label correctly overflows
|
|
||||||
the box; ✅ clicking anywhere on the label allows moving the box; ❌ double-clicking
|
|
||||||
the label outside of the box does not open that item.
|
|
|
@ -0,0 +1,30 @@
|
||||||
|
For accessing the timeline view, you have to click on the button with
|
||||||
|
the clock icon in the view switcher. The first time you access to it,
|
||||||
|
the timeline window is zoomed to fit all the current elements, the same
|
||||||
|
as when you perform a search, filter or group by operation.
|
||||||
|
|
||||||
|
You can use the mouse scroll to zoom in or out in the timeline, and
|
||||||
|
click on any free area and drag for panning the view in that direction.
|
||||||
|
|
||||||
|
The records of your model will be shown as rectangles whose widths are
|
||||||
|
the duration of the event according our definition. You can select them
|
||||||
|
clicking on this rectangle. You can also use Ctrl or Shift keys for
|
||||||
|
adding discrete or range selections. Selected records are hightlighted
|
||||||
|
with a different color (but the difference will be more noticeable
|
||||||
|
depending on the background color). Once selected, you can drag and move
|
||||||
|
the selected records across the timeline.
|
||||||
|
|
||||||
|
When a record is selected, a red cross button appears on the upper left
|
||||||
|
corner that allows to remove that record. This doesn't work for multiple
|
||||||
|
records although they were selected.
|
||||||
|
|
||||||
|
Records are grouped in different blocks depending on the group by
|
||||||
|
criteria selected (if none is specified, then the default group by is
|
||||||
|
applied). Dragging a record from one block to another change the
|
||||||
|
corresponding field to the value that represents the block. You can also
|
||||||
|
click on the group name to edit the involved record directly.
|
||||||
|
|
||||||
|
Double-click on the record to edit it. Double-click in open area to
|
||||||
|
create a new record with the group and start date linked to the area you
|
||||||
|
clicked in. By holding the Ctrl key and dragging left to right, you can
|
||||||
|
create a new record with the dragged start and end date.
|
|
@ -1,29 +0,0 @@
|
||||||
For accessing the timeline view, you have to click on the button with the clock
|
|
||||||
icon in the view switcher. The first time you access to it, the timeline window
|
|
||||||
is zoomed to fit all the current elements, the same as when you perform a
|
|
||||||
search, filter or group by operation.
|
|
||||||
|
|
||||||
You can use the mouse scroll to zoom in or out in the timeline, and click on
|
|
||||||
any free area and drag for panning the view in that direction.
|
|
||||||
|
|
||||||
The records of your model will be shown as rectangles whose widths are the
|
|
||||||
duration of the event according our definition. You can select them clicking
|
|
||||||
on this rectangle. You can also use Ctrl or Shift keys for adding discrete
|
|
||||||
or range selections. Selected records are hightlighted with a different color
|
|
||||||
(but the difference will be more noticeable depending on the background color).
|
|
||||||
Once selected, you can drag and move the selected records across the timeline.
|
|
||||||
|
|
||||||
When a record is selected, a red cross button appears on the upper left corner
|
|
||||||
that allows to remove that record. This doesn't work for multiple records
|
|
||||||
although they were selected.
|
|
||||||
|
|
||||||
Records are grouped in different blocks depending on the group by criteria
|
|
||||||
selected (if none is specified, then the default group by is applied).
|
|
||||||
Dragging a record from one block to another change the corresponding field to
|
|
||||||
the value that represents the block. You can also click on the group name to
|
|
||||||
edit the involved record directly.
|
|
||||||
|
|
||||||
Double-click on the record to edit it. Double-click in open area to create a
|
|
||||||
new record with the group and start date linked to the area you clicked in.
|
|
||||||
By holding the Ctrl key and dragging left to right, you can create a new record
|
|
||||||
with the dragged start and end date.
|
|
|
@ -369,8 +369,9 @@ ul.auto-toc {
|
||||||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||||
!! source digest: sha256:de40cea8c12ae858a82a28ad5fae3c70c75def8b5b12311ed124973ec7da15c9
|
!! source digest: sha256:de40cea8c12ae858a82a28ad5fae3c70c75def8b5b12311ed124973ec7da15c9
|
||||||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
|
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
|
||||||
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Production/Stable" src="https://img.shields.io/badge/maturity-Production%2FStable-green.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/web/tree/16.0/web_timeline"><img alt="OCA/web" src="https://img.shields.io/badge/github-OCA%2Fweb-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/web-16-0/web-16-0-web_timeline"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/web&target_branch=16.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
|
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Production/Stable" src="https://img.shields.io/badge/maturity-Production%2FStable-green.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/web/tree/17.0/web_timeline"><img alt="OCA/web" src="https://img.shields.io/badge/github-OCA%2Fweb-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/web-17-0/web-17-0-web_timeline"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/web&target_branch=17.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
|
||||||
<p>Define a new view displaying events in an interactive visualization chart.</p>
|
<p>Define a new view displaying events in an interactive visualization
|
||||||
|
chart.</p>
|
||||||
<p>The widget is based on the external library
|
<p>The widget is based on the external library
|
||||||
<a class="reference external" href="https://visjs.github.io/vis-timeline/examples/timeline">https://visjs.github.io/vis-timeline/examples/timeline</a></p>
|
<a class="reference external" href="https://visjs.github.io/vis-timeline/examples/timeline">https://visjs.github.io/vis-timeline/examples/timeline</a></p>
|
||||||
<p><strong>Table of contents</strong></p>
|
<p><strong>Table of contents</strong></p>
|
||||||
|
@ -390,13 +391,13 @@ ul.auto-toc {
|
||||||
</div>
|
</div>
|
||||||
<div class="section" id="configuration">
|
<div class="section" id="configuration">
|
||||||
<h1><a class="toc-backref" href="#toc-entry-1">Configuration</a></h1>
|
<h1><a class="toc-backref" href="#toc-entry-1">Configuration</a></h1>
|
||||||
<p>You need to define a view with the tag <timeline> as base element. These are
|
<p>You need to define a view with the tag <timeline> as base element. These
|
||||||
the possible attributes for the tag:</p>
|
are the possible attributes for the tag:</p>
|
||||||
<table border="1" class="docutils">
|
<table border="1" class="docutils">
|
||||||
<colgroup>
|
<colgroup>
|
||||||
<col width="7%" />
|
<col width="27%" />
|
||||||
<col width="4%" />
|
<col width="17%" />
|
||||||
<col width="90%" />
|
<col width="56%" />
|
||||||
</colgroup>
|
</colgroup>
|
||||||
<thead valign="bottom">
|
<thead valign="bottom">
|
||||||
<tr><th class="head">Attribute</th>
|
<tr><th class="head">Attribute</th>
|
||||||
|
@ -407,61 +408,121 @@ the possible attributes for the tag:</p>
|
||||||
<tbody valign="top">
|
<tbody valign="top">
|
||||||
<tr><td>date_start</td>
|
<tr><td>date_start</td>
|
||||||
<td><strong>Yes</strong></td>
|
<td><strong>Yes</strong></td>
|
||||||
<td>Defines the name of the field of type date that contains the start of the event.</td>
|
<td>Defines the name of the field of
|
||||||
|
type date that contains the start
|
||||||
|
of the event.</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr><td>date_stop</td>
|
<tr><td>date_stop</td>
|
||||||
<td>No</td>
|
<td>No</td>
|
||||||
<td>Defines the name of the field of type date that contains the end of the event. The date_stop can be equal to the attribute date_start to display events has ‘point’ on the Timeline (instantaneous event).</td>
|
<td>Defines the name of the field of
|
||||||
|
type date that contains the end of
|
||||||
|
the event. The date_stop can be
|
||||||
|
equal to the attribute date_start
|
||||||
|
to display events has ‘point’ on
|
||||||
|
the Timeline (instantaneous event).</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr><td>date_delay</td>
|
<tr><td>date_delay</td>
|
||||||
<td>No</td>
|
<td>No</td>
|
||||||
<td>Defines the name of the field of type float/integer that contain the duration in hours of the event, default = 1.</td>
|
<td>Defines the name of the field of
|
||||||
|
type float/integer that contain the
|
||||||
|
duration in hours of the event,
|
||||||
|
default = 1.</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr><td>default_group_by</td>
|
<tr><td>default_group_by</td>
|
||||||
<td><strong>Yes</strong></td>
|
<td><strong>Yes</strong></td>
|
||||||
<td>Defines the name of the field that will be taken as default group by when accessing the view or when no other group by is selected.</td>
|
<td>Defines the name of the field that
|
||||||
|
will be taken as default group by
|
||||||
|
when accessing the view or when no
|
||||||
|
other group by is selected.</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr><td>zoomKey</td>
|
<tr><td>zoomKey</td>
|
||||||
<td>No</td>
|
<td>No</td>
|
||||||
<td>Specifies whether the Timeline is only zoomed when an additional key is down. Available values are ‘’ (does not apply), ‘altKey’, ‘ctrlKey’, or ‘metaKey’. Set this option if you want to be able to use the scroll to navigate vertically on views with a lot of events.</td>
|
<td>Specifies whether the Timeline is
|
||||||
|
only zoomed when an additional key
|
||||||
|
is down. Available values are ‘’
|
||||||
|
(does not apply), ‘altKey’,
|
||||||
|
‘ctrlKey’, or ‘metaKey’. Set this
|
||||||
|
option if you want to be able to
|
||||||
|
use the scroll to navigate
|
||||||
|
vertically on views with a lot of
|
||||||
|
events.</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr><td>mode</td>
|
<tr><td>mode</td>
|
||||||
<td>No</td>
|
<td>No</td>
|
||||||
<td>Specifies the initial visible window. Available values are: ‘day’ to display the current day, ‘week’, ‘month’ and ‘fit’. Default value is ‘fit’ to adjust the visible window such that it fits all items.</td>
|
<td>Specifies the initial visible
|
||||||
|
window. Available values are: ‘day’
|
||||||
|
to display the current day, ‘week’,
|
||||||
|
‘month’ and ‘fit’. Default value is
|
||||||
|
‘fit’ to adjust the visible window
|
||||||
|
such that it fits all items.</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr><td>margin</td>
|
<tr><td>margin</td>
|
||||||
<td>No</td>
|
<td>No</td>
|
||||||
<td>Specifies the margins around the items. It should respect the JSON format. For example ‘{“item”:{“horizontal”:-10}}’. Available values are: ‘{“axis”:<number>}’ (The minimal margin in pixels between items and the time axis)
|
<td>Specifies the margins around the
|
||||||
‘{“item”:<number>}’ (The minimal margin in pixels between items in both horizontal and vertical direction), ‘{“item”:{“horizontal”:<number>}}’ (The minimal horizontal margin in pixels between items),
|
items. It should respect the JSON
|
||||||
‘{“item”:{“vertical”:<number>}}’ (The minimal vertical margin in pixels between items), ‘{“item”:{“horizontal”:<number>,”vertical”:<number>}}’ (Combination between horizontal and vertical margins in pixels between items).</td>
|
format. For example
|
||||||
|
‘{“item”:{“horizontal”:-10}}’.
|
||||||
|
Available values are:
|
||||||
|
‘{“axis”:<number>}’ (The minimal
|
||||||
|
margin in pixels between items and
|
||||||
|
the time axis) ‘{“item”:<number>}’
|
||||||
|
(The minimal margin in pixels
|
||||||
|
between items in both horizontal
|
||||||
|
and vertical direction),
|
||||||
|
‘{“item”:{“horizontal”:<number>}}’
|
||||||
|
(The minimal horizontal margin in
|
||||||
|
pixels between items),
|
||||||
|
‘{“item”:{“vertical”:<number>}}’
|
||||||
|
(The minimal vertical margin in
|
||||||
|
pixels between items),
|
||||||
|
‘{“item”:{“horizont
|
||||||
|
al”:<number>,”vertical”:<number>}}’
|
||||||
|
(Combination between horizontal and
|
||||||
|
vertical margins in pixels between
|
||||||
|
items).</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr><td>event_open_popup</td>
|
<tr><td>event_open_popup</td>
|
||||||
<td>No</td>
|
<td>No</td>
|
||||||
<td>When set to true, it allows to edit the events in a popup. If not (default value), the record is edited changing to form view.</td>
|
<td>When set to true, it allows to edit
|
||||||
|
the events in a popup. If not
|
||||||
|
(default value), the record is
|
||||||
|
edited changing to form view.</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr><td>stack</td>
|
<tr><td>stack</td>
|
||||||
<td>No</td>
|
<td>No</td>
|
||||||
<td>When set to false, items will not be stacked on top of each other such that they do overlap.</td>
|
<td>When set to false, items will not
|
||||||
|
be stacked on top of each other
|
||||||
|
such that they do overlap.</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr><td>colors</td>
|
<tr><td>colors</td>
|
||||||
<td>No</td>
|
<td>No</td>
|
||||||
<td>Allows to set certain specific colors if the expressed condition (JS syntax) is met.</td>
|
<td>Allows to set certain specific
|
||||||
|
colors if the expressed condition
|
||||||
|
(JS syntax) is met.</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr><td>dependency_arrow</td>
|
<tr><td>dependency_arrow</td>
|
||||||
<td>No</td>
|
<td>No</td>
|
||||||
<td>Set this attribute to a x2many field to draw arrows between the records referenced in the x2many field.</td>
|
<td>Set this attribute to a x2many
|
||||||
|
field to draw arrows between the
|
||||||
|
records referenced in the x2many
|
||||||
|
field.</td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
<p>Optionally you can declare a custom template, which will be used to render the
|
<p>Optionally you can declare a custom template, which will be used to
|
||||||
timeline items. You have to name the template ‘timeline-item’.
|
render the timeline items. You have to name the template
|
||||||
These are the variables available in template rendering:</p>
|
‘timeline-item’. These are the variables available in template
|
||||||
|
rendering:</p>
|
||||||
<ul class="simple">
|
<ul class="simple">
|
||||||
<li><tt class="docutils literal">record</tt>: to access the fields values selected in the timeline definition.</li>
|
<li><tt class="docutils literal">record</tt>: to access the fields values selected in the timeline
|
||||||
<li><tt class="docutils literal">field_utils</tt>: used to format and parse values (see available functions in <tt class="docutils literal">web.field_utils</tt>).</li>
|
definition.</li>
|
||||||
|
<li><tt class="docutils literal">field_utils</tt>: used to format and parse values (see available
|
||||||
|
functions in <tt class="docutils literal">web.field_utils</tt>).</li>
|
||||||
</ul>
|
</ul>
|
||||||
<p>You also need to declare the view in an action window of the involved model.</p>
|
<p>You also need to declare the view in an action window of the involved
|
||||||
<p>See <tt class="docutils literal">web_timeline/demo/ir_cron_view.xml</tt> for a very basic timeline view example added onto cron tasks.</p>
|
model.</p>
|
||||||
|
<p>See <tt class="docutils literal">web_timeline/demo/ir_cron_view.xml</tt> for a very basic timeline
|
||||||
|
view example added onto cron tasks.</p>
|
||||||
<p>More evolved example, from <tt class="docutils literal">project_timeline</tt>:</p>
|
<p>More evolved example, from <tt class="docutils literal">project_timeline</tt>:</p>
|
||||||
<pre class="code xml literal-block">
|
<pre class="code xml literal-block">
|
||||||
<span class="cp"><?xml version="1.0" encoding="utf-8"?></span><span class="w">
|
<span class="cp"><?xml version="1.0" encoding="utf-8"?></span><span class="w">
|
||||||
|
@ -523,45 +584,49 @@ These are the variables available in template rendering:</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="section" id="usage">
|
<div class="section" id="usage">
|
||||||
<h1><a class="toc-backref" href="#toc-entry-2">Usage</a></h1>
|
<h1><a class="toc-backref" href="#toc-entry-2">Usage</a></h1>
|
||||||
<p>For accessing the timeline view, you have to click on the button with the clock
|
<p>For accessing the timeline view, you have to click on the button with
|
||||||
icon in the view switcher. The first time you access to it, the timeline window
|
the clock icon in the view switcher. The first time you access to it,
|
||||||
is zoomed to fit all the current elements, the same as when you perform a
|
the timeline window is zoomed to fit all the current elements, the same
|
||||||
search, filter or group by operation.</p>
|
as when you perform a search, filter or group by operation.</p>
|
||||||
<p>You can use the mouse scroll to zoom in or out in the timeline, and click on
|
<p>You can use the mouse scroll to zoom in or out in the timeline, and
|
||||||
any free area and drag for panning the view in that direction.</p>
|
click on any free area and drag for panning the view in that direction.</p>
|
||||||
<p>The records of your model will be shown as rectangles whose widths are the
|
<p>The records of your model will be shown as rectangles whose widths are
|
||||||
duration of the event according our definition. You can select them clicking
|
the duration of the event according our definition. You can select them
|
||||||
on this rectangle. You can also use Ctrl or Shift keys for adding discrete
|
clicking on this rectangle. You can also use Ctrl or Shift keys for
|
||||||
or range selections. Selected records are hightlighted with a different color
|
adding discrete or range selections. Selected records are hightlighted
|
||||||
(but the difference will be more noticeable depending on the background color).
|
with a different color (but the difference will be more noticeable
|
||||||
Once selected, you can drag and move the selected records across the timeline.</p>
|
depending on the background color). Once selected, you can drag and move
|
||||||
<p>When a record is selected, a red cross button appears on the upper left corner
|
the selected records across the timeline.</p>
|
||||||
that allows to remove that record. This doesn’t work for multiple records
|
<p>When a record is selected, a red cross button appears on the upper left
|
||||||
although they were selected.</p>
|
corner that allows to remove that record. This doesn’t work for multiple
|
||||||
<p>Records are grouped in different blocks depending on the group by criteria
|
records although they were selected.</p>
|
||||||
selected (if none is specified, then the default group by is applied).
|
<p>Records are grouped in different blocks depending on the group by
|
||||||
Dragging a record from one block to another change the corresponding field to
|
criteria selected (if none is specified, then the default group by is
|
||||||
the value that represents the block. You can also click on the group name to
|
applied). Dragging a record from one block to another change the
|
||||||
edit the involved record directly.</p>
|
corresponding field to the value that represents the block. You can also
|
||||||
<p>Double-click on the record to edit it. Double-click in open area to create a
|
click on the group name to edit the involved record directly.</p>
|
||||||
new record with the group and start date linked to the area you clicked in.
|
<p>Double-click on the record to edit it. Double-click in open area to
|
||||||
By holding the Ctrl key and dragging left to right, you can create a new record
|
create a new record with the group and start date linked to the area you
|
||||||
with the dragged start and end date.</p>
|
clicked in. By holding the Ctrl key and dragging left to right, you can
|
||||||
|
create a new record with the dragged start and end date.</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="section" id="known-issues-roadmap">
|
<div class="section" id="known-issues-roadmap">
|
||||||
<h1><a class="toc-backref" href="#toc-entry-3">Known issues / Roadmap</a></h1>
|
<h1><a class="toc-backref" href="#toc-entry-3">Known issues / Roadmap</a></h1>
|
||||||
<ul class="simple">
|
<ul class="simple">
|
||||||
<li>Implement a more efficient way of refreshing timeline after a record update;</li>
|
<li>Implement a more efficient way of refreshing timeline after a record
|
||||||
|
update;</li>
|
||||||
<li>Make <tt class="docutils literal">attrs</tt> attribute work;</li>
|
<li>Make <tt class="docutils literal">attrs</tt> attribute work;</li>
|
||||||
<li>When grouping by m2m and more than one record is set, the timeline item appears only
|
<li>When grouping by m2m and more than one record is set, the timeline
|
||||||
on one group. Allow showing in both groups.</li>
|
item appears only on one group. Allow showing in both groups.</li>
|
||||||
<li>When grouping by m2m and dragging for changing the time or the group, the changes on
|
<li>When grouping by m2m and dragging for changing the time or the group,
|
||||||
the group will not be set, because it could make disappear the records not related
|
the changes on the group will not be set, because it could make
|
||||||
with the changes that we want to make. When the item is showed in all groups change
|
disappear the records not related with the changes that we want to
|
||||||
the value according the group of the dragged item.</li>
|
make. When the item is showed in all groups change the value
|
||||||
<li>When an item label does not fit in its date-range box: ✅ the label correctly overflows
|
according the group of the dragged item.</li>
|
||||||
the box; ✅ clicking anywhere on the label allows moving the box; ❌ double-clicking
|
<li>When an item label does not fit in its date-range box: ✅ the label
|
||||||
the label outside of the box does not open that item.</li>
|
correctly overflows the box; ✅ clicking anywhere on the label allows
|
||||||
|
moving the box; ❌ double-clicking the label outside of the box does
|
||||||
|
not open that item.</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
<div class="section" id="bug-tracker">
|
<div class="section" id="bug-tracker">
|
||||||
|
@ -569,7 +634,7 @@ the label outside of the box does not open that item.</li>
|
||||||
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/web/issues">GitHub Issues</a>.
|
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/web/issues">GitHub Issues</a>.
|
||||||
In case of trouble, please check there if your issue has already been reported.
|
In case of trouble, please check there if your issue has already been reported.
|
||||||
If you spotted it first, help us to smash it by providing a detailed and welcomed
|
If you spotted it first, help us to smash it by providing a detailed and welcomed
|
||||||
<a class="reference external" href="https://github.com/OCA/web/issues/new?body=module:%20web_timeline%0Aversion:%2016.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
|
<a class="reference external" href="https://github.com/OCA/web/issues/new?body=module:%20web_timeline%0Aversion:%2017.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
|
||||||
<p>Do not contact contributors directly about support or help with technical issues.</p>
|
<p>Do not contact contributors directly about support or help with technical issues.</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="section" id="credits">
|
<div class="section" id="credits">
|
||||||
|
@ -622,7 +687,7 @@ mission is to support the collaborative development of Odoo features and
|
||||||
promote its widespread use.</p>
|
promote its widespread use.</p>
|
||||||
<p>Current <a class="reference external" href="https://odoo-community.org/page/maintainer-role">maintainer</a>:</p>
|
<p>Current <a class="reference external" href="https://odoo-community.org/page/maintainer-role">maintainer</a>:</p>
|
||||||
<p><a class="reference external image-reference" href="https://github.com/tarteo"><img alt="tarteo" src="https://github.com/tarteo.png?size=40px" /></a></p>
|
<p><a class="reference external image-reference" href="https://github.com/tarteo"><img alt="tarteo" src="https://github.com/tarteo.png?size=40px" /></a></p>
|
||||||
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/web/tree/16.0/web_timeline">OCA/web</a> project on GitHub.</p>
|
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/web/tree/17.0/web_timeline">OCA/web</a> project on GitHub.</p>
|
||||||
<p>You are welcome to contribute. To learn how please visit <a class="reference external" href="https://odoo-community.org/page/Contribute">https://odoo-community.org/page/Contribute</a>.</p>
|
<p>You are welcome to contribute. To learn how please visit <a class="reference external" href="https://odoo-community.org/page/Contribute">https://odoo-community.org/page/Contribute</a>.</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in New Issue