Browse Source

Oct 26 : [FIX] Bug Fixed 'manufacturing_timesheet'

pull/295/head
AjmalCybro 2 years ago
parent
commit
3a2f594047
  1. 2
      manufacturing_timesheet/doc/RELEASE_NOTES.md
  2. 18
      manufacturing_timesheet/models/mrp_workorder.py

2
manufacturing_timesheet/doc/RELEASE_NOTES.md

@ -1,6 +1,6 @@
## Module <manufacturing_timesheet> ## Module <manufacturing_timesheet>
#### 25.05.2023 #### 16.10.2023
#### Version 16.0.1.0.0 #### Version 16.0.1.0.0
#### ADD #### ADD
Initial Commit for Manufacturing (MRP) Timesheet. Initial Commit for Manufacturing (MRP) Timesheet.

18
manufacturing_timesheet/models/mrp_workorder.py

@ -130,9 +130,16 @@ class MrpWorkorder(models.Model):
'planned_hours': self.duration_expected 'planned_hours': self.duration_expected
}) })
timesheet = task_id.mapped('timesheet_ids') 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: for rec in timesheet:
rec.write({ rec.write({
'unit_amount': self.duration, 'unit_amount': total_hours,
}) })
return res return res
@ -154,8 +161,15 @@ class MrpWorkorder(models.Model):
'planned_hours': self.duration_expected 'planned_hours': self.duration_expected
}) })
timesheet = task_id.mapped('timesheet_ids') 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: for rec in timesheet:
rec.write({ rec.write({
'unit_amount': self.duration, 'unit_amount': total_hours,
}) })
return res return res

Loading…
Cancel
Save