Browse Source

July 04: [FIX] Bug Fixed 'manufacturing_timesheet'

18.0
Cybrosys Technologies 2 days ago
parent
commit
07394bbd5f
  1. 2
      manufacturing_timesheet/__manifest__.py
  2. 5
      manufacturing_timesheet/doc/RELEASE_NOTES.md
  3. 30
      manufacturing_timesheet/models/mrp_workorder.py

2
manufacturing_timesheet/__manifest__.py

@ -21,7 +21,7 @@
################################################################################ ################################################################################
{ {
'name': 'Manufacturing (MRP) Timesheet', 'name': 'Manufacturing (MRP) Timesheet',
'version': '18.0.1.0.0', 'version': '18.0.1.0.1',
'category': 'Manufacturing,Project', 'category': 'Manufacturing,Project',
'summary': 'Timesheet for manufacturing.', 'summary': 'Timesheet for manufacturing.',
'description': """ This module will help you to create timesheet for 'description': """ This module will help you to create timesheet for

5
manufacturing_timesheet/doc/RELEASE_NOTES.md

@ -4,3 +4,8 @@
#### Version 18.0.1.0.0 #### Version 18.0.1.0.0
#### ADD #### ADD
- Initial Commit for Manufacturing (MRP) Timesheet - Initial Commit for Manufacturing (MRP) Timesheet
#### 04.07.2025
#### Version 18.0.1.0.1
#### FIX
- Fixed the singleton error that occurred when clicking the 'Produce All' button.

30
manufacturing_timesheet/models/mrp_workorder.py

@ -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 "
f"{workorder.product_id.display_name} on {str(workorder.date_start)}"
))
], limit=1)
task.write({
'allocated_hours': workorder.duration_expected
}) })
timesheet = task_id.mapped('timesheet_ids')
for rec in timesheet: for rec in task.timesheet_ids:
rec.write({ rec.write({
'unit_amount': self.duration, 'unit_amount': workorder.duration,
}) })
return res return res
@api.depends('employee_id') @api.depends('employee_id')

Loading…
Cancel
Save