[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: Yannick Tivisse (yti) <yti@odoo.com>
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user