diff --git a/manufacturing_timesheet/doc/RELEASE_NOTES.md b/manufacturing_timesheet/doc/RELEASE_NOTES.md index c0705427e..33337a0b4 100644 --- a/manufacturing_timesheet/doc/RELEASE_NOTES.md +++ b/manufacturing_timesheet/doc/RELEASE_NOTES.md @@ -1,6 +1,6 @@ ## Module -#### 25.05.2023 +#### 16.10.2023 #### Version 16.0.1.0.0 #### ADD Initial Commit for Manufacturing (MRP) Timesheet. \ No newline at end of file diff --git a/manufacturing_timesheet/models/mrp_workorder.py b/manufacturing_timesheet/models/mrp_workorder.py index 11256df37..a3e33877f 100644 --- a/manufacturing_timesheet/models/mrp_workorder.py +++ b/manufacturing_timesheet/models/mrp_workorder.py @@ -130,9 +130,16 @@ class MrpWorkorder(models.Model): 'planned_hours': self.duration_expected }) timesheet = task_id.mapped('timesheet_ids') + hours = int(self.duration) + minutes = int((self.duration - hours) * 60) + time_str = f"{hours:02d}:{minutes:02d}" + minutes_str, seconds_str = time_str.split(":") + minutes = int(minutes_str) + seconds = int(seconds_str) + total_hours = (minutes + seconds / 60) / 60 for rec in timesheet: rec.write({ - 'unit_amount': self.duration, + 'unit_amount': total_hours, }) return res @@ -154,8 +161,15 @@ class MrpWorkorder(models.Model): 'planned_hours': self.duration_expected }) timesheet = task_id.mapped('timesheet_ids') + hours = int(self.duration) + minutes = int((self.duration - hours) * 60) + time_str = f"{hours:02d}:{minutes:02d}" + minutes_str, seconds_str = time_str.split(":") + minutes = int(minutes_str) + seconds = int(seconds_str) + total_hours = (minutes + seconds / 60) / 60 for rec in timesheet: rec.write({ - 'unit_amount': self.duration, + 'unit_amount': total_hours, }) return res