Skip to content

Commit 1514277

Browse files
committed
[FIX] project: adapt the task_ids and project_id domain to project/task template
1 parent 1c672af commit 1514277

File tree

3 files changed

+4
-3
lines changed

3 files changed

+4
-3
lines changed

addons/project/models/project_project.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ def _set_favorite_user_ids(self, is_favorite):
111111
task_count = fields.Integer(compute='_compute_task_count', string="Task Count", export_string_translation=False)
112112
open_task_count = fields.Integer(compute='_compute_open_task_count', string="Open Task Count", export_string_translation=False)
113113
task_ids = fields.One2many('project.task', 'project_id', string='Tasks', export_string_translation=False,
114-
domain=lambda self: [('is_closed', '=', False), ('is_template', '=', False)])
114+
domain="[('is_closed', '=', False), ('is_template', '=', is_template)])")
115115
color = fields.Integer(string='Color Index', export_string_translation=False)
116116
user_id = fields.Many2one('res.users', string='Project Manager', default=lambda self: self.env.user, tracking=True, falsy_value_label=_lt("👤 Unassigned"))
117117
alias_id = fields.Many2one(help="Internal email associated with this project. Incoming emails are automatically synchronized "
@@ -146,6 +146,7 @@ def _set_favorite_user_ids(self, is_favorite):
146146
task_properties_definition = fields.PropertiesDefinition('Task Properties')
147147
closed_task_count = fields.Integer(compute="_compute_closed_task_count", export_string_translation=False)
148148
task_completion_percentage = fields.Float(compute="_compute_task_completion_percentage", export_string_translation=False)
149+
role_user_ids = fields.One2many('project.role.user.map', 'project_id')
149150

150151
# Project Sharing fields
151152
collaborator_ids = fields.One2many('project.collaborator', 'project_id', string='Collaborators', copy=False, export_string_translation=False)

addons/project/models/project_task.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ def _read_group_personal_stage_type_ids(self, stages, domain):
179179
help="Date on which the state of your task has last been modified.\n"
180180
"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/state to another.")
181181

182-
project_id = fields.Many2one('project.project', string='Project', domain="['|', ('company_id', '=', False), ('company_id', '=?', company_id), ('is_template', '=', False)]",
182+
project_id = fields.Many2one('project.project', string='Project', domain="['|', ('company_id', '=', False), ('company_id', '=?', company_id), ('is_template', '=', is_template)]",
183183
compute="_compute_project_id", store=True, precompute=True, recursive=True, readonly=False, index=True, tracking=True, change_default=True, falsy_value_label=_lt("🔒 Private"))
184184
display_in_project = fields.Boolean(compute='_compute_display_in_project', store=True, export_string_translation=False)
185185
task_properties = fields.Properties('Properties', definition='project_id.task_properties_definition', copy=True)

addons/project/views/project_task_views.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -405,7 +405,7 @@
405405
<group>
406406
<group>
407407
<field name="project_id"
408-
domain="[('active', '=', True), '|', ('company_id', '=', False), ('company_id', '=?', company_id)]"
408+
domain="[('active', '=', True), '|', ('company_id', '=', False), ('company_id', '=?', company_id), ('is_template', '=', is_template)]"
409409
required="parent_id or child_ids or is_template"
410410
widget="project"/>
411411
<field name="milestone_id"

0 commit comments

Comments
 (0)