Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[17.0][MIG] web_timeline: Migration to version 17.0 #2969

Merged
merged 65 commits into from
Oct 21, 2024

Conversation

carlos-lopez-tecnativa
Copy link
Contributor

  • Convert Moment.js to Luxon.
  • Replace Underscore.js with native JavaScript code.
  • Migrate legacy views to the new system and add an architecture parser to separate logic.
  • added basic test

TT50999

@Tecnativa @pedrobaeza @CarlosRoca13 @victoralmau @chienandalu could you please review this

lmignon and others added 30 commits October 19, 2024 14:52
* Avoid to display all items of group_by model
* Remove unnecessary readgroup
* Remove dependency on project. Modify module structure. Imporve readme file.
* Add setup.py
* [FIX] Correct write when grouped by

* Remove blank lines

* Minor changes
* Update the vis.js framework to latest stable version (v4.20.1) to add new functionality and save almost
400ko of source code in odoo assets (the vis dev team has isolate the code for timeline widget from the
 rest of their widgets)

* Add the possibility to display events with no duration (instantaneous) as the same time has regular events

* Add the possibility to choose between two scroll mode :
  -  zoom in time resolution (default)
  or
  -  vertical scroll (web browser default behaviour)

Signed-off-by: adrien.didenot <[email protected]>
…same as base Calendar view)

In Odoo calendar view, the attribute date_delay is an alternative to date_stop, to provides the duration of the event instead of its end date.
This commit integrate this attribute to the Timeline view, but contrary to the base Calendar view the Timeline view could use both arguments (date_stop and date_delay) simultaneously.

Signed-off-by: adrien.didenot <[email protected]>
The default window display all the events (aka 'fit'), in case of events spread over the year, the events are invisibles (too small to be readable)

Signed-off-by: adrien.didenot <[email protected]>
Change the attribute 'default_window' to 'mode' like the Odoo calendar view (to be iso functional)
CSS classes have changed with the updated version of vis.js
* Update Version in Manifest
* Remove enconding in .py files
* Rewrite the view definition according to version 11
[IMP] web_timeline: Templates implementation like kanban

[ADD] Check if template exists

Update README.rst
[UPD] Version number

[UPD] README
Update README.rst

[FIX] Remove console.log

[ADD] Make timeline.fit optional

[FIX] Use stringified points

[IMP] Reversed the arrow head and fixed lint issues

[IMP] Use options parameter for line color and width

[FIX] Version number

[IMP] Minor improvements
[IMP] Prevent flickering

[IMP] Fixed headers

[ADD] Create new record by date range selection

Remove roadmap item from readme

[FIX] minimal height
[FIX] web_timeline: Reloading view

[FIX] web_timeline: Reloading view
mymage and others added 11 commits October 20, 2024 12:31
Currently translated at 100.0% (13 of 13 strings)

Translation: web-16.0/web-16.0-web_timeline
Translate-URL: https://translation.odoo-community.org/projects/web-16-0/web-16-0-web_timeline/fr/
By contract the first argument of the `fields_get` method is supposed to
be a list. Before this fix, `web_timeline` would call `fields_get` with
a string instead of a list.

Fortunately in case only 1 field is being grouped, this worked as Odoo
does an `x in y` comparison in its `fields_get` implementation, which
does pass in a simple `"project_id" in "project_id"` case.

But that call remains invalid and can break when `fields_get` has been
tweaked by other modules.
This way we can showcase this module without project_timeline.
When an item label does not fit in its date-range box, overflow
according to
https://visjs.github.io/vis-timeline/examples/timeline/items/rangeOverflowItem.html

Previous CSS code was already trying to do that, but was selecting
`.vis-item.vis-item-content` instead of `.vis-item .vis-item-content`.

Displaying overflow text brings up layout issues solved by removing the
forced-100% width instruction.

This change also adds highlight when hovering a box, which is useful on
text that has overflown (as it has no borders).
Inverted dates make no functional sense, but when they do happen, this
change allows displaying them as single points in the timeline (same as
when begin=end).

We currently do have such demo data when installing project_timeline.
This avoids somewhat ugly very large "Unassigned" first row.
This commit fixes redraw issues when setting a `mode` attribute in the
`timeline` view tag.

This mode specifies a default scale one would want to set; same as when
clicking on Day/Week/Month buttons at the top of the view.

Initial rendering had issues here because data was loaded too soon,
before the timeline component was rendered/ready. The fix is to load
data into the component only after initial redraw event, called
`changed` (see <https://visjs.github.io/vis-timeline/docs/timeline/#Events>).

There was old code attempting to call `on_scale_xxx_clicked` methods at
load time to simulate clicks on these Day/Week/Month buttons, but these
methods have been renamed so this code is no longer working.

This commit also removes the `current_window` instance variable, not
needed and actually confusing as the timeline component already
maintains its own start/end information (which we can query with
`timeline.getWindow()`).
In addition to security rights (was already implemented), now follow
`create="0"` / `edit="0"` / `delete="0"` attributes one can set onto the
`timeline` tag, same as in other Odoo views.
- Convert Moment.js to Luxon.
- Replace Underscore.js with native JavaScript code.
- Migrate legacy views to the new system and add an architecture parser to separate logic.
- added basic test
@pedrobaeza
Copy link
Member

/ocabot migration web_timeline

@OCA-git-bot OCA-git-bot added this to the 17.0 milestone Oct 21, 2024
@OCA-git-bot OCA-git-bot mentioned this pull request Oct 21, 2024
26 tasks
Copy link
Member

@pedrobaeza pedrobaeza left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Functional review in OCA/project#1354

Copy link
Contributor

@CarlosRoca13 CarlosRoca13 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work 😄 thanks

/ocabot merge nobump

@OCA-git-bot
Copy link
Contributor

Hey, thanks for contributing! Proceeding to merge this for you.
Prepared branch 17.0-ocabot-merge-pr-2969-by-CarlosRoca13-bump-nobump, awaiting test results.

@OCA-git-bot OCA-git-bot merged commit 8320c2f into OCA:17.0 Oct 21, 2024
7 checks passed
@OCA-git-bot
Copy link
Contributor

Congratulations, your PR was merged at 247a73e. Thanks a lot for contributing to OCA. ❤️

@pedrobaeza pedrobaeza deleted the 17.0-mig-web_timeline branch October 21, 2024 15:40
@pedrobaeza
Copy link
Member

@carlos-lopez-tecnativa I'm now remembering that you didn't update the vis library. Why?

@carlos-lopez-tecnativa
Copy link
Contributor Author

@carlos-lopez-tecnativa I'm now remembering that you didn't update the vis library. Why?

Sorry, I forgot, please see #2972

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.