[FIX] pad_project: prevent crash if no default project_id

Task creation was crashing when there was no project selected in the
kanban's quickcreate window.

closes odoo/odoo#41006

Taskid: 2146564
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
This commit is contained in:
Kevin Baptiste
2019-11-28 07:54:00 +00:00
parent b9fabffe4e
commit edb02d6e94
+1 -1
View File
@@ -15,7 +15,7 @@ class ProjectTask(models.Model):
@api.model
def create(self, vals):
# When using quick create, the project_id is in the context, not in the vals
project_id = vals.get('project_id', False) or self.default_get(['project_id'])['project_id']
project_id = vals.get('project_id', False) or self.default_get(['project_id']).get('project_id', False)
if not self.env['project.project'].browse(project_id).use_pads:
self = self.with_context(pad_no_create=True)
return super(ProjectTask, self).create(vals)