Skip to content

Commit

Permalink
[ADD] add new module web_view_jsgantt
Browse files Browse the repository at this point in the history
  • Loading branch information
huguesdk committed Sep 25, 2024
1 parent 19c94c8 commit 8ac6af9
Show file tree
Hide file tree
Showing 24 changed files with 1,794 additions and 0 deletions.
1 change: 1 addition & 0 deletions setup/web_view_jsgantt/odoo/addons/web_view_jsgantt
6 changes: 6 additions & 0 deletions setup/web_view_jsgantt/setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import setuptools

setuptools.setup(
setup_requires=['setuptools-odoo'],
odoo_addon=True,
)
207 changes: 207 additions & 0 deletions web_view_jsgantt/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,207 @@
============
JSGantt View
============

..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:3cd0fb4bb5cef6bb98558d5cd4108cdeb8786937aea8a1e8f52989d206e01072
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |badge1| image:: https://img.shields.io/badge/maturity-Alpha-red.png
:target: https://odoo-community.org/page/development-status
:alt: Alpha
.. |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
:target: https://github.com/OCA/web/tree/16.0/web_view_jsgantt
:alt: OCA/web
.. |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_view_jsgantt
:alt: Translate me on Weblate
.. |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
:alt: Try me on Runboat

|badge1| |badge2| |badge3| |badge4| |badge5|

Add a Gantt view type using `jsgantt-improved <https://github.com/jsGanttImproved/jsgantt-improved>`_.

.. IMPORTANT::
This is an alpha version, the data model and design can change at any time without warning.
Only for development or testing purpose, do not use in production.
`More details on development status <https://odoo-community.org/page/development-status>`_

**Table of contents**

.. contents::
:local:

Usage
=====

To use the jsgantt view on a model, a view of that type must be defined for
that model. The root element of the view is ``<jsgantt>`` and it should
contain multiple ``<field>`` elements.

The ``<jsgantt>`` root element can have the following attributes:

``time_format``
The default time format (time scale) to use. Possible values are: ``hour``,
``day``, ``week``, ``month``, and ``quarter``. Defaults to ``day``.

``show_duration``
Whether to display the duration information (as a column and in the task
information). Defaults to ``true``.

``caption_type``
Controls which internal task field to use as a caption next to the Gantt
chart task bars. Possible values are ``none``, ``caption``,
``resource_id``, ``duration``, ``completion``. Defaults to ``none``.

Each ``<field>`` element can have the following attributes:

``name``
The name of the field as defined by the model. This is mandatory.

``mapping``
The internal task field name to map the value to. See below for possible
values. Fields without a valid ``mapping`` value will not appear in the
view.

``invisible``
Whether this field should be hidden (as a column and in the task
information). Although hidden, its value will still be mapped to the
internal field as defined by its ``mapping`` attribute and used to display
tasks. Defaults to ``false`` (field is visible).

To make the view available, the ``jsgantt`` view mode must be added to the
list of view modes (``view_mode`` field) of the window action.

Internal task field names
~~~~~~~~~~~~~~~~~~~~~~~~~

Here are the names of the internal fields used to display the Gantt chart.
Internally, the Gantt chart sees each record as a task, and these are its
properties.

Each field of the view must be mapped to one of these using its ``mapping``
attribute.

``name``
The name (label) of the task. (``Char``)

``start_date``
The start date of the task. (``Date`` or ``DateTime``)

``end_date``
The end date of the task. (``Date`` or ``DateTime``)

``plan_start_date``
The planned start date of the task. (``Date`` or ``DateTime``)

``plan_end_date``
The planned end date of the task. (``Date`` or ``DateTime``)

``is_milestone``
Whether this task represents a milestone. (``Boolean``)

``resource_id``
The resource assigned to the task. (``Many2one``)

``completion``
The completion ratio, between 0 and 1. Is displayed as a percentage.
(``Float``)

``is_parent``
Whether this task is a parent task. (``Boolean``)

``parent_id``
The parent task. (``Many2one``)

``is_expanded``
For parent tasks, whether the task group should be expanded by default.
(``Boolean``)

``dependency_ids``
The tasks on which this task depends. (``Many2many``)

``caption``
The caption to display next to the task bar (if the ``caption_type``
attribute of the view is set to ``caption``). (``Char``)

``notes``
The notes to display in the task information. (``Char``)

``cost``
The cost of the task. (``Float``)

``bar_text``
The text to display on the task bar. (``Char``)

Known issues / Roadmap
======================

* The view is read-only, it is not possible to edit values.
* The order of the columns cannot be configured. The default order defined by
jsgantt-improved is used.
* Several chart display options are not available.
* It is not possible to display additional (non-mapped) fields.
* The task dependency types cannot be set. Only the default "finish to start"
is used.
* No validation of the internal task field names mapping is done. Using an
unknown field name does not trigger an error.
* Grouping records (``groupBy``) is not supported.
* The color of the task bars is not configurable. One of the available colors
is picked using a modulo on the id of the record.

Bug Tracker
===========

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.
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_view_jsgantt%0Aversion:%2016.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.

Credits
=======

Authors
~~~~~~~

* Coop IT Easy SC

Contributors
~~~~~~~~~~~~

* `Coop IT Easy SC <https://coopiteasy.be>`_:

* hugues de keyzer

Other credits
~~~~~~~~~~~~~

The development of this module has been funded by `iMio sc
<https://www.imio.be/>`_.

Maintainers
~~~~~~~~~~~

This module is maintained by the OCA.

.. image:: https://odoo-community.org/logo.png
:alt: Odoo Community Association
:target: https://odoo-community.org

OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and
promote its widespread use.

This module is part of the `OCA/web <https://github.com/OCA/web/tree/16.0/web_view_jsgantt>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
5 changes: 5 additions & 0 deletions web_view_jsgantt/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# SPDX-FileCopyrightText: 2024 Coop IT Easy SC
#
# SPDX-License-Identifier: AGPL-3.0-or-later

from . import models
23 changes: 23 additions & 0 deletions web_view_jsgantt/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# SPDX-FileCopyrightText: 2024 Coop IT Easy SC
#
# SPDX-License-Identifier: AGPL-3.0-or-later

{
"name": "JSGantt View",
"summary": "Add a Gantt view type using jsgantt-improved",
"version": "16.0.1.0.0",
"category": "Web",
"website": "https://github.com/OCA/web",
"author": "Coop IT Easy SC, Odoo Community Association (OCA)",
"license": "AGPL-3",
"development_status": "Alpha",
"depends": [
"web",
],
"assets": {
"web.assets_backend": [
"web_view_jsgantt/static/lib/jsgantt-improved/dist/*",
"web_view_jsgantt/static/src/views/**/*",
],
},
}
6 changes: 6 additions & 0 deletions web_view_jsgantt/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# SPDX-FileCopyrightText: 2024 Coop IT Easy SC
#
# SPDX-License-Identifier: AGPL-3.0-or-later

from . import ir_actions_act_window_view
from . import ir_ui_view
14 changes: 14 additions & 0 deletions web_view_jsgantt/models/ir_actions_act_window_view.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# SPDX-FileCopyrightText: 2024 Coop IT Easy SC
#
# SPDX-License-Identifier: AGPL-3.0-or-later

from odoo import fields, models


class IrActionsActWindowView(models.Model):
_inherit = "ir.actions.act_window.view"

view_mode = fields.Selection(
selection_add=[("jsgantt", "JSGantt")],
ondelete={"jsgantt": "cascade"},
)
17 changes: 17 additions & 0 deletions web_view_jsgantt/models/ir_ui_view.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# SPDX-FileCopyrightText: 2024 Coop IT Easy SC
#
# SPDX-License-Identifier: AGPL-3.0-or-later

from odoo import fields, models


class IrUiView(models.Model):
_inherit = "ir.ui.view"

type = fields.Selection(
selection_add=[("jsgantt", "JSGantt")],
ondelete={"jsgantt": "cascade"},
)

def _onchange_able_view_jsgantt(self, node):
return True

Check warning on line 17 in web_view_jsgantt/models/ir_ui_view.py

View check run for this annotation

Codecov / codecov/patch

web_view_jsgantt/models/ir_ui_view.py#L17

Added line #L17 was not covered by tests
3 changes: 3 additions & 0 deletions web_view_jsgantt/readme/CONTRIBUTORS.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
* `Coop IT Easy SC <https://coopiteasy.be>`_:

* hugues de keyzer
2 changes: 2 additions & 0 deletions web_view_jsgantt/readme/CREDITS.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
The development of this module has been funded by `iMio sc
<https://www.imio.be/>`_.
1 change: 1 addition & 0 deletions web_view_jsgantt/readme/DESCRIPTION.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Add a Gantt view type using `jsgantt-improved <https://github.com/jsGanttImproved/jsgantt-improved>`_.
12 changes: 12 additions & 0 deletions web_view_jsgantt/readme/ROADMAP.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
* The view is read-only, it is not possible to edit values.
* The order of the columns cannot be configured. The default order defined by
jsgantt-improved is used.
* Several chart display options are not available.
* It is not possible to display additional (non-mapped) fields.
* The task dependency types cannot be set. Only the default "finish to start"
is used.
* No validation of the internal task field names mapping is done. Using an
unknown field name does not trigger an error.
* Grouping records (``groupBy``) is not supported.
* The color of the task bars is not configurable. One of the available colors
is picked using a modulo on the id of the record.
Loading

0 comments on commit 8ac6af9

Please sign in to comment.