[FIX] mrp: allow override for operation cost in MO Overview

Since employees can be assigned directly to a workorder, their hourly
cost must be added to the operations cost in the Overview.

Those changes allow further override in odoo/enterprise#40953

closes odoo/odoo#123551

X-original-commit: 8802907637b5d862aaa98a1828d29bc7890c53e3
Related: odoo/enterprise#41893
Signed-off-by: William Henrotin (whe) <whe@odoo.com>
This commit is contained in:
clesgow
2023-06-02 23:39:17 +02:00
parent 2d4634df5f
commit 7f8af8a84b
2 changed files with 8 additions and 2 deletions
+6
View File
@@ -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
+2 -2
View File
@@ -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}",