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

[MIG] [17.0] project_task_personal_stage_auto_fold #1344

Open
wants to merge 23 commits into
base: 17.0
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
2dd2408
Auto fold task on Personal Stage when is closed
Shide Feb 9, 2022
0487f90
Update project_task_personal_stage_auto_fold.pot
Feb 15, 2022
699af30
README.rst
OCA-git-bot Feb 15, 2022
5c600f8
Tests
Shide Feb 16, 2022
0aadfa7
project_task_personal_stage_auto_fold 15.0.1.0.1
OCA-git-bot Feb 16, 2022
288a1d8
project_task_personal_stage_auto_fold: Setting types in setUp makes o…
CarlosRoca13 Nov 3, 2022
f65930e
project_task_personal_stage_auto_fold 15.0.1.0.2
OCA-git-bot Nov 3, 2022
9dee683
project_task_personal_stage_auto_fold: improve readme
Shide Nov 15, 2022
159cc9b
README.rst
OCA-git-bot Nov 23, 2022
123e645
project_task_personal_stage_auto_fold 15.0.1.0.3
OCA-git-bot Nov 23, 2022
356689a
project_task_personal_stage_auto_fold: Migration to 16.0
emagdalenaC2i Nov 29, 2022
9304db5
Update project_task_personal_stage_auto_fold.pot
Jan 23, 2023
29b3a21
README.rst
OCA-git-bot Jan 23, 2023
43f22cd
Added translation using Weblate (Croatian)
badbole Feb 15, 2023
0844ac0
Translated using Weblate (Croatian)
badbole Feb 15, 2023
5eca5f3
Added translation using Weblate (Italian)
mymage Apr 10, 2023
f3f324d
Translated using Weblate (Italian)
mymage Apr 10, 2023
5fcdf84
Added translation using Weblate (Portuguese (Brazil))
adrianojprado Jul 30, 2023
ff03b95
Translated using Weblate (Portuguese (Brazil))
adrianojprado Jul 30, 2023
16c51e5
README.rst
OCA-git-bot Sep 3, 2023
b1f6567
Added translation using Weblate (Spanish)
Ivorra78 Sep 7, 2023
1cd71bb
Translated using Weblate (Spanish)
Ivorra78 Sep 7, 2023
154ea2f
[MIG] project_task_personal_stage_auto_fold: Migrated to v17
nikul-serpentcs Sep 28, 2024
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
113 changes: 113 additions & 0 deletions project_task_personal_stage_auto_fold/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
=====================================
Project Task Personal Stage auto Fold
=====================================

..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:ab59448fc27c5eebf9d0731a3a219ba63741d244c865b66c1c16e109aede491d
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
:target: https://odoo-community.org/page/development-status
:alt: Beta
.. |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/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-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=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.

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

**Table of contents**

.. contents::
:local:

Configuration
=============

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.

Usage
=====

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

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:%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/>`__:

- Eduardo de Miguel <[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.

.. image:: https://odoo-community.org/logo.png
:alt: Odoo Community Association
:target: https://odoo-community.org

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/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.
1 change: 1 addition & 0 deletions project_task_personal_stage_auto_fold/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import models
15 changes: 15 additions & 0 deletions project_task_personal_stage_auto_fold/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Copyright 2022 Moduon - Eduardo de Miguel <[email protected]>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

{
"name": "Project Task Personal Stage auto Fold",
"summary": "Moves task to the first fold personal stage when done",
"version": "17.0.1.0.0",
"category": "Project",
"website": "https://github.com/OCA/project",
"author": "Moduon, Odoo Community Association (OCA)",
"license": "AGPL-3",
"depends": ["project"],
"data": [],
"installable": True,
}
22 changes: 22 additions & 0 deletions project_task_personal_stage_auto_fold/i18n/es.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * project_task_personal_stage_auto_fold
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 16.0\n"
"Report-Msgid-Bugs-To: \n"
"PO-Revision-Date: 2023-09-07 16:36+0000\n"
"Last-Translator: Ivorra78 <[email protected]>\n"
"Language-Team: none\n"
"Language: es\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: nplurals=2; plural=n != 1;\n"
"X-Generator: Weblate 4.17\n"

#. module: project_task_personal_stage_auto_fold
#: model:ir.model,name:project_task_personal_stage_auto_fold.model_project_task
msgid "Task"
msgstr "Tarea"
23 changes: 23 additions & 0 deletions project_task_personal_stage_auto_fold/i18n/hr.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * project_task_personal_stage_auto_fold
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 16.0\n"
"Report-Msgid-Bugs-To: \n"
"PO-Revision-Date: 2023-02-15 17:23+0000\n"
"Last-Translator: Bole <[email protected]>\n"
"Language-Team: none\n"
"Language: hr\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: nplurals=3; plural=n%10==1 && n%100!=11 ? 0 : n%10>=2 && n"
"%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2;\n"
"X-Generator: Weblate 4.14.1\n"

#. module: project_task_personal_stage_auto_fold
#: model:ir.model,name:project_task_personal_stage_auto_fold.model_project_task
msgid "Task"
msgstr "Zadatak"
22 changes: 22 additions & 0 deletions project_task_personal_stage_auto_fold/i18n/it.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * project_task_personal_stage_auto_fold
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 16.0\n"
"Report-Msgid-Bugs-To: \n"
"PO-Revision-Date: 2023-04-10 21:22+0000\n"
"Last-Translator: mymage <[email protected]>\n"
"Language-Team: none\n"
"Language: it\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: nplurals=2; plural=n != 1;\n"
"X-Generator: Weblate 4.14.1\n"

#. module: project_task_personal_stage_auto_fold
#: model:ir.model,name:project_task_personal_stage_auto_fold.model_project_task
msgid "Task"
msgstr "Lavoro"
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * project_task_personal_stage_auto_fold
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 16.0\n"
"Report-Msgid-Bugs-To: \n"
"Last-Translator: \n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"

#. module: project_task_personal_stage_auto_fold
#: model:ir.model,name:project_task_personal_stage_auto_fold.model_project_task
msgid "Task"
msgstr ""
22 changes: 22 additions & 0 deletions project_task_personal_stage_auto_fold/i18n/pt_BR.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * project_task_personal_stage_auto_fold
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 16.0\n"
"Report-Msgid-Bugs-To: \n"
"PO-Revision-Date: 2023-07-30 14:10+0000\n"
"Last-Translator: Adriano Prado <[email protected]>\n"
"Language-Team: none\n"
"Language: pt_BR\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: nplurals=2; plural=n > 1;\n"
"X-Generator: Weblate 4.17\n"

#. module: project_task_personal_stage_auto_fold
#: model:ir.model,name:project_task_personal_stage_auto_fold.model_project_task
msgid "Task"
msgstr "Tarefa"
1 change: 1 addition & 0 deletions project_task_personal_stage_auto_fold/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import project_task
41 changes: 41 additions & 0 deletions project_task_personal_stage_auto_fold/models/project_task.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
from odoo import models


class Task(models.Model):
_inherit = "project.task"

def write(self, vals):
result = super().write(vals)
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"]
.search(
[
("user_id", "=", self.env.user.id),
("fold", "=", True),
],
)
.sorted(lambda ptt: ptt.fold, reverse=True)
)
# 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]
Copy link

Choose a reason for hiding this comment

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

This will fail when the user deleted all the folded stages, probably just return when no folded_stages are found

Suggested change
default_stage = folded_stages[0]
default_stage = folded_stages[0]

for task in self:
task.personal_stage_type_id = stage_by_name.get(
task.stage_id.name,
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"
4 changes: 4 additions & 0 deletions project_task_personal_stage_auto_fold/readme/CONFIGURE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
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]>\>

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
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Loading