Skip to content

Commit

Permalink
[UPD] views, formatting, contributors
Browse files Browse the repository at this point in the history
  • Loading branch information
ntsirintanis committed Feb 8, 2024
1 parent b2438cc commit da08e38
Show file tree
Hide file tree
Showing 8 changed files with 195 additions and 162 deletions.
12 changes: 9 additions & 3 deletions project_forecast_line_priority/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ Project Forecast Line Priority
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:091a78dee8b45f24db001b17ab2fd0a09ad9ca887e8f39d6135473126935afe8
!! source digest: sha256:5dc5edab8806a01382424f844da33b49a42bf47b328a2843830f8293e10eeebe
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
.. |badge1| image:: https://img.shields.io/badge/maturity-Alpha-red.png
:target: https://odoo-community.org/page/development-status
:alt: Beta
: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
Expand All @@ -30,6 +30,11 @@ Project Forecast Line Priority

This module recomputes forecast line end dates based on the priority of connected task(s)

.. 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::
Expand Down Expand Up @@ -57,6 +62,7 @@ Contributors
~~~~~~~~~~~~

* Nikos Tsirintanis <ntsirintanis@therp.nl>
* Gijs-Jan Otten <gjotten@therp.nl@therp.nl>

Maintainers
~~~~~~~~~~~
Expand Down
1 change: 1 addition & 0 deletions project_forecast_line_priority/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,5 @@
"depends": ["project_forecast_line_deadline", "project_task_add_very_high"],
"data": ["data/ir_actions_server.xml", "views/res_config_settings.xml"],
"installable": True,
"development_status": "Alpha",
}
4 changes: 3 additions & 1 deletion project_forecast_line_priority/data/ir_actions_server.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@
for record in records:
new_forecast_date_planned_end = record._get_forecast_date_planned()
if new_forecast_date_planned_end:
record.write({"forecast_date_planned_end": new_forecast_date_planned_end})
record.write({
"forecast_date_planned_end": new_forecast_date_planned_end,
})
</field>
</record>
</odoo>
19 changes: 9 additions & 10 deletions project_forecast_line_priority/models/project_task.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,6 @@
class ProjectTask(models.Model):
_inherit = "project.task"

def _update_forecast_lines(self):
"""Override cron method"""
for this in self:
forecast_date_planned_end = this._get_forecast_date_planned()
if not forecast_date_planned_end:
continue
# and recompute end date for forecast
this.forecast_date_planned_end = forecast_date_planned_end
return super()._update_forecast_lines()

def write(self, vals):
"""Set forecast_date_planned_end based on priority"""
# If user sets end date manually
Expand All @@ -41,6 +31,15 @@ def write(self, vals):
vals["forecast_date_planned_end"] = forecast_date_planned_end
return super().write(vals)

def _update_forecast_lines(self):
"""Override cron method and inject forecast date recomputation"""
for task in self:
forecast_date_planned_end = task._get_forecast_date_planned()
if not forecast_date_planned_end:
continue
task.forecast_date_planned_end = forecast_date_planned_end
return super()._update_forecast_lines()

def _get_forecast_date_planned(self, priority=None):
"""Update forecast date end based on priority"""
config_model = self.env["ir.config_parameter"]
Expand Down
25 changes: 8 additions & 17 deletions project_forecast_line_priority/models/res_config_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,22 +75,13 @@ class ResConfigSettings(models.TransientModel):
)

def _inverse_forecast_line_priority_date_str(self):
"""As config_parameters does not accept Date field,
we store the date formated string into a Char config field"""
"""Store the date into a retrievable char field"""
for setting in self:
if setting.forecast_line_priority_0_date:
setting.forecast_line_priority_0_date_str = fields.Date.to_string(
setting.forecast_line_priority_0_date
)
if setting.forecast_line_priority_1_date:
setting.forecast_line_priority_1_date_str = fields.Date.to_string(
setting.forecast_line_priority_1_date
)
if setting.forecast_line_priority_2_date:
setting.forecast_line_priority_2_date_str = fields.Date.to_string(
setting.forecast_line_priority_2_date
)
if setting.forecast_line_priority_3_date:
setting.forecast_line_priority_3_date_str = fields.Date.to_string(
setting.forecast_line_priority_3_date
for priority in range(4):
if not setting["forecast_line_priority_%s_date" % priority]:
continue
setting[
"forecast_line_priority_%s_date_str" % priority
] = fields.Date.to_string(
setting["forecast_line_priority_%s_date" % priority]
)
1 change: 1 addition & 0 deletions project_forecast_line_priority/readme/CONTRIBUTORS.rst
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
* Nikos Tsirintanis <ntsirintanis@therp.nl>
* Gijs-Jan Otten <gjotten@therp.nl@therp.nl>
11 changes: 9 additions & 2 deletions project_forecast_line_priority/static/description/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -367,10 +367,16 @@ <h1 class="title">Project Forecast Line Priority</h1>
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:091a78dee8b45f24db001b17ab2fd0a09ad9ca887e8f39d6135473126935afe8
!! source digest: sha256:5dc5edab8806a01382424f844da33b49a42bf47b328a2843830f8293e10eeebe
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/project/tree/14.0/project_forecast_line_priority"><img alt="OCA/project" src="https://img.shields.io/badge/github-OCA%2Fproject-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/project-14-0/project-14-0-project_forecast_line_priority"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/project&amp;target_branch=14.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Alpha" src="https://img.shields.io/badge/maturity-Alpha-red.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/project/tree/14.0/project_forecast_line_priority"><img alt="OCA/project" src="https://img.shields.io/badge/github-OCA%2Fproject-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/project-14-0/project-14-0-project_forecast_line_priority"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/project&amp;target_branch=14.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
<p>This module recomputes forecast line end dates based on the priority of connected task(s)</p>
<div class="admonition important">
<p class="first admonition-title">Important</p>
<p class="last">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.
<a class="reference external" href="https://odoo-community.org/page/development-status">More details on development status</a></p>
</div>
<p><strong>Table of contents</strong></p>
<div class="contents local topic" id="contents">
<ul class="simple">
Expand Down Expand Up @@ -403,6 +409,7 @@ <h2><a class="toc-backref" href="#toc-entry-3">Authors</a></h2>
<h2><a class="toc-backref" href="#toc-entry-4">Contributors</a></h2>
<ul class="simple">
<li>Nikos Tsirintanis &lt;<a class="reference external" href="mailto:ntsirintanis&#64;therp.nl">ntsirintanis&#64;therp.nl</a>&gt;</li>
<li>Gijs-Jan Otten &lt;<a class="reference external" href="mailto:gjotten&#64;therp">gjotten&#64;therp</a>.nl&#64;therp.nl&gt;</li>
</ul>
</div>
<div class="section" id="maintainers">
Expand Down
Loading

0 comments on commit da08e38

Please sign in to comment.