diff --git a/.docker_files/main/__manifest__.py b/.docker_files/main/__manifest__.py index 56387082..e8344d4a 100644 --- a/.docker_files/main/__manifest__.py +++ b/.docker_files/main/__manifest__.py @@ -20,6 +20,7 @@ "project_milestone_time_kpi", "project_no_quick_create", "project_parent_enhanced", + "project_parent_type_required", "project_portal_hide_timesheets", "project_progress_variance", "project_projected_hours", diff --git a/Dockerfile b/Dockerfile index 3b042a05..5c7ac653 100644 --- a/Dockerfile +++ b/Dockerfile @@ -21,6 +21,7 @@ COPY project_milestone_spent_hours /mnt/extra-addons/project_milestone_spent_hou COPY project_milestone_time_kpi /mnt/extra-addons/project_milestone_time_kpi COPY project_no_quick_create /mnt/extra-addons/project_no_quick_create COPY project_parent_enhanced mnt/extra-addons/project_parent_enhanced +COPY project_parent_type_required mnt/extra-addons/project_parent_type_required COPY project_portal_hide_timesheets mnt/extra-addons/project_portal_hide_timesheets COPY project_progress_variance /mnt/extra-addons/project_progress_variance COPY project_projected_hours mnt/extra-addons/project_projected_hours diff --git a/project_parent_enhanced/README.rst b/project_parent_enhanced/README.rst index 88929d91..6f5b3b67 100644 --- a/project_parent_enhanced/README.rst +++ b/project_parent_enhanced/README.rst @@ -23,29 +23,34 @@ Features **Tasks Group by Parent Projects** - Add a new group option to group tasks by their parent projects. -.. image:: static/description/task_group_by_parent.png +.. image:: https://raw.githubusercontent.com/Numigi/odoo-project-addons/16.0/project_parent_enhanced/static/description/task_group_by_parent.png ** Search and Filter Project by Parent Projects** - Add a new search filter to search projects by their parent projects. -.. image:: static/description/search_project_by_parent.png +.. image:: https://raw.githubusercontent.com/Numigi/odoo-project-addons/16.0/project_parent_enhanced/static/description/search_project_by_parent.png - The filter by parent project is also available -.. image:: static/description/filter_project_by_parent_project.png +.. image:: https://raw.githubusercontent.com/Numigi/odoo-project-addons/16.0/project_parent_enhanced/static/description/filter_project_by_parent_project.png **View Adjustments** - Replace project names with their `display_name` to show the hierarchy in views. In the Kanban view: -.. image:: static/description/iteration_name_kanban_view.png +.. image:: https://raw.githubusercontent.com/Numigi/odoo-project-addons/16.0/project_parent_enhanced/https://raw.githubusercontent.com/Numigi/odoo-project-addons/16.0/project_parent_enhanced/static/description/iteration_name_kanban_view.png In the List view: -.. image:: static/description/iteration_name_list_view.png +.. image:: https://raw.githubusercontent.com/Numigi/odoo-project-addons/16.0/project_parent_enhanced/static/description/iteration_name_list_view.png + - Add a filter on the `parent_id` field in the project form view to display only parent projects. + +.. image:: https://raw.githubusercontent.com/Numigi/odoo-project-addons/16.0/project_parent_enhanced/static/description/project_list.png + +.. image:: https://raw.githubusercontent.com/Numigi/odoo-project-addons/16.0/project_parent_enhanced/static/description/project_view_form.png Contributors ------------ diff --git a/project_parent_enhanced/models/project_project.py b/project_parent_enhanced/models/project_project.py index 8319e936..e9d8f0f2 100644 --- a/project_parent_enhanced/models/project_project.py +++ b/project_parent_enhanced/models/project_project.py @@ -9,6 +9,10 @@ class ProjectProject(models.Model): _inherit = "project.project" + is_parent = fields.Boolean( + "Is Parent", compute="_compute_is_parent", store=True, compute_sudo=True + ) + @api.depends("child_ids") def _compute_is_parent(self): for project in self: @@ -70,10 +74,6 @@ def name_get(self): res.extend((p.id, ", ".join([p.parent_id.name, p.name])) for p in iterations) return res - is_parent = fields.Boolean( - "Is Parent", compute="_compute_is_parent", store=True, compute_sudo=True - ) - def _propagate_followers_from_parent(self): self.message_unsubscribe(self.message_partner_ids.ids) self.message_subscribe(self.parent_id.message_partner_ids.ids) diff --git a/project_parent_enhanced/static/description/project_list.png b/project_parent_enhanced/static/description/project_list.png new file mode 100644 index 00000000..0c3e3cf5 Binary files /dev/null and b/project_parent_enhanced/static/description/project_list.png differ diff --git a/project_parent_enhanced/static/description/project_view_form.png b/project_parent_enhanced/static/description/project_view_form.png new file mode 100644 index 00000000..3faff689 Binary files /dev/null and b/project_parent_enhanced/static/description/project_view_form.png differ diff --git a/project_parent_enhanced/views/project_project_views.xml b/project_parent_enhanced/views/project_project_views.xml index 111ac6a1..07464692 100644 --- a/project_parent_enhanced/views/project_project_views.xml +++ b/project_parent_enhanced/views/project_project_views.xml @@ -1,6 +1,17 @@ + + Project Form With Parent Only + project.project + + + + [("parent_id", "=", False)] + + + + Project Search With Parent Project project.project diff --git a/project_parent_type_required/README.rst b/project_parent_type_required/README.rst new file mode 100644 index 00000000..260ab733 --- /dev/null +++ b/project_parent_type_required/README.rst @@ -0,0 +1,30 @@ +Project Parent Type Required +============================ + +This modules allows to drive the require of parent in project from the project type. + +by checking the boolean Is Parent Required, all the project of this type must have a parent set. + +when I go to the project types, I see a new checkbox + +.. image:: https://raw.githubusercontent.com/Numigi/odoo-project-addons/16.0/project_parent_type_required/static/description/project_type.png + +After having set up the types, I can see the effect on project + +If the type requires a parent project + +.. image:: https://raw.githubusercontent.com/Numigi/odoo-project-addons/16.0/project_parent_type_required/static/description/project_parent_required.png + +Otherwise + +.. image:: https://raw.githubusercontent.com/Numigi/odoo-project-addons/16.0/project_parent_type_required/static/description/project_parent_not_required.png + +Contributors +------------ +- Numigi (tm) and all its contributors (https://bit.ly/numigiens) + +More Information +---------------- +For more details, visit: +- https://github.com/OCA/project/tree/16.0/project_parent + diff --git a/project_parent_type_required/__init__.py b/project_parent_type_required/__init__.py new file mode 100644 index 00000000..50e5db60 --- /dev/null +++ b/project_parent_type_required/__init__.py @@ -0,0 +1,4 @@ +# Copyright 2023 - Today 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 diff --git a/project_parent_type_required/__manifest__.py b/project_parent_type_required/__manifest__.py new file mode 100644 index 00000000..189e20af --- /dev/null +++ b/project_parent_type_required/__manifest__.py @@ -0,0 +1,19 @@ +# Copyright 2023 - Today Numigi (tm) and all its contributors (https://bit.ly/numigiens) +# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl). + +{ + "name": "Project Parent Required by Type", + "version": "16.0.1.0.0", + "author": "Numigi", + "maintainer": "Numigi", + "website": "https://bit.ly/numigi-com", + "license": "LGPL-3", + "category": "Project", + "summary": "Allow to tag projet types to force to have project parent.", + "depends": ["project_parent", "project_type"], + "data": [ + "views/project_project_views.xml", + "views/project_type_views.xml", + ], + "installable": True, +} diff --git a/project_parent_type_required/i18n/fr.po b/project_parent_type_required/i18n/fr.po new file mode 100644 index 00000000..63d5d0d0 --- /dev/null +++ b/project_parent_type_required/i18n/fr.po @@ -0,0 +1,32 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * project_parent_type_required +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 16.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2025-01-29 08:32+0000\n" +"PO-Revision-Date: 2025-01-29 08:32+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_parent_type_required +#: model:ir.model.fields,field_description:project_parent_type_required.field_project_project__is_parent_required +#: model:ir.model.fields,field_description:project_parent_type_required.field_project_type__is_project_parent_required +msgid "Is project parent required" +msgstr "Projet parent requis" + +#. module: project_parent_type_required +#: model:ir.model,name:project_parent_type_required.model_project_project +msgid "Project" +msgstr "Projet" + +#. module: project_parent_type_required +#: model:ir.model,name:project_parent_type_required.model_project_type +msgid "Project Type" +msgstr "Type de projet" diff --git a/project_parent_type_required/models/__init__.py b/project_parent_type_required/models/__init__.py new file mode 100644 index 00000000..33c01c12 --- /dev/null +++ b/project_parent_type_required/models/__init__.py @@ -0,0 +1,5 @@ +# Copyright 2023 - today 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_type +from . import project_project diff --git a/project_parent_type_required/models/project_project.py b/project_parent_type_required/models/project_project.py new file mode 100644 index 00000000..a6f957de --- /dev/null +++ b/project_parent_type_required/models/project_project.py @@ -0,0 +1,11 @@ +# Copyright 2023 - today 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 models, fields + + +class Project(models.Model): + _inherit = "project.project" + + is_parent_required = fields.Boolean(related="type_id.is_project_parent_required") diff --git a/project_parent_type_required/models/project_type.py b/project_parent_type_required/models/project_type.py new file mode 100644 index 00000000..5f799183 --- /dev/null +++ b/project_parent_type_required/models/project_type.py @@ -0,0 +1,11 @@ +# Copyright 2023 - today 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 models, fields + + +class ProjectType(models.Model): + _inherit = "project.type" + + is_project_parent_required = fields.Boolean(string="Is project parent required") diff --git a/project_parent_type_required/static/description/icon.png b/project_parent_type_required/static/description/icon.png new file mode 100644 index 00000000..92a86b10 Binary files /dev/null and b/project_parent_type_required/static/description/icon.png differ diff --git a/project_parent_type_required/static/description/project_parent_not_required.png b/project_parent_type_required/static/description/project_parent_not_required.png new file mode 100644 index 00000000..766e2911 Binary files /dev/null and b/project_parent_type_required/static/description/project_parent_not_required.png differ diff --git a/project_parent_type_required/static/description/project_parent_required.png b/project_parent_type_required/static/description/project_parent_required.png new file mode 100644 index 00000000..afb1fffe Binary files /dev/null and b/project_parent_type_required/static/description/project_parent_required.png differ diff --git a/project_parent_type_required/static/description/project_type.png b/project_parent_type_required/static/description/project_type.png new file mode 100644 index 00000000..4660ff6b Binary files /dev/null and b/project_parent_type_required/static/description/project_type.png differ diff --git a/project_parent_type_required/views/project_project_views.xml b/project_parent_type_required/views/project_project_views.xml new file mode 100644 index 00000000..98333409 --- /dev/null +++ b/project_parent_type_required/views/project_project_views.xml @@ -0,0 +1,18 @@ + + + + + Project Form With Parent: Required + project.project + + + + + + + {'required':[('is_parent_required', '=', True)]} + + + + + diff --git a/project_parent_type_required/views/project_type_views.xml b/project_parent_type_required/views/project_type_views.xml new file mode 100644 index 00000000..59e1bbfd --- /dev/null +++ b/project_parent_type_required/views/project_type_views.xml @@ -0,0 +1,18 @@ + + + + + Project Type: Is Parent Required + project.type + + + +
+ +
+
+
+
+ +
diff --git a/project_time_range/__manifest__.py b/project_time_range/__manifest__.py index 0f1d89df..f530e137 100644 --- a/project_time_range/__manifest__.py +++ b/project_time_range/__manifest__.py @@ -11,6 +11,10 @@ "category": "Project", "summary": "Add fields Min and Max on project tasks.", "depends": ["hr_timesheet"], - "data": ["views/portal.xml", "views/project_task.xml", "views/project_project.xml"], + "data": [ + "views/project_task_portal_template.xml", + "views/project_task_views.xml", + "views/project_project_views.xml", + ], "installable": True, } diff --git a/project_time_range/models/project_task.py b/project_time_range/models/project_task.py index 49ca3368..5de4cd40 100644 --- a/project_time_range/models/project_task.py +++ b/project_time_range/models/project_task.py @@ -2,8 +2,9 @@ # License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl). -from odoo import fields, models, api, _ +from odoo import api, fields, models, _ from odoo.exceptions import ValidationError + from .util import time_range_constraint @@ -22,12 +23,10 @@ class ProjectTask(models.Model): "Sub-tasks Max", compute="_compute_subtask_max_hours" ) - @api.depends("child_ids.min_hours") def _compute_subtask_min_hours(self): for task in self: task.subtask_min_hours = sum(task.child_ids.mapped("min_hours")) - @api.depends("child_ids.max_hours") def _compute_subtask_max_hours(self): for task in self: task.subtask_max_hours = sum(task.child_ids.mapped("max_hours")) diff --git a/project_time_range/static/description/portal_task.png b/project_time_range/static/description/portal_task.png index 597c916a..8b09a80c 100644 Binary files a/project_time_range/static/description/portal_task.png and b/project_time_range/static/description/portal_task.png differ diff --git a/project_time_range/views/project_project.xml b/project_time_range/views/project_project_views.xml similarity index 81% rename from project_time_range/views/project_project.xml rename to project_time_range/views/project_project_views.xml index bc2751c0..52f172bc 100644 --- a/project_time_range/views/project_project.xml +++ b/project_time_range/views/project_project_views.xml @@ -10,11 +10,11 @@ - - - - - + + + + + @@ -28,11 +28,11 @@ - - - - - + + + + +
diff --git a/project_time_range/views/portal.xml b/project_time_range/views/project_task_portal_template.xml similarity index 64% rename from project_time_range/views/portal.xml rename to project_time_range/views/project_task_portal_template.xml index eb8c9066..f0c263c2 100644 --- a/project_time_range/views/portal.xml +++ b/project_time_range/views/project_task_portal_template.xml @@ -6,16 +6,16 @@
Min: - +
Ideal: -
Max: - +
diff --git a/project_time_range/views/project_task.xml b/project_time_range/views/project_task_views.xml similarity index 94% rename from project_time_range/views/project_task.xml rename to project_time_range/views/project_task_views.xml index 87bd24ce..13b30537 100644 --- a/project_time_range/views/project_task.xml +++ b/project_time_range/views/project_task_views.xml @@ -55,7 +55,7 @@ - + Ideal @@ -63,7 +63,7 @@ show - +