From 3a2f594047549cc4da9498dbc3e788ac337f8833 Mon Sep 17 00:00:00 2001 From: AjmalCybro Date: Thu, 26 Oct 2023 10:29:04 +0530 Subject: [PATCH] Oct 26 : [FIX] Bug Fixed 'manufacturing_timesheet' --- manufacturing_timesheet/doc/RELEASE_NOTES.md | 2 +- .../models/mrp_workorder.py | 18 ++++++++++++++++-- 2 files changed, 17 insertions(+), 3 deletions(-) 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