Skip to content
Snippets Groups Projects
Commit 70c4e561 authored by Yannick Tivisse's avatar Yannick Tivisse Committed by fw-bot
Browse files

[IMP] sale_timesheet: Avoid generated tasks on Undefined stage


Purpose
=======

Steps to reproduce:

- Configure a product of type service to create a task on a
  sales order validation, without configuring a project template
- On the SO confirmation, the project is generated without any stages

Additional issue:
- go to the Kanban view of the Project
- filter on something that doesn't give any result
- The kanban switches to edit mode, even if there is
  a task

This commit solves both issues.

closes odoo/odoo#40057

X-original-commit: e2de6331f7f75c9c9b086e57b88f6d25a2cd303d
Signed-off-by: default avatarYannick Tivisse (yti) <yti@odoo.com>
parent 0e6bde19
No related branches found
No related tags found
No related merge requests found
......@@ -269,6 +269,11 @@ class SaleOrderLine(models.Model):
})
else:
project = self.env['project.project'].create(values)
# Avoid new tasks to go to 'Undefined Stage'
if not project.type_ids:
project.type_ids = self.env['project.task.type'].create({'name': _('New')})
# link project as generated by current so line
self.write({'project_id': project.id})
return project
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment