-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
TA#66855 [MIG][16.0] project_default_task_stage
- Loading branch information
Showing
17 changed files
with
184 additions
and
0 deletions.
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
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
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,31 @@ | ||
Project Default Task Stage | ||
========================== | ||
This module allows to define default task stages on projects. | ||
|
||
Dependencies | ||
------------ | ||
This module depends on modules ``project_type`` and ``project_stage_no_quick_create`` from the same repository. | ||
|
||
Usage | ||
----- | ||
As member of ``Project / Manager``, I go to the form view of a project type. | ||
|
||
I notice a new field ``Default Task Stages``. I select 3 stages in this field. | ||
|
||
.. image:: static/description/project_type.png | ||
|
||
I create a new project. | ||
|
||
.. image:: static/description/new_project.png | ||
|
||
I select my project type. I notice that the 3 previously defined stages are automatically filled. | ||
|
||
.. image:: static/description/new_project_with_task_stages.png | ||
|
||
Contributors | ||
------------ | ||
* Numigi (tm) and all its contributors (https://bit.ly/numigiens) | ||
|
||
More information | ||
---------------- | ||
* Meet us at https://bit.ly/numigi-com |
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 @@ | ||
# Copyright 2024 Numigi (tm) and all its contributors (https://bit.ly/numigiens) | ||
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl). | ||
|
||
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,19 @@ | ||
# Copyright 2024 Numigi (tm) and all its contributors (https://bit.ly/numigiens) | ||
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl). | ||
|
||
{ | ||
"name": "Project Default Task Stages", | ||
"version": "16.0.1.0.0", | ||
"author": "Numigi", | ||
"maintainer": "Numigi", | ||
"website": "https://bit.ly/numigi-com", | ||
"license": "LGPL-3", | ||
"category": "Project", | ||
"summary": "Default task stages on projects.", | ||
"depends": ["project_type", "project"], | ||
"data": [ | ||
"views/project_type_views.xml", | ||
"views/project_project_views.xml", | ||
], | ||
"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,31 @@ | ||
# Translation of Odoo Server. | ||
# This file contains the translation of the following modules: | ||
# * project_default_task_stage | ||
# | ||
msgid "" | ||
msgstr "" | ||
"Project-Id-Version: Odoo Server 16.0\n" | ||
"Report-Msgid-Bugs-To: \n" | ||
"POT-Creation-Date: 2024-08-29 08:49+0000\n" | ||
"PO-Revision-Date: 2024-08-29 08:49+0000\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_default_task_stage | ||
#: model:ir.model.fields,field_description:project_default_task_stage.field_project_type__default_task_stage_ids | ||
msgid "Default Task Stages" | ||
msgstr "Étapes de tâches par défaut" | ||
|
||
#. module: project_default_task_stage | ||
#: model:ir.model,name:project_default_task_stage.model_project_project | ||
msgid "Project" | ||
msgstr "Projet" | ||
|
||
#. module: project_default_task_stage | ||
#: model:ir.model,name:project_default_task_stage.model_project_type | ||
msgid "Project Type" | ||
msgstr "Type de projet" |
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,5 @@ | ||
# Copyright 2024 Numigi (tm) and all its contributors (https://bit.ly/numigiens) | ||
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl). | ||
|
||
from . import project | ||
from . import project_type | ||
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 2024 Numigi (tm) and all its contributors (https://bit.ly/numigiens) | ||
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl). | ||
|
||
from odoo import api, models | ||
|
||
|
||
class Project(models.Model): | ||
|
||
_inherit = "project.project" | ||
|
||
@api.onchange("type_id") | ||
def _on_change_project_type_id__set_default_task_stages(self): | ||
if self.type_id: | ||
type_ids = self.type_id.default_task_stage_ids | ||
self.type_ids = [(6, 0, type_ids.ids)] |
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,17 @@ | ||
# Copyright 2024 Numigi (tm) and all its contributors (https://bit.ly/numigiens) | ||
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl). | ||
|
||
from odoo import fields, models | ||
|
||
|
||
class ProjectType(models.Model): | ||
|
||
_inherit = "project.type" | ||
|
||
default_task_stage_ids = fields.Many2many( | ||
"project.task.type", | ||
"project_type_default_task_stage_rel", | ||
"type_id", | ||
"task_stage_id", | ||
string="Default Task Stages", | ||
) |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+70.7 KB
project_default_task_stage/static/description/new_project_with_task_stages.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 @@ | ||
# Copyright 2024 Numigi (tm) and all its contributors (https://bit.ly/numigiens) | ||
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl). | ||
|
||
from . import test_default_task_stage |
26 changes: 26 additions & 0 deletions
26
project_default_task_stage/tests/test_default_task_stage.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,26 @@ | ||
# Copyright 2024 Numigi (tm) and all its contributors (https://bit.ly/numigiens) | ||
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl). | ||
|
||
|
||
from odoo.tests.common import SavepointCase | ||
|
||
|
||
class TestDefaultTaskStage(SavepointCase): | ||
|
||
@classmethod | ||
def setUpClass(cls): | ||
super().setUpClass() | ||
cls.stage_1 = cls.env["project.task.type"].create({"name": "Stage 1"}) | ||
cls.stage_2 = cls.env["project.task.type"].create({"name": "Stage 2"}) | ||
cls.project_type = cls.env["project.type"].create( | ||
{ | ||
"name": "My Project Type", | ||
"default_task_stage_ids": [(6, 0, [cls.stage_1.id, cls.stage_2.id])], | ||
} | ||
) | ||
cls.project = cls.env["project.project"].create({"name": "My Project"}) | ||
|
||
def test_onchange_project_type__task_stages_set(self): | ||
self.project.type_id = self.project_type | ||
self.project._on_change_project_type_id__set_default_task_stages() | ||
assert self.project.type_ids == self.stage_1 | self.stage_2 |
15 changes: 15 additions & 0 deletions
15
project_default_task_stage/views/project_project_views.xml
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 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<odoo> | ||
|
||
<record id="project_form" model="ir.ui.view"> | ||
<field name="name">Project Project Form</field> | ||
<field name="model">project.project</field> | ||
<field name="inherit_id" ref="project_type.project_form" /> | ||
<field name="arch" type="xml"> | ||
<field name="type_id" position="after"> | ||
<field name="type_ids" widget="many2many_tags" /> | ||
</field> | ||
</field> | ||
</record> | ||
|
||
</odoo> |
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 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<odoo> | ||
|
||
<record id="project_type_form" model="ir.ui.view"> | ||
<field name="name">Project Type Form</field> | ||
<field name="model">project.type</field> | ||
<field name="inherit_id" ref="project_type.project_type_form" /> | ||
<field name="arch" type="xml"> | ||
<field name="code" position="before"> | ||
<field name="default_task_stage_ids" widget="many2many_tags"/> | ||
</field> | ||
</field> | ||
</record> | ||
|
||
</odoo> |