Skip to content

Commit

Permalink
[MIG] project_task_personal_stage_auto_fold: Migrated to v17
Browse files Browse the repository at this point in the history
  • Loading branch information
nikul-serpentcs committed Sep 28, 2024
1 parent 1cd71bb commit 8cebca3
Show file tree
Hide file tree
Showing 12 changed files with 85 additions and 69 deletions.
50 changes: 27 additions & 23 deletions project_task_personal_stage_auto_fold/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,30 +17,31 @@ Project Task Personal Stage auto Fold
: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/16.0/project_task_personal_stage_auto_fold
:target: https://github.com/OCA/project/tree/17.0/project_task_personal_stage_auto_fold
:alt: OCA/project
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/project-16-0/project-16-0-project_task_personal_stage_auto_fold
:target: https://translation.odoo-community.org/projects/project-17-0/project-17-0-project_task_personal_stage_auto_fold
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
:target: https://runboat.odoo-community.org/builds?repo=OCA/project&target_branch=16.0
:target: https://runboat.odoo-community.org/builds?repo=OCA/project&target_branch=17.0
:alt: Try me on Runboat

|badge1| |badge2| |badge3| |badge4| |badge5|

When you close a task, its personal stage will change as well.

This module simplifies to close or to cancel a task from the project stage
and the personal stage.
This module simplifies to close or to cancel a task from the project
stage and the personal stage.

In the case a task is assigned to more than one user,
only the personal task stage of the user will be updated.
In the case a task is assigned to more than one user, only the personal
task stage of the user will be updated.

Notice: This module don't change the project task stage from the personal task stage.
It is intended so no change about this functionality is desired or required.
Furthermore, also is intended that only the personal stage of the user who finish
the task with the project task stage will be update. So the other users assigned to
the task have to update the personal task stage manually when they finish it
Notice: This module don't change the project task stage from the
personal task stage. It is intended so no change about this
functionality is desired or required. Furthermore, also is intended that
only the personal stage of the user who finish the task with the project
task stage will be update. So the other users assigned to the task have
to update the personal task stage manually when they finish it

**Table of contents**

Expand All @@ -50,8 +51,8 @@ the task have to update the personal task stage manually when they finish it
Configuration
=============

The task stages "Done" and "Canceled" must match the same name as the equivalent
personal stages.
The task stages "Done" and "Canceled" must match the same name as the
equivalent personal stages.

The checkbox “Closing stage” must be checked in the stage configuration.

Expand All @@ -69,30 +70,33 @@ Bug Tracker
Bugs are tracked on `GitHub Issues <https://github.com/OCA/project/issues>`_.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us to smash it by providing a detailed and welcomed
`feedback <https://github.com/OCA/project/issues/new?body=module:%20project_task_personal_stage_auto_fold%0Aversion:%2016.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
`feedback <https://github.com/OCA/project/issues/new?body=module:%20project_task_personal_stage_auto_fold%0Aversion:%2017.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.

Do not contact contributors directly about support or help with technical issues.

Credits
=======

Authors
~~~~~~~
-------

* Moduon

Contributors
~~~~~~~~~~~~
------------

* `Moduon <http://moduon.team/>`_:
- `Moduon <http://moduon.team/>`__:

* Eduardo de Miguel <[email protected]>
* `C2i Change 2 improve <http://c2i.es/>`_:
- Eduardo de Miguel <[email protected]>

* Eduardo Magdalena <[email protected]>
- `C2i Change 2 improve <http://c2i.es/>`__:

- Eduardo Magdalena <[email protected]>

- Nikul Chaudhary <[email protected]>

Maintainers
~~~~~~~~~~~
-----------

This module is maintained by the OCA.

Expand All @@ -104,6 +108,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 <https://github.com/OCA/project/tree/16.0/project_task_personal_stage_auto_fold>`_ project on GitHub.
This module is part of the `OCA/project <https://github.com/OCA/project/tree/17.0/project_task_personal_stage_auto_fold>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
2 changes: 1 addition & 1 deletion project_task_personal_stage_auto_fold/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
{
"name": "Project Task Personal Stage auto Fold",
"summary": "Moves task to the first fold personal stage when done",
"version": "16.0.1.0.0",
"version": "17.0.1.0.0",
"category": "Project",
"website": "https://github.com/OCA/project",
"author": "Moduon, Odoo Community Association (OCA)",
Expand Down
16 changes: 11 additions & 5 deletions project_task_personal_stage_auto_fold/models/project_task.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,19 @@ class Task(models.Model):

def write(self, vals):
result = super().write(vals)
if (
vals.get("stage_id")
and self.env["project.task.type"].browse(vals.get("stage_id")).fold
):
stage_id = vals.get("stage_id")
if stage_id and self.env["project.task.type"].browse(stage_id).fold:
self._fold_personal_stage_task()
return result

def _fold_personal_stage_task(self):
"""
Assigns a folded personal stage to tasks when they are moved to a folded stage.
The function finds all folded stages associated with the current user and
applies the best matching personal stage based on the task's stage name. If
no exact match is found, the first available folded personal stage is assigned.
"""

# Find all folded personal stages
folded_stages = (
self.env["project.task.type"]
Expand All @@ -30,8 +35,9 @@ def _fold_personal_stage_task(self):
# Allow to find personal stage with same name as shared stage
stage_by_name = {stage.name: stage for stage in folded_stages}
# Apply best matching personal stage
default_stage = folded_stages[0]
for task in self:
task.personal_stage_type_id = stage_by_name.get(
task.stage_id.name,
folded_stages[0],
default_stage,
)
3 changes: 3 additions & 0 deletions project_task_personal_stage_auto_fold/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[build-system]
requires = ["whool"]
build-backend = "whool.buildapi"
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
The task stages "Done" and "Canceled" must match the same name as the equivalent
personal stages.
The task stages "Done" and "Canceled" must match the same name as the
equivalent personal stages.

The checkbox “Closing stage” must be checked in the stage configuration.
7 changes: 7 additions & 0 deletions project_task_personal_stage_auto_fold/readme/CONTRIBUTORS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
- [Moduon](http://moduon.team/):
- Eduardo de Miguel \<<[email protected]>\>
- [C2i Change 2 improve](http://c2i.es/):
- Eduardo Magdalena \<<[email protected]>\>

- Nikul Chaudhary \<<[email protected]>\>

6 changes: 0 additions & 6 deletions project_task_personal_stage_auto_fold/readme/CONTRIBUTORS.rst

This file was deleted.

14 changes: 14 additions & 0 deletions project_task_personal_stage_auto_fold/readme/DESCRIPTION.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
When you close a task, its personal stage will change as well.

This module simplifies to close or to cancel a task from the project
stage and the personal stage.

In the case a task is assigned to more than one user, only the personal
task stage of the user will be updated.

Notice: This module don't change the project task stage from the
personal task stage. It is intended so no change about this
functionality is desired or required. Furthermore, also is intended that
only the personal stage of the user who finish the task with the project
task stage will be update. So the other users assigned to the task have
to update the personal task stage manually when they finish it
13 changes: 0 additions & 13 deletions project_task_personal_stage_auto_fold/readme/DESCRIPTION.rst

This file was deleted.

4 changes: 4 additions & 0 deletions project_task_personal_stage_auto_fold/readme/USAGE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
1. Go to Projects \> Select one \> Select a task assigned to you
2. Change the stage to Done or to Canceled
3. Go to My Tasks \> Select the same task
4. As you can see, the personal stage has also changed
4 changes: 0 additions & 4 deletions project_task_personal_stage_auto_fold/readme/USAGE.rst

This file was deleted.

31 changes: 16 additions & 15 deletions project_task_personal_stage_auto_fold/static/description/index.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
Expand Down Expand Up @@ -369,17 +368,18 @@ <h1 class="title">Project Task Personal Stage auto Fold</h1>
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:ab59448fc27c5eebf9d0731a3a219ba63741d244c865b66c1c16e109aede491d
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<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/16.0/project_task_personal_stage_auto_fold"><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-16-0/project-16-0-project_task_personal_stage_auto_fold"><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=16.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="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/17.0/project_task_personal_stage_auto_fold"><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-17-0/project-17-0-project_task_personal_stage_auto_fold"><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=17.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
<p>When you close a task, its personal stage will change as well.</p>
<p>This module simplifies to close or to cancel a task from the project stage
and the personal stage.</p>
<p>In the case a task is assigned to more than one user,
only the personal task stage of the user will be updated.</p>
<p>Notice: This module don’t change the project task stage from the personal task stage.
It is intended so no change about this functionality is desired or required.
Furthermore, also is intended that only the personal stage of the user who finish
the task with the project task stage will be update. So the other users assigned to
the task have to update the personal task stage manually when they finish it</p>
<p>This module simplifies to close or to cancel a task from the project
stage and the personal stage.</p>
<p>In the case a task is assigned to more than one user, only the personal
task stage of the user will be updated.</p>
<p>Notice: This module don’t change the project task stage from the
personal task stage. It is intended so no change about this
functionality is desired or required. Furthermore, also is intended that
only the personal stage of the user who finish the task with the project
task stage will be update. So the other users assigned to the task have
to update the personal task stage manually when they finish it</p>
<p><strong>Table of contents</strong></p>
<div class="contents local topic" id="contents">
<ul class="simple">
Expand All @@ -396,8 +396,8 @@ <h1 class="title">Project Task Personal Stage auto Fold</h1>
</div>
<div class="section" id="configuration">
<h1><a class="toc-backref" href="#toc-entry-1">Configuration</a></h1>
<p>The task stages “Done” and “Canceled” must match the same name as the equivalent
personal stages.</p>
<p>The task stages “Done” and “Canceled” must match the same name as the
equivalent personal stages.</p>
<p>The checkbox “Closing stage” must be checked in the stage configuration.</p>
</div>
<div class="section" id="usage">
Expand All @@ -414,7 +414,7 @@ <h1><a class="toc-backref" href="#toc-entry-3">Bug Tracker</a></h1>
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/project/issues">GitHub Issues</a>.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us to smash it by providing a detailed and welcomed
<a class="reference external" href="https://github.com/OCA/project/issues/new?body=module:%20project_task_personal_stage_auto_fold%0Aversion:%2016.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
<a class="reference external" href="https://github.com/OCA/project/issues/new?body=module:%20project_task_personal_stage_auto_fold%0Aversion:%2017.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
<p>Do not contact contributors directly about support or help with technical issues.</p>
</div>
<div class="section" id="credits">
Expand All @@ -436,6 +436,7 @@ <h2><a class="toc-backref" href="#toc-entry-6">Contributors</a></h2>
<li>Eduardo Magdalena &lt;<a class="reference external" href="mailto:emagdalena&#64;c2i.es">emagdalena&#64;c2i.es</a>&gt;</li>
</ul>
</li>
<li>Nikul Chaudhary &lt;<a class="reference external" href="mailto:nikul.chaudhary.serpentcs&#64;gmail.com">nikul.chaudhary.serpentcs&#64;gmail.com</a>&gt;</li>
</ul>
</div>
<div class="section" id="maintainers">
Expand All @@ -445,7 +446,7 @@ <h2><a class="toc-backref" href="#toc-entry-7">Maintainers</a></h2>
<p>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.</p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/project/tree/16.0/project_task_personal_stage_auto_fold">OCA/project</a> project on GitHub.</p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/project/tree/17.0/project_task_personal_stage_auto_fold">OCA/project</a> project on GitHub.</p>
<p>You are welcome to contribute. To learn how please visit <a class="reference external" href="https://odoo-community.org/page/Contribute">https://odoo-community.org/page/Contribute</a>.</p>
</div>
</div>
Expand Down

0 comments on commit 8cebca3

Please sign in to comment.