From ce29b305b99033fb0b2b0e94ca398835feb820db Mon Sep 17 00:00:00 2001 From: std-odoo Date: Mon, 5 Sep 2022 07:41:52 +0000 Subject: [PATCH] [IMP] project: add a properties field on task Purpose ======= To be able to customize the working flow on the task, based on their project, we add a properties field on tasks, whose definition is stored on their project. Task-2965523 X-original-commit: 2f244769cbb1512875ae197aa8adc3efd34fd54b Part-of: odoo/odoo#101487 --- addons/project/models/project.py | 4 +++- addons/project/views/project_views.xml | 2 ++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/addons/project/models/project.py b/addons/project/models/project.py index 0da92d125ac..25f40dcd2ab 100644 --- a/addons/project/models/project.py +++ b/addons/project/models/project.py @@ -361,6 +361,7 @@ class Project(models.Model): allow_task_dependencies = fields.Boolean('Task Dependencies', default=lambda self: self.env.user.has_group('project.group_project_task_dependencies')) allow_milestones = fields.Boolean('Milestones', default=lambda self: self.env.user.has_group('project.group_project_milestone')) tag_ids = fields.Many2many('project.tags', relation='project_project_project_tags_rel', string='Tags') + task_properties_definition = fields.PropertiesDefinition('Task Properties') # Project Sharing fields collaborator_ids = fields.One2many('project.collaborator', 'project_id', string='Collaborators', copy=False) @@ -1122,8 +1123,9 @@ class Task(models.Model): help="Date on which the stage of your task has last been modified.\n" "Based on this information you can identify tasks that are stalling and get statistics on the time it usually takes to move tasks from one stage to another.") project_id = fields.Many2one('project.project', string='Project', recursive=True, - compute='_compute_project_id', store=True, readonly=False, + compute='_compute_project_id', store=True, readonly=False, precompute=True, index=True, tracking=True, check_company=True, change_default=True) + task_properties = fields.Properties('Properties', definition='project_id.task_properties_definition', copy=True) # Defines in which project the task will be displayed / taken into account in statistics. # Example: 1 task A with 1 subtask B in project P # A -> project_id=P, display_project_id=P diff --git a/addons/project/views/project_views.xml b/addons/project/views/project_views.xml index 46a5eb46dd2..c190226b56c 100644 --- a/addons/project/views/project_views.xml +++ b/addons/project/views/project_views.xml @@ -1178,6 +1178,8 @@ +