forked from avanzosc/project-addons
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ADD] Add module project_task_date_compute (avanzosc#286)
Co-authored-by: Ana Juaristi <[email protected]>
- Loading branch information
1 parent
da474a1
commit a3ceea7
Showing
8 changed files
with
105 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
.. image:: https://img.shields.io/badge/license-AGPL--3-blue.png | ||
:target: https://www.gnu.org/licenses/agpl | ||
:alt: License: AGPL-3 | ||
|
||
================================ | ||
Compute Task Start and End Dates | ||
================================ | ||
|
||
* Compute the start and end dates of tasks. | ||
* This modules uses timesheet_ids to compute the start and end dates. | ||
|
||
Bug Tracker | ||
=========== | ||
|
||
Bugs are tracked on `GitHub Issues | ||
<https://github.com/avanzosc/project-addons/issues>`_. In case of trouble, please | ||
check there if your issue has already been reported. If you spotted it first, | ||
help us smash it by providing detailed and welcomed feedback. | ||
|
||
Do not contact contributors directly about support or help with technical issues. | ||
|
||
Credits | ||
======= | ||
|
||
Contributors | ||
------------ | ||
|
||
* Unai Beristain <[email protected]> | ||
* Ana Juaristi <[email protected]> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
from . import models |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# Copyright 2024 Unai Beristain - AvanzOSC | ||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). | ||
|
||
{ | ||
"name": "Compute Task Start and End Dates", | ||
"summary": "Module to compute task start and end dates based on time entries and stage", | ||
"website": "https://github.com/avanzosc/project-addons", | ||
"license": "AGPL-3", | ||
"author": "AvanzOSC", | ||
"version": "14.0.1.0.0", | ||
"depends": ["base", "project", "hr_timesheet"], | ||
"data": [ | ||
"views/project_task_views.xml", | ||
], | ||
"installable": True, | ||
"auto_install": False, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
from . import project_task |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
from odoo import api, fields, models | ||
|
||
|
||
class ProjectTask(models.Model): | ||
_inherit = "project.task" | ||
|
||
start_date = fields.Date( | ||
string="Start Date", compute="_compute_start_date", store=True | ||
) | ||
end_date = fields.Date(string="End Date", compute="_compute_end_date", store=True) | ||
|
||
@api.depends("timesheet_ids.date") | ||
def _compute_start_date(self): | ||
for task in self: | ||
task.start_date = min(task.timesheet_ids.mapped("date"), default=False) | ||
|
||
@api.depends("timesheet_ids.date", "stage_id") | ||
def _compute_end_date(self): | ||
for task in self: | ||
if task.stage_id.fold: | ||
task.end_date = max(task.timesheet_ids.mapped("date"), default=False) | ||
else: | ||
task.end_date = False |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<?xml version="1.0" encoding="utf-8" ?> | ||
<odoo> | ||
<record id="view_project_task_tree_inherit" model="ir.ui.view"> | ||
<field name="name">project.task.tree.inherit</field> | ||
<field name="model">project.task</field> | ||
<field name="inherit_id" ref="project.view_task_tree2" /> | ||
<field name="arch" type="xml"> | ||
<xpath expr="//tree" position="inside"> | ||
<field name="create_date" /> | ||
</xpath> | ||
</field> | ||
</record> | ||
|
||
<record id="view_project_task_form_inherit" model="ir.ui.view"> | ||
<field name="name">project.task.form.inherit</field> | ||
<field name="model">project.task</field> | ||
<field name="inherit_id" ref="project.view_task_form2" /> | ||
<field name="arch" type="xml"> | ||
<xpath expr="//page[@name='extra_info']/group[1]/group[1]" position="after"> | ||
<group> | ||
<field name="start_date" /> | ||
<field name="end_date" /> | ||
</group> | ||
</xpath> | ||
</field> | ||
</record> | ||
</odoo> |
1 change: 1 addition & 0 deletions
1
setup/project_task_date_compute/odoo/addons/project_task_date_compute
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../../../../project_task_date_compute |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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, | ||
) |