You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

173 lines
7.0 KiB

  1. .. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg
  2. :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
  3. :alt: License: AGPL-3
  4. =============
  5. Timeline view
  6. =============
  7. Define a new view displaying events in an interactive visualization chart.
  8. The widget is based on the external library
  9. http://visjs.org/timeline_examples.html
  10. Configuration
  11. =============
  12. You need to define a view with the tag <timeline> as base element. These are
  13. the possible attributes for the tag:
  14. * date_start (required): it defines the name of the field of type date that
  15. contains the start of the event.
  16. * date_stop (optional): it defines the name of the field of type date that
  17. contains the end of the event. The date_stop can be equal to the attribute
  18. date_start to display events has 'point' on the Timeline (instantaneous event)
  19. * date_delay (optional): it defines the name of the field of type float/integer
  20. that contain the duration in hours of the event, default = 1
  21. * default_group_by (required): it defines the name of the field that will be
  22. taken as default group by when accessing the view or when no other group by
  23. is selected.
  24. * zoomKey (optional): Specifies whether the Timeline is only zoomed when an
  25. additional key is down. Available values are '' (does not apply), 'altKey',
  26. 'ctrlKey', or 'metaKey'. Set this option if you want to be able to use the
  27. scroll to navigate vertically on views with a lot of events.
  28. * mode (optional): Specifies the initial visible window. Available values are:
  29. 'day' to display the current day, 'week', 'month' and 'fit'.
  30. Default value is 'fit' to adjust the visible window such that it fits all items
  31. * event_open_popup (optional): when set to true, it allows to edit the events
  32. in a popup. If not (default value), the record is edited changing to form
  33. view.
  34. * colors (optional): it allows to set certain specific colors if the expressed
  35. condition (JS syntax) is met.
  36. * dependency_arrow (optional): set this attribute to a x2many field to draw
  37. arrows between the records referenced in the x2many field.
  38. Optionally you can declare a custom template, which will be used to render the
  39. timeline items. You have to name the template 'timeline-item'.
  40. These are the variables available in template rendering:
  41. * ``record``: to access the fields values selected in the timeline definition.
  42. * ``field_utils``: used to format and parse values (see available functions in ``web.field_utils``).
  43. You also need to declare the view in an action window of the involved model.
  44. Example:
  45. .. code-block:: xml
  46. <?xml version="1.0" encoding="utf-8"?>
  47. <odoo>
  48. <record id="view_task_timeline" model="ir.ui.view">
  49. <field name="model">project.task</field>
  50. <field name="type">timeline</field>
  51. <field name="arch" type="xml">
  52. <timeline date_start="date_start"
  53. date_stop="date_end"
  54. string="Tasks"
  55. default_group_by="user_id"
  56. event_open_popup="true"
  57. zoomKey="ctrlKey"
  58. colors="#ec7063:user_id == false;#2ecb71:kanban_state=='done';"
  59. dependency_arrow="task_dependency_ids">
  60. <field name="user_id"/>
  61. <templates>
  62. <div t-name="timeline-item">
  63. <div t-esc="record.display_name"/>
  64. Assigned to:
  65. <span t-esc="record.user_id[1]"/>
  66. </div>
  67. </templates>
  68. </timeline>
  69. </field>
  70. </record>
  71. <record id="project.action_view_task" model="ir.actions.act_window">
  72. <field name="view_mode">kanban,tree,form,calendar,gantt,timeline,graph</field>
  73. </record>
  74. </odoo>
  75. Usage
  76. =====
  77. For accessing the timeline view, you have to click on the button with the clock
  78. icon in the view switcher. The first time you access to it, the timeline window
  79. is zoomed to fit all the current elements, the same as when you perform a
  80. search, filter or group by operation.
  81. You can use the mouse scroll to zoom in or out in the timeline, and click on
  82. any free area and drag for panning the view in that direction.
  83. The records of your model will be shown as rectangles whose widths are the
  84. duration of the event according our definition. You can select them clicking
  85. on this rectangle. You can also use Ctrl or Shift keys for adding discrete
  86. or range selections. Selected records are hightlighted with a different color
  87. (but the difference will be more noticeable depending on the background color).
  88. Once selected, you can drag and move the selected records across the timeline.
  89. When a record is selected, a red cross button appears on the upper left corner
  90. that allows to remove that record. This doesn't work for multiple records
  91. although they were selected.
  92. Records are grouped in different blocks depending on the group by criteria
  93. selected (if none is specified, then the default group by is applied).
  94. Dragging a record from one block to another change the corresponding field to
  95. the value that represents the block. You can also click on the group name to
  96. edit the involved record directly.
  97. Double-click on the record to edit it. Double-click in open area to create a
  98. new record with the group and start date linked to the area you clicked in.
  99. By holding the Ctrl key and dragging left to right, you can create a new record
  100. with the dragged start and end date.
  101. .. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas
  102. :alt: Try me on Runbot
  103. :target: https://runbot.odoo-community.org/runbot/162/11.0
  104. Known issues / Roadmap
  105. ======================
  106. * Implement a more efficient way of refreshing timeline after a record update.
  107. Bug Tracker
  108. ===========
  109. Bugs are tracked on `GitHub Issues
  110. <https://github.com/OCA/web/issues>`_. In case of trouble, please
  111. check there if your issue has already been reported. If you spotted it first,
  112. help us smashing it by providing a detailed and welcomed feedback.
  113. Credits
  114. =======
  115. Images
  116. ------
  117. * Odoo Community Association: `Icon <https://github.com/OCA/maintainer-tools/blob/master/template/module/static/description/icon.svg>`_.
  118. Contributors
  119. ------------
  120. * Laurent Mignon <laurent.mignon@acsone.eu>
  121. * Adrien Peiffer <adrien.peiffer@acsone.eu>
  122. * Pedro M. Baeza <pedro.baeza@tecnativa.com>
  123. * Leonardo Donelli <donelli@webmonks.it>
  124. * Adrien Didenot <adrien.didenot@horanet.com>
  125. * Dennis Sluijk <d.sluijk@onestein.nl>
  126. Do not contact contributors directly about support or help with technical issues.
  127. Maintainer
  128. ----------
  129. .. image:: https://odoo-community.org/logo.png
  130. :alt: Odoo Community Association
  131. :target: https://odoo-community.org
  132. This module is maintained by the OCA.
  133. OCA, or the Odoo Community Association, is a nonprofit organization whose
  134. mission is to support the collaborative development of Odoo features and
  135. promote its widespread use.
  136. To contribute to this module, please visit https://odoo-community.org.