Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
152 changes: 88 additions & 64 deletions web_timeline/README.rst
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
.. image:: https://odoo-community.org/readme-banner-image
:target: https://odoo-community.org/get-involved?utm_source=readme
:alt: Odoo Community Association

============
Web timeline
============
Expand All @@ -11,13 +7,13 @@ Web timeline
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:0f2b205ffa4ec5cdb7da811ce10e275be9c373e021299b3cb40d86d547b6760c
!! source digest: sha256:586ccf4825edfb382dd5389e2508df4f093ffd42a73db2bc1eca29e1f0a9c29c
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

.. |badge1| image:: https://img.shields.io/badge/maturity-Production%2FStable-green.png
:target: https://odoo-community.org/page/development-status
:alt: Production/Stable
.. |badge2| image:: https://img.shields.io/badge/license-AGPL--3-blue.png
.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fweb-lightgray.png?logo=github
Expand Down Expand Up @@ -49,64 +45,88 @@ Configuration
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. |
+------------------+-----------+--------------------------------------------------------+
+------------------+-----------+-------------------------------------+
| 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":{"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 timeline items. You have to name the template
Expand Down Expand Up @@ -286,6 +306,10 @@ Contributors

- Houzéfa Abbasbhay

- `PyTech <https://www.pytech.it>`__:

- Simone Rubino <simone.rubino@pytech.it>

Maintainers
-----------

Expand Down
19 changes: 16 additions & 3 deletions web_timeline/demo/ir_cron_view.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,20 @@
<timeline date_start="nextcall" default_group_by="model_id" />
</field>
</record>
<record id="base.ir_cron_act" model="ir.actions.act_window">
<field name="view_mode">list,form,calendar,timeline</field>
</record>
<!-- Append our view_mode this way to avoid overwriting changes done by other modules. -->
<function model="ir.actions.act_window" name="write">
<value eval="[ref('base.ir_cron_act')]" />
<value
model="ir.actions.act_window"
eval="{
'view_mode': obj().env.ref('base.ir_cron_act').view_mode + ',timeline',
'view_ids': [
Command.create({
'view_mode': 'timeline',
'view_id': ref('ir_cron_timeline'),
}),
],
}"
/>
</function>
</odoo>
1 change: 1 addition & 0 deletions web_timeline/models/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Copyright 2016 ACSONE SA/NV (<http://acsone.eu>)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).

from . import ir_actions
from . import ir_ui_view
from . import ir_action
8 changes: 8 additions & 0 deletions web_timeline/models/ir_actions.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Copyright 2026 Simone Rubino - PyTech
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

from odoo.addons.base.models.ir_actions import VIEW_TYPES

from .ir_ui_view import TIMELINE_VIEW

VIEW_TYPES.append(TIMELINE_VIEW)
2 changes: 2 additions & 0 deletions web_timeline/readme/CONTRIBUTORS.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,5 @@
- Anjeel Haria
- [XCG Consulting](https://xcg-consulting.fr):
- Houzéfa Abbasbhay
- [PyTech](https://www.pytech.it):
- Simone Rubino \<<simone.rubino@pytech.it>\>
Loading
Loading