diff --git a/setup/web_view_jsgantt/odoo/addons/web_view_jsgantt b/setup/web_view_jsgantt/odoo/addons/web_view_jsgantt new file mode 120000 index 000000000000..a7cd846d59e6 --- /dev/null +++ b/setup/web_view_jsgantt/odoo/addons/web_view_jsgantt @@ -0,0 +1 @@ +../../../../web_view_jsgantt \ No newline at end of file diff --git a/setup/web_view_jsgantt/setup.py b/setup/web_view_jsgantt/setup.py new file mode 100644 index 000000000000..28c57bb64031 --- /dev/null +++ b/setup/web_view_jsgantt/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +) diff --git a/web_view_jsgantt/README.rst b/web_view_jsgantt/README.rst new file mode 100644 index 000000000000..a6ebdd214a79 --- /dev/null +++ b/web_view_jsgantt/README.rst @@ -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 `_. + +.. 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 `_ + +**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 ```` and it should +contain multiple ```` elements. + +The ```` 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 ```` 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 `_. +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 `_. + +Do not contact contributors directly about support or help with technical issues. + +Credits +======= + +Authors +~~~~~~~ + +* Coop IT Easy SC + +Contributors +~~~~~~~~~~~~ + +* `Coop IT Easy SC `_: + + * hugues de keyzer + +Other credits +~~~~~~~~~~~~~ + +The development of this module has been funded by `iMio sc +`_. + +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 `_ project on GitHub. + +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/web_view_jsgantt/__init__.py b/web_view_jsgantt/__init__.py new file mode 100644 index 000000000000..3eb78877c5bc --- /dev/null +++ b/web_view_jsgantt/__init__.py @@ -0,0 +1,5 @@ +# SPDX-FileCopyrightText: 2024 Coop IT Easy SC +# +# SPDX-License-Identifier: AGPL-3.0-or-later + +from . import models diff --git a/web_view_jsgantt/__manifest__.py b/web_view_jsgantt/__manifest__.py new file mode 100644 index 000000000000..811252e7e363 --- /dev/null +++ b/web_view_jsgantt/__manifest__.py @@ -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/**/*", + ], + }, +} diff --git a/web_view_jsgantt/models/__init__.py b/web_view_jsgantt/models/__init__.py new file mode 100644 index 000000000000..fd114ac73963 --- /dev/null +++ b/web_view_jsgantt/models/__init__.py @@ -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 diff --git a/web_view_jsgantt/models/ir_actions_act_window_view.py b/web_view_jsgantt/models/ir_actions_act_window_view.py new file mode 100644 index 000000000000..fb746c43d4dd --- /dev/null +++ b/web_view_jsgantt/models/ir_actions_act_window_view.py @@ -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"}, + ) diff --git a/web_view_jsgantt/models/ir_ui_view.py b/web_view_jsgantt/models/ir_ui_view.py new file mode 100644 index 000000000000..670067593e61 --- /dev/null +++ b/web_view_jsgantt/models/ir_ui_view.py @@ -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 diff --git a/web_view_jsgantt/readme/CONTRIBUTORS.rst b/web_view_jsgantt/readme/CONTRIBUTORS.rst new file mode 100644 index 000000000000..eb7c015bfe76 --- /dev/null +++ b/web_view_jsgantt/readme/CONTRIBUTORS.rst @@ -0,0 +1,3 @@ +* `Coop IT Easy SC `_: + + * hugues de keyzer diff --git a/web_view_jsgantt/readme/CREDITS.rst b/web_view_jsgantt/readme/CREDITS.rst new file mode 100644 index 000000000000..c796c7a2e218 --- /dev/null +++ b/web_view_jsgantt/readme/CREDITS.rst @@ -0,0 +1,2 @@ +The development of this module has been funded by `iMio sc +`_. diff --git a/web_view_jsgantt/readme/DESCRIPTION.rst b/web_view_jsgantt/readme/DESCRIPTION.rst new file mode 100644 index 000000000000..9edc1df941d4 --- /dev/null +++ b/web_view_jsgantt/readme/DESCRIPTION.rst @@ -0,0 +1 @@ +Add a Gantt view type using `jsgantt-improved `_. diff --git a/web_view_jsgantt/readme/ROADMAP.rst b/web_view_jsgantt/readme/ROADMAP.rst new file mode 100644 index 000000000000..64b83854f12f --- /dev/null +++ b/web_view_jsgantt/readme/ROADMAP.rst @@ -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. diff --git a/web_view_jsgantt/readme/USAGE.rst b/web_view_jsgantt/readme/USAGE.rst new file mode 100644 index 000000000000..f93ad2e01d0e --- /dev/null +++ b/web_view_jsgantt/readme/USAGE.rst @@ -0,0 +1,98 @@ +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 ```` and it should +contain multiple ```` elements. + +The ```` 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 ```` 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``) diff --git a/web_view_jsgantt/static/description/index.html b/web_view_jsgantt/static/description/index.html new file mode 100644 index 000000000000..d316ea30191f --- /dev/null +++ b/web_view_jsgantt/static/description/index.html @@ -0,0 +1,537 @@ + + + + + + +JSGantt View + + + +
+

JSGantt View

+ + +

Alpha License: AGPL-3 OCA/web Translate me on Weblate Try me on Runboat

+

Add a Gantt view type using 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

+
+

Table of contents

+ +
+

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. +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.

+

Do not contact contributors directly about support or help with technical issues.

+
+
+

Credits

+
+

Authors

+
    +
  • Coop IT Easy SC
  • +
+
+
+

Contributors

+ +
+
+

Other credits

+

The development of this module has been funded by iMio sc.

+
+
+

Maintainers

+

This module is maintained by the OCA.

+Odoo Community Association +

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 project on GitHub.

+

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

+
+
+
+ + diff --git a/web_view_jsgantt/static/lib/jsgantt-improved/CONTRIBUTING.md b/web_view_jsgantt/static/lib/jsgantt-improved/CONTRIBUTING.md new file mode 100644 index 000000000000..fa7bb2ca8d50 --- /dev/null +++ b/web_view_jsgantt/static/lib/jsgantt-improved/CONTRIBUTING.md @@ -0,0 +1,180 @@ +# Contributing to jsGanttImproved + +We'd love for you to contribute to our source code and to make jsGanttImproved even better than it is +today! Here are the guidelines we'd like you to follow: + + - [Issues and Bugs](#issue) + - [Feature Requests](#feature) + - [Submission Guidelines](#submit) + - [Coding Rules](#rules) + - [Commit Message Guidelines](#commit) + - [Further Info](#info) + +## Found an Issue? + +If you find a bug in the source code or a mistake in the documentation, you can help us by +submitting an issue to our [GitHub Repository][github]. Even better you can submit a Pull Request +with a fix. + +**Please see the [Submission Guidelines](#submit) below.** + +## Want a Feature? + +You can request a new feature by submitting an issue to our [GitHub Repository][github]. If you +would like to implement a new feature then it can be crafted and submitted as a Pull Request. + +## Submission Guidelines + +### Submitting an Issue +Before you submit your issue search the archive, maybe your question was already answered. + +If your issue appears to be a bug, and hasn't been reported, open a new issue. Help us to maximize +the effort we can spend fixing issues and adding new features, by not reporting duplicate issues. +Providing the following information will increase the chances of your issue being dealt with +quickly: + +* **Overview of the Issue** - if an error is being thrown a non-minified stack trace helps +* **Motivation for or Use Case** - explain why this is a bug for you +* **Version(s)** - what is the version(s) being used? +* **Browsers and Operating System** - is this a problem with all browsers or only specific ones? +* **Reproduce the Error** - provide a live example (using [Plunker][plunker] or + [JSFiddle][jsfiddle]) or an unambiguous set of steps. +* **Related Issues** - has a similar issue been reported before? +* **Suggest a Fix** - if you can't fix the bug yourself, perhaps you can point to what might be + causing the problem (line of code or commit) + +### Submitting a Pull Request +Before you submit your pull request consider the following guidelines: + +* Search [GitHub](https://github.com/jsGanttImproved/jsgantt-improved/pulls) for an open or closed Pull Request + that relates to your submission. You don't want to duplicate effort. +* Make your changes in a new git branch: + + ```shell + git checkout -b my-fix-branch master + ``` + +* Create your patch. +* Follow our [Coding Rules](#rules). +* Commit your changes using a descriptive commit message that follows our + [commit message conventions](#commit). + + ```shell + git commit -a + ``` + Note: the optional commit `-a` command line option will automatically "add" and "rm" edited files. + +* Push your branch to GitHub: + + ```shell + git push origin my-fix-branch + ``` + +In GitHub, send a pull request to `master`. +If we suggest changes, then: + +* Make the required updates. +* Commit your changes to your branch (e.g. `my-fix-branch`). +* Push the changes to your GitHub repository (this will update your Pull Request). + +If the PR gets too outdated we may ask you to rebase and force push to update the PR: + +```shell +git rebase master -i +git push origin my-fix-branch -f +``` + +_WARNING: Squashing or reverting commits and force-pushing thereafter may remove GitHub comments +on code that were previously made by you or others in your commits. Avoid any form of rebasing +unless necessary._ + +That's it! Thank you for your contribution! + +#### After your pull request is merged + +After your pull request is merged, you can safely delete your branch and pull the changes +from the main (upstream) repository: + +* Delete the remote branch on GitHub either through the GitHub web UI or your local shell as follows: + + ```shell + git push origin --delete my-fix-branch + ``` + +* Check out the master branch: + + ```shell + git checkout master -f + ``` + +* Delete the local branch: + + ```shell + git branch -D my-fix-branch + ``` + +* Update your master with the latest upstream version: + + ```shell + git pull --ff upstream master + ``` + +## Coding Rules + +To ensure consistency throughout the source code, keep these rules in mind as you are working: + +* With the exceptions listed below, we follow the rules contained in + [Google's JavaScript Style Guide][js-style-guide]: + * Wrap all code at **100 characters**. + +## Git Commit Guidelines + +We have very precise rules over how our git commit messages can be formatted. This leads to **more +readable messages** that are easy to follow when looking through the **project history**. + +### Commit Message Format +Each commit message consists of a **subject**, a **body** and a **footer**: + +``` + + + + +