|
@ -140,20 +140,28 @@ class MrpWorkorder(models.Model): |
|
|
Boolean: Returns true |
|
|
Boolean: Returns true |
|
|
""" |
|
|
""" |
|
|
res = super(MrpWorkorder, self).button_finish() |
|
|
res = super(MrpWorkorder, self).button_finish() |
|
|
project = self.env['project.project'].search( |
|
|
|
|
|
[('name', '=', ("MO: {}".format(self.production_id.name)))]) |
|
|
for workorder in self: |
|
|
task_id = project.task_ids.search([('name', '=', ( |
|
|
project = self.env['project.project'].search([ |
|
|
"{} in {} for {} on {}".format(self.name, self.workcenter_id.name, |
|
|
('name', '=', f"MO: {workorder.production_id.name}") |
|
|
self.product_id.display_name, |
|
|
], limit=1) |
|
|
str(self.date_start))))]) |
|
|
|
|
|
task_id.write({ |
|
|
task = project.task_ids.search([ |
|
|
'allocated_hours': self.duration_expected |
|
|
('name', '=', ( |
|
|
}) |
|
|
f"{workorder.name} in {workorder.workcenter_id.name} for " |
|
|
timesheet = task_id.mapped('timesheet_ids') |
|
|
f"{workorder.product_id.display_name} on {str(workorder.date_start)}" |
|
|
for rec in timesheet: |
|
|
)) |
|
|
rec.write({ |
|
|
], limit=1) |
|
|
'unit_amount': self.duration, |
|
|
|
|
|
|
|
|
task.write({ |
|
|
|
|
|
'allocated_hours': workorder.duration_expected |
|
|
}) |
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
for rec in task.timesheet_ids: |
|
|
|
|
|
rec.write({ |
|
|
|
|
|
'unit_amount': workorder.duration, |
|
|
|
|
|
}) |
|
|
|
|
|
|
|
|
return res |
|
|
return res |
|
|
|
|
|
|
|
|
@api.depends('employee_id') |
|
|
@api.depends('employee_id') |
|
|