diff options
| author | alt-odoo <alt@odoo.com> | 2021-05-10 22:04:04 +0000 |
|---|---|---|
| committer | alt-odoo <alt@odoo.com> | 2021-05-10 22:04:04 +0000 |
| commit | 5ea2fcbecf572be24af9b2aac76de9e5d5709d2c (patch) | |
| tree | 4cdca9668fd2ce1beb7ce0b174913e149aa565d3 | |
| parent | 045c6ad3353bb0849d3f93d3488d8dcd8b8975b0 (diff) | |
[FIX] project: incorrect creation of recurring tasks
In case X several recurrences are processed in the same cron execution,
only the last recurring task was created X times, while the other tasks
were not created. There is also a missing id preventing a correct use of
the default stage for the new created task.
closes odoo/odoo#70633
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
| -rw-r--r-- | addons/project/models/project_task_recurrence.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/addons/project/models/project_task_recurrence.py b/addons/project/models/project_task_recurrence.py index 0202a12f878..50d861a684f 100644 --- a/addons/project/models/project_task_recurrence.py +++ b/addons/project/models/project_task_recurrence.py @@ -208,20 +208,20 @@ class ProjectTaskRecurrence(models.Model): create_values = { field: value[0] if isinstance(value, tuple) else value for field, value in task_values.items() } - create_values['stage_id'] = task.project_id.type_ids[0].id if task.project_id.type_ids else task.stage_id + create_values['stage_id'] = task.project_id.type_ids[0].id if task.project_id.type_ids else task.stage_id.id create_values['user_id'] = False return create_values def _create_next_task(self): for recurrence in self: - task = self.sudo().task_ids[-1] + task = recurrence.sudo().task_ids[-1] create_values = recurrence._new_task_values(task) new_task = self.env['project.task'].sudo().create(create_values) if not new_task.parent_id and task.child_ids: children = [] # copy the subtasks of the original task for child in task.child_ids: - child_values = self._new_task_values(child) + child_values = recurrence._new_task_values(child) child_values['parent_id'] = new_task.id children.append(child_values) self.env['project.task'].create(children) |
