Skip to content

Commit

Permalink
[14.0][FIX] project_milestone : Wrong assignment of tasks to mileston…
Browse files Browse the repository at this point in the history
…es when duplicating a project OCA#1283
  • Loading branch information
abenzbiria committed May 20, 2024
1 parent 9251e0f commit 44eadc5
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
16 changes: 10 additions & 6 deletions project_milestone/models/project.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,16 @@ def copy(self, default=None):

def _link_tasks_to_milestones(self):
for task in self.with_context(active_test=False).task_ids.filtered(
"milestone_id"):
"milestone_id"
):
task.milestone_id = self._find_equivalent_milestone(task.milestone_id)

def _find_equivalent_milestone(self, milestone):
return next((m for m in self.with_context(active_test=False).milestone_ids if
m.name == milestone.name), None, )



return next(
(
m
for m in self.with_context(active_test=False).milestone_ids
if m.name == milestone.name
),
None,
)
1 change: 0 additions & 1 deletion project_milestone/models/project_milestone.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,3 @@ def _compute_milestone_progress(self):
record.progress = (closed_tasks_count / total_tasks_count) * 100
else:
record.progress = 0.0

0 comments on commit 44eadc5

Please sign in to comment.