diff --git a/manufacture_process_costing/__manifest__.py b/manufacture_process_costing/__manifest__.py index b88604fef..81f49b46d 100755 --- a/manufacture_process_costing/__manifest__.py +++ b/manufacture_process_costing/__manifest__.py @@ -21,7 +21,7 @@ ############################################################################# { 'name': 'Process Cost of Manufacturing Orders', - 'version': '16.0.1.0.0', + 'version': '16.0.1.0.1', 'category': 'Manufacturing', 'summary': """Manufacture Process Costing By Material Cost, Labour Cost and Overhead Cost""", diff --git a/manufacture_process_costing/doc/RELEASE_NOTES.md b/manufacture_process_costing/doc/RELEASE_NOTES.md index 830bfb6ff..080d82807 100755 --- a/manufacture_process_costing/doc/RELEASE_NOTES.md +++ b/manufacture_process_costing/doc/RELEASE_NOTES.md @@ -1,6 +1,11 @@ -## Module #### 2.12.2023 #### Version 16.0.1.0.0 #### ADD - Initial commit for Process Cost of Manufacturing Orders + + +#### 11.04.2024 +#### Version 16.0.1.0.1 +#### BUGFIX +- Added The costing of a manufacturing order if a manufacturing order is created through a sale order. \ No newline at end of file diff --git a/manufacture_process_costing/models/mrp_bom.py b/manufacture_process_costing/models/mrp_bom.py index b40358329..a75f20b45 100755 --- a/manufacture_process_costing/models/mrp_bom.py +++ b/manufacture_process_costing/models/mrp_bom.py @@ -59,7 +59,7 @@ class MrpBom(models.Model): 'product_id': rec.product_id.id, 'planned_qty': rec.product_qty, 'uom_id': rec.product_id.uom_id.id, - 'cost_unit': rec.product_id.lst_price, + 'cost_unit': rec.product_id.standard_price, }) for rec in self.bom_line_ids] }) diff --git a/manufacture_process_costing/models/mrp_production.py b/manufacture_process_costing/models/mrp_production.py index 46699bac0..bca587def 100755 --- a/manufacture_process_costing/models/mrp_production.py +++ b/manufacture_process_costing/models/mrp_production.py @@ -82,6 +82,49 @@ class MrpProduction(models.Model): 'res_id': reason.id, } + @api.model_create_multi + def create(self, vals_list): + """Writes data to material_cost_ids, labour_cost_ids and + overhead_cost_ids when change in bom_id""" + res = super().create(vals_list) + res.write({'material_cost_ids': [(5, 0)]}) + res.write({ + 'material_cost_ids': [ + (0, 0, { + 'production_material_id': res.id, + 'material_cost_id': res.bom_id.id, + 'product_id': rec.product_id.id, + 'planned_qty': rec.planned_qty, + 'uom_id': rec.uom_id.id, + 'cost_unit': rec.cost_unit, + }) for rec in res.bom_id.material_cost_ids] + }) + res.write({'labour_cost_ids': [(5, 0)]}) + res.write({ + 'labour_cost_ids': [ + (0, 0, { + 'production_labour_id': res.id, + 'labour_cost_id': rec.id, + 'operation': rec.operation, + 'work_center_id': rec.work_center_id.id, + 'planned_minute': rec.planned_minute, + 'cost_minute': rec.cost_minute, + }) for rec in res.bom_id.labour_cost_ids] + }) + res.write({'overhead_cost_ids': [(5, 0)]}) + res.write({ + 'overhead_cost_ids': [ + (0, 0, { + 'production_overhead_id': res.id, + 'overhead_cost_id': rec.id, + 'operation': rec.operation, + 'work_center_id': rec.work_center_id.id, + 'planned_minute': rec.planned_minute, + 'cost_minute': rec.cost_minute, + }) for rec in res.bom_id.overhead_cost_ids] + }) + return res + @api.onchange('bom_id') def _onchange_bom_id(self): """Writes data to material_cost_ids, labour_cost_ids and