diff --git a/manufacturing_timesheet/doc/RELEASE_NOTES.md b/manufacturing_timesheet/doc/RELEASE_NOTES.md index 33337a0b4..cae915b9a 100644 --- a/manufacturing_timesheet/doc/RELEASE_NOTES.md +++ b/manufacturing_timesheet/doc/RELEASE_NOTES.md @@ -3,4 +3,9 @@ #### 16.10.2023 #### Version 16.0.1.0.0 #### ADD -Initial Commit for Manufacturing (MRP) Timesheet. \ No newline at end of file +Initial Commit for Manufacturing (MRP) Timesheet. + +#### 07.11.2024 +#### Version 16.0.1.0.0 +#### Updated +- Updated the code for adding the value to allocated hours while creating a project task in the MRP work order. Also updated it in index. \ No newline at end of file diff --git a/manufacturing_timesheet/models/mrp_workorder.py b/manufacturing_timesheet/models/mrp_workorder.py index a3e33877f..0618d5c6a 100644 --- a/manufacturing_timesheet/models/mrp_workorder.py +++ b/manufacturing_timesheet/models/mrp_workorder.py @@ -54,7 +54,15 @@ class MrpWorkorder(models.Model): project = self.env['project.project'].search( [('name', '=', ("MO: {}".format(self.production_id.name)))]) - + minutes = int(self.duration_expected) + seconds = int((self.duration_expected - minutes) * 60) + time_str = f"{minutes:02d}:{seconds:02d}" + minutes_str, seconds_str = time_str.split(":") + minutes = int(minutes_str) + seconds = int(seconds_str) + if seconds % 30 == 0: + minutes += (seconds // 30) + total_hours = minutes / 60 if project: task_id = project.task_ids.search([('name', '=', ( "{} in {} for {} on {}".format(self.name, @@ -70,7 +78,7 @@ class MrpWorkorder(models.Model): 'project_id': project.id, 'date_assign': self.date_planned_start, 'date_deadline': self.date_planned_finished, - 'planned_hours': self.duration_expected, + 'planned_hours': total_hours }) self.env['account.analytic.line'].create({ 'task_id': task_id.id, @@ -99,7 +107,7 @@ class MrpWorkorder(models.Model): 'project_id': project_id.id, 'date_assign': self.date_planned_start, 'date_deadline': self.date_planned_finished, - 'planned_hours': self.duration_expected, + 'planned_hours': total_hours, }) self.env['account.analytic.line'].create({ 'task_id': task_id.id, diff --git a/manufacturing_timesheet/static/description/index.html b/manufacturing_timesheet/static/description/index.html index 2784d6631..ae900bba5 100644 --- a/manufacturing_timesheet/static/description/index.html +++ b/manufacturing_timesheet/static/description/index.html @@ -214,7 +214,10 @@

Inside of the task,you can see the timesheet created in the - name of employee that selected in the work order. + name of employee that selected in the work order. The expected time, mentioned in minutes and seconds + format in the work order, will be added to the allocated hours of the task in hours and minutes format. + Any seconds equal to or greater than 30 will be rounded up to 1 minute, and seconds less than 30 will + be rounded down to 0 minutes.