diff --git a/project_forecast_line/README.rst b/project_forecast_line/README.rst index 87c7d75b27..9c687b7c46 100644 --- a/project_forecast_line/README.rst +++ b/project_forecast_line/README.rst @@ -2,28 +2,31 @@ Project Forecast Lines ====================== -.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +.. + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !! This file is generated by oca-gen-addon-readme !! !! changes will be overwritten. !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! source digest: sha256:ac7a08e6fe5c0e7077d1cce6be17d8d27eaf4edfa319b460c0922489f185c6c3 + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -.. |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 .. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fproject-lightgray.png?logo=github - :target: https://github.com/OCA/project/tree/15.0/project_forecast_line + :target: https://github.com/OCA/project/tree/14.0/project_forecast_line :alt: OCA/project .. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png - :target: https://translation.odoo-community.org/projects/project-15-0/project-15-0-project_forecast_line + :target: https://translation.odoo-community.org/projects/project-14-0/project-14-0-project_forecast_line :alt: Translate me on Weblate -.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png - :target: https://runbot.odoo-community.org/runbot/140/15.0 - :alt: Try me on Runbot +.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png + :target: https://runboat.odoo-community.org/builds?repo=OCA/project&target_branch=14.0 + :alt: Try me on Runboat -|badge1| |badge2| |badge3| |badge4| |badge5| +|badge1| |badge2| |badge3| |badge4| |badge5| This module allows to plan your resources using forecast lines. @@ -45,6 +48,18 @@ whether the consumption is confirmed or not. For instance, holidays requests and sales quotation lines create lines of type "forecast", whereas tasks for project which are in a running state create lines with type "confirmed". +To get the best experience using the Forecast application you may want to install: + +* project_forecast_line_holidays_public module which takes public holidays into + account during forecast lines creation + +* project_forecast_line_bokeh_chart module which improves the reports of + project_forecast_line module by using the bokeh widget available in OCA/web + +.. 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** @@ -57,7 +72,7 @@ Usage Forecast lines have the following data: * Forecast hours: it is positive for resources (employees) and negative for - things which consume time + things which consume time (project tasks, for instance) * From and To date which are the beginning and ending of the period of the capacity @@ -72,6 +87,9 @@ Forecast lines have the following data: positive if the employee still has some free time, and negative if he is overloaded with work. + * this consolidated forecast is currently converted to days to ease + readability of the forecast report + Objects creating forecast lines: @@ -87,9 +105,9 @@ Objects creating forecast lines: * confirmed sale orders don't create forecast lines. This is handled by the tasks created at the confirmation of the sale order -* project tasks create forecast lines if they have a linked role and start/end - date. The type of the line will depend on the related project's stage. The - forecast quantity is based on the remaining time of the task, which is spread +* project tasks create forecast lines if they have a linked role and planned start/end + dates. The type of the line will depend on the related project's stage. The + `forecast_hours` field is based on the remaining time of the task, which is spread on the work days of the planned start and end date of the task. If the current date is in the middle of the planned duration of the task, it is used as the start date. If the planned end date is in the past the task does not @@ -104,15 +122,23 @@ Objects creating forecast lines: work calendar of the employee: the employee will not have a positive line associated to his leave days. - +The creation of forecast lines is done either in real time when some actions +are performed by the user (requesting leaves, updating the remaining time on a +project task, timesheeting) and also via a cron that runs on a daily basis. The +cron is required to cleanup lines related to dates in the past and to recompute +the lines related to project tasks by computing the ratio of remaing time on +the tasks on the remaining days, for tasks which are in progress. So, to start +using consolidated forecast report you first need to set everything mentioned +in Usage section. Then, probably run Forecast recomputation cron manually from +Scheduled Actions or wait till cron creates records. 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 smashing it by providing a detailed and welcomed -`feedback `_. +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. @@ -143,6 +169,6 @@ 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/project `_ project on GitHub. +This module is part of the `OCA/project `_ project on GitHub. You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/project_forecast_line/models/hr_employee.py b/project_forecast_line/models/hr_employee.py index 886ccaa0e7..718a0dd8a2 100644 --- a/project_forecast_line/models/hr_employee.py +++ b/project_forecast_line/models/hr_employee.py @@ -36,11 +36,13 @@ def _compute_main_role_id(self): # can"t store as it depends on current date today = fields.Date.context_today(self) for rec in self: - rec.main_role_id = rec.role_ids.filtered( - lambda r: r.date_start <= today and (r.date_end >= today) - if r.date_end - else True - )[:1].role_id + rec.main_role_id = fields.first( + rec.role_ids.filtered( + lambda r: r.date_start <= today and (r.date_end >= today) + if r.date_end + else True + ) + ).role_id def write(self, values): values = self._check_job_role(values) diff --git a/project_forecast_line/models/project_task.py b/project_forecast_line/models/project_task.py index faa514eddb..689715e4ac 100644 --- a/project_forecast_line/models/project_task.py +++ b/project_forecast_line/models/project_task.py @@ -21,18 +21,6 @@ class ProjectTask(models.Model): help="Technical field used to trigger the forecast recomputation", ) - @api.model_create_multi - def create(self, vals_list): - # compatibility with fields from project_enterprise - for vals in vals_list: - if vals.get("planned_date_begin"): - vals["forecast_date_planned_start"] = vals["planned_date_begin"] - if vals.get("planned_date_end"): - vals["forecast_date_planned_end"] = vals["planned_date_end"] - tasks = super().create(vals_list) - # tasks._update_forecast_lines() - return tasks - def _update_forecast_lines_trigger_fields(self): return [ # "sale_order_line_id", @@ -53,14 +41,6 @@ def _compute_forecast_recomputation_trigger(self): for rec in self: rec.forecast_recomputation_trigger = value - def write(self, values): - # compatibility with fields from project_enterprise - if "planned_date_begin" in values: - values["forecast_date_planned_start"] = values["planned_date_begin"] - if "planned_date_end" in values: - values["forecast_date_planned_end"] = values["planned_date_end"] - return super().write(values) - def _write(self, values): res = super()._write(values) if self.env.context.get("project_forecast_line_task_noloop"): diff --git a/project_forecast_line/static/description/index.html b/project_forecast_line/static/description/index.html index 29058b0689..9c1a70155e 100644 --- a/project_forecast_line/static/description/index.html +++ b/project_forecast_line/static/description/index.html @@ -1,20 +1,20 @@ - + - + Project Forecast Lines