diff --git a/addons/mrp/models/mrp_workorder.py b/addons/mrp/models/mrp_workorder.py index 1fcc9ca6f47..e1bb869fe3c 100644 --- a/addons/mrp/models/mrp_workorder.py +++ b/addons/mrp/models/mrp_workorder.py @@ -886,3 +886,9 @@ class MrpWorkorder(models.Model): def action_mass_pause(self): for wo in self: wo.button_pending() + + def _compute_expected_operation_cost(self): + return (self.duration_expected / 60.0) * self.workcenter_id.costs_hour + + def _compute_current_operation_cost(self): + return (self.get_duration() / 60.0) * self.workcenter_id.costs_hour diff --git a/addons/mrp/report/mrp_report_mo_overview.py b/addons/mrp/report/mrp_report_mo_overview.py index 726234e4437..ed5963a2eec 100644 --- a/addons/mrp/report/mrp_report_mo_overview.py +++ b/addons/mrp/report/mrp_report_mo_overview.py @@ -124,8 +124,8 @@ class ReportMoOverview(models.AbstractModel): total_current_cost = 0.0 for index, workorder in enumerate(production.workorder_ids): wo_duration = workorder.duration + workorder.get_working_duration() # Add duration of ongoing work sessions. - expected_cost = (workorder.duration_expected / 60.0) * workorder.workcenter_id.costs_hour - current_cost = (wo_duration / 60.0) * workorder.workcenter_id.costs_hour + expected_cost = workorder._compute_expected_operation_cost() + current_cost = workorder._compute_current_operation_cost() operations.append({ 'level': level, 'index': f"{current_index}W{index}",