[FIX] sale_timesheet: SO line on subtask
- Activate sub-stasks on projects - Create a product A: Product Type: Service Invoice based on: Timesheets on tasks Service Tracking: Create a task in an existing project - Create a SO with A, validate - In the project view, open the created task - Click on the stat button 'Sub-tasks' - Create a task from the kanban view The SO line is not copied on the sub-task. The `name_create` method doesn't send the `parent_id` key in the values. Therefore, the SO line is not retrieved. We fallback on the context key `default_parent_id`. opw-1857560
This commit is contained in:
committed by
Nicolas Martinelli
parent
f90434b96c
commit
dd2354a1ab
@@ -70,8 +70,9 @@ class ProjectTask(models.Model):
|
||||
@api.model
|
||||
def create(self, values):
|
||||
# sub task has the same so line than their parent
|
||||
if 'parent_id' in values and values['parent_id']:
|
||||
values['sale_line_id'] = self.env['project.task'].browse(values['parent_id']).sudo().sale_line_id.id
|
||||
parent_id = values['parent_id'] if 'parent_id' in values else self.env.context.get('default_parent_id')
|
||||
if parent_id:
|
||||
values['sale_line_id'] = self.env['project.task'].browse(parent_id).sudo().sale_line_id.id
|
||||
return super(ProjectTask, self).create(values)
|
||||
|
||||
@api.multi
|
||||
|
||||
Reference in New Issue
Block a user