-
-
Notifications
You must be signed in to change notification settings - Fork 791
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
nikul-serpentcs
wants to merge
23
commits into
OCA:17.0
Choose a base branch
from
nikul-serpentcs:17_mig_project_task_personal_stage_auto_fold
base: 17.0
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
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 0487f90
Update project_task_personal_stage_auto_fold.pot
699af30
README.rst
OCA-git-bot 5c600f8
Tests
Shide 0aadfa7
project_task_personal_stage_auto_fold 15.0.1.0.1
OCA-git-bot 288a1d8
project_task_personal_stage_auto_fold: Setting types in setUp makes o…
CarlosRoca13 f65930e
project_task_personal_stage_auto_fold 15.0.1.0.2
OCA-git-bot 9dee683
project_task_personal_stage_auto_fold: improve readme
Shide 159cc9b
README.rst
OCA-git-bot 123e645
project_task_personal_stage_auto_fold 15.0.1.0.3
OCA-git-bot 356689a
project_task_personal_stage_auto_fold: Migration to 16.0
emagdalenaC2i 9304db5
Update project_task_personal_stage_auto_fold.pot
29b3a21
README.rst
OCA-git-bot 43f22cd
Added translation using Weblate (Croatian)
badbole 0844ac0
Translated using Weblate (Croatian)
badbole 5eca5f3
Added translation using Weblate (Italian)
mymage f3f324d
Translated using Weblate (Italian)
mymage 5fcdf84
Added translation using Weblate (Portuguese (Brazil))
adrianojprado ff03b95
Translated using Weblate (Portuguese (Brazil))
adrianojprado 16c51e5
README.rst
OCA-git-bot b1f6567
Added translation using Weblate (Spanish)
Ivorra78 1cd71bb
Translated using Weblate (Spanish)
Ivorra78 154ea2f
[MIG] project_task_personal_stage_auto_fold: Migrated to v17
nikul-serpentcs File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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,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. |
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,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, | ||
} |
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,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" |
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 @@ | ||
# 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" |
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,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" |
19 changes: 19 additions & 0 deletions
19
project_task_personal_stage_auto_fold/i18n/project_task_personal_stage_auto_fold.pot
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,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 "" |
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,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" |
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 |
41 changes: 41 additions & 0 deletions
41
project_task_personal_stage_auto_fold/models/project_task.py
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,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] | ||
for task in self: | ||
task.personal_stage_type_id = stage_by_name.get( | ||
task.stage_id.name, | ||
default_stage, | ||
) |
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,3 @@ | ||
[build-system] | ||
requires = ["whool"] | ||
build-backend = "whool.buildapi" |
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,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. |
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,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
14
project_task_personal_stage_auto_fold/readme/DESCRIPTION.md
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,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 |
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,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.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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