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

[14.0][IMP]project_timeline: improved timeline handling for project tasks #1335

Merged
merged 1 commit into from
Sep 11, 2024
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
7 changes: 6 additions & 1 deletion project_timeline/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,11 @@ To view the timeline:
* Click on the timeline view icon.
* You will see the tasks or projects in the new view.

The Task timeline uses the Start Date and End Date fields, in the Extra Info tab.
The Task timeline uses the "Planned Start Date" and "Planned End Date" fields, in the
"Extra Info" tab (only visible in debug mode).

When a user is assigned, and there's no planned start date, current datetime is filled
Copy link
Contributor

Choose a reason for hiding this comment

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

TBH this is working only when new task is created from kanban, but not from form: video

@juanjosesegui-tecnativa @pedrobaeza

Copy link
Member

Choose a reason for hiding this comment

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

That seems a glitch of v14 + the widget. If you do it in 2 steps (create it, and the assign it), it should work. It's out of the scope of the module anyway. Update to newer versions of Odoo for ORM improvements.

Copy link
Contributor

Choose a reason for hiding this comment

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

Sure, it was just a heads up in case it happens in later versions

there, and the same happens for the end one when the task is put in a done stage.

Bug Tracker
===========
Expand Down Expand Up @@ -79,6 +83,7 @@ Contributors
* Pedro M. Baeza
* Carlos Dauden
* Alexandre Díaz
* Juan José Seguí

* `Open Source Integrators <https://www.opensourceintegrators.com>`_:

Expand Down
1 change: 0 additions & 1 deletion project_timeline/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).

from .hooks import populate_date_start
from . import models
3 changes: 1 addition & 2 deletions project_timeline/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
{
"name": "Project timeline",
"summary": "Timeline view for projects",
"version": "14.0.1.5.0",
"version": "14.0.2.0.0",
"category": "Project Management",
"website": "https://github.com/OCA/project",
"author": "Tecnativa, Onestein, Odoo Community Association (OCA)",
Expand All @@ -18,5 +18,4 @@
"views/project_task_view.xml",
],
"demo": ["demo/project_project_demo.xml", "demo/project_task_demo.xml"],
"post_init_hook": "populate_date_start",
}
76 changes: 38 additions & 38 deletions project_timeline/demo/project_task_demo.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,191 +4,191 @@
<odoo>
<record id="project.project_task_1" model="project.task">
<field
name="date_assign"
name="planned_date_start"
eval="(DateTime.today() - timedelta(days=13)).strftime('%Y-%m-%d 00:00:00')"
/>
<field
name="date_end"
name="planned_date_end"
eval="(DateTime.today() - timedelta(days=6)).strftime('%Y-%m-%d 00:00:00')"
/>
</record>
<record id="project.project_task_2" model="project.task">
<field
name="date_assign"
name="planned_date_start"
eval="(DateTime.today() - timedelta(days=1)).strftime('%Y-%m-%d 00:00:00')"
/>
<field
name="date_end"
name="planned_date_end"
eval="(DateTime.today() + timedelta(days=1)).strftime('%Y-%m-%d 00:00:00')"
/>
</record>
<record id="project.project_task_3" model="project.task">
<field
name="date_assign"
name="planned_date_start"
eval="(DateTime.today() - timedelta(days=2)).strftime('%Y-%m-%d 00:00:00')"
/>
<field
name="date_end"
name="planned_date_end"
eval="(DateTime.today() + timedelta(days=1)).strftime('%Y-%m-%d 00:00:00')"
/>
</record>
<record id="project.project_task_4" model="project.task">
<field
name="date_assign"
name="planned_date_start"
eval="(DateTime.today() - timedelta(days=10)).strftime('%Y-%m-%d 00:00:00')"
/>
<field
name="date_end"
name="planned_date_end"
eval="(DateTime.today() - timedelta(days=6)).strftime('%Y-%m-%d 00:00:00')"
/>
</record>
<record id="project.project_task_5" model="project.task">
<field
name="date_assign"
name="planned_date_start"
eval="(DateTime.today() - timedelta(days=9)).strftime('%Y-%m-%d 00:00:00')"
/>
<field
name="date_end"
name="planned_date_end"
eval="(DateTime.today() - timedelta(days=2)).strftime('%Y-%m-%d 00:00:00')"
/>
</record>
<record id="project.project_task_6" model="project.task">
<field
name="date_assign"
name="planned_date_start"
eval="(DateTime.today() - timedelta(days=7)).strftime('%Y-%m-%d 00:00:00')"
/>
<field
name="date_end"
name="planned_date_end"
eval="(DateTime.today() - timedelta(days=2)).strftime('%Y-%m-%d 00:00:00')"
/>
</record>
<record id="project.project_task_7" model="project.task">
<field
name="date_assign"
name="planned_date_start"
eval="(DateTime.today() - timedelta(days=6)).strftime('%Y-%m-%d 00:00:00')"
/>
<field
name="date_end"
name="planned_date_end"
eval="(DateTime.today() - timedelta(days=3)).strftime('%Y-%m-%d 00:00:00')"
/>
</record>
<record id="project.project_task_8" model="project.task">
<field
name="date_assign"
name="planned_date_start"
eval="(DateTime.today() - timedelta(days=1)).strftime('%Y-%m-%d 00:00:00')"
/>
<field
name="date_end"
name="planned_date_end"
eval="(DateTime.today() + timedelta(days=10)).strftime('%Y-%m-%d 00:00:00')"
/>
</record>
<record id="project.project_task_9" model="project.task">
<field
name="date_assign"
name="planned_date_start"
eval="(DateTime.today() - timedelta(days=1)).strftime('%Y-%m-%d 00:00:00')"
/>
<field
name="date_end"
name="planned_date_end"
eval="(DateTime.today() + timedelta(days=6)).strftime('%Y-%m-%d 00:00:00')"
/>
</record>
<record id="project.project_task_10" model="project.task">
<field
name="date_assign"
name="planned_date_start"
eval="(DateTime.today() + timedelta(days=13)).strftime('%Y-%m-%d 00:00:00')"
/>
<field
name="date_end"
name="planned_date_end"
eval="(DateTime.today() + timedelta(days=23)).strftime('%Y-%m-%d 00:00:00')"
/>
</record>
<record id="project.project_task_11" model="project.task">
<field
name="date_assign"
name="planned_date_start"
eval="(DateTime.today() + timedelta(days=13)).strftime('%Y-%m-%d 00:00:00')"
/>
<field
name="date_end"
name="planned_date_end"
eval="(DateTime.today() + timedelta(days=23)).strftime('%Y-%m-%d 00:00:00')"
/>
</record>
<record id="project.project_task_12" model="project.task">
<field
name="date_assign"
name="planned_date_start"
eval="(DateTime.today() + timedelta(days=1)).strftime('%Y-%m-%d 00:00:00')"
/>
<field
name="date_end"
name="planned_date_end"
eval="(DateTime.today() + timedelta(days=20)).strftime('%Y-%m-%d 00:00:00')"
/>
</record>
<record id="project.project_task_19" model="project.task">
<field
name="date_assign"
name="planned_date_start"
eval="(DateTime.today() + timedelta(days=1)).strftime('%Y-%m-%d 00:00:00')"
/>
<field
name="date_end"
name="planned_date_end"
eval="(DateTime.today() + timedelta(days=10)).strftime('%Y-%m-%d 00:00:00')"
/>
</record>
<record id="project.project_task_20" model="project.task">
<field
name="date_assign"
name="planned_date_start"
eval="(DateTime.today() + timedelta(days=11)).strftime('%Y-%m-%d 00:00:00')"
/>
<field
name="date_end"
name="planned_date_end"
eval="(DateTime.today() + timedelta(days=15)).strftime('%Y-%m-%d 00:00:00')"
/>
</record>
<record id="project.project_task_21" model="project.task">
<field
name="date_assign"
name="planned_date_start"
eval="(DateTime.today() + timedelta(days=12)).strftime('%Y-%m-%d 00:00:00')"
/>
<field
name="date_end"
name="planned_date_end"
eval="(DateTime.today() + timedelta(days=20)).strftime('%Y-%m-%d 00:00:00')"
/>
</record>
<record id="project.project_task_22" model="project.task">
<field
name="date_assign"
name="planned_date_start"
eval="(DateTime.today() + timedelta(days=20)).strftime('%Y-%m-%d 00:00:00')"
/>
<field
name="date_end"
name="planned_date_end"
eval="(DateTime.today() + timedelta(days=22)).strftime('%Y-%m-%d 00:00:00')"
/>
</record>
<record id="project.project_task_24" model="project.task">
<field
name="date_assign"
name="planned_date_start"
eval="(DateTime.today() + timedelta(days=30)).strftime('%Y-%m-%d 00:00:00')"
/>
<field
name="date_end"
name="planned_date_end"
eval="(DateTime.today() + timedelta(days=32)).strftime('%Y-%m-%d 00:00:00')"
/>
</record>
<record id="project.project_task_25" model="project.task">
<field
name="date_assign"
name="planned_date_start"
eval="(DateTime.today() + timedelta(days=30)).strftime('%Y-%m-%d 00:00:00')"
/>
<field
name="date_end"
name="planned_date_end"
eval="(DateTime.today() + timedelta(days=35)).strftime('%Y-%m-%d 00:00:00')"
/>
</record>
<record id="project.project_task_26" model="project.task">
<field
name="date_assign"
name="planned_date_start"
eval="(DateTime.today() + timedelta(days=20)).strftime('%Y-%m-%d 00:00:00')"
/>
<field
name="date_end"
name="planned_date_end"
eval="(DateTime.today() + timedelta(days=50)).strftime('%Y-%m-%d 00:00:00')"
/>
</record>
Expand Down
16 changes: 0 additions & 16 deletions project_timeline/hooks.py

This file was deleted.

16 changes: 16 additions & 0 deletions project_timeline/migrations/14.0.2.0.0/post-migration.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Copyright 2024 Tecnativa - Juan José Seguí
# Copyright 2024 Tecnativa - Pedro M. Baeza
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).

from openupgradelib import openupgrade


@openupgrade.migrate()
def migrate(env, version):
openupgrade.logged_query(
env.cr,
"""UPDATE project_task
SET planned_date_end = date_end
WHERE planned_date_end IS NULL AND date_end IS NOT NULL;
""",
)
11 changes: 11 additions & 0 deletions project_timeline/migrations/14.0.2.0.0/pre-migration.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Copyright 2024 Tecnativa - Pedro M. Baeza
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).

from openupgradelib import openupgrade


@openupgrade.migrate()
def migrate(env, version):
openupgrade.rename_fields(
env, [("project.task", "project_task", "date_start", "planned_date_start")]
)
Loading
Loading