diff --git a/mrp_production_cost/__manifest__.py b/mrp_production_cost/__manifest__.py index a04507c6..bd2c8b57 100644 --- a/mrp_production_cost/__manifest__.py +++ b/mrp_production_cost/__manifest__.py @@ -7,7 +7,12 @@ "category": "Manufacturing/Manufacturing", "license": "AGPL-3", "version": "16.0.1.1.0", - "depends": ["product", "mrp", "stock", "stock_move_cost"], + "depends": [ + "product", + "mrp", + "stock", + "stock_move_cost", + ], "data": [ "views/mrp_production_views.xml", "views/mrp_stockmove_views.xml", diff --git a/mrp_production_cost/models/mrp_production.py b/mrp_production_cost/models/mrp_production.py index 0fcd0c11..c4d682db 100644 --- a/mrp_production_cost/models/mrp_production.py +++ b/mrp_production_cost/models/mrp_production.py @@ -105,6 +105,9 @@ def _compute_price_unit_cost(self): production.cost_manufacturing_real / production.qty_producing ) + def _post_inventory(self, cancel_backorder=False): + return super()._post_inventory(cancel_backorder=cancel_backorder) + def write(self, vals): result = super().write(vals) if "state" in vals and vals.get("state", False) == "done": diff --git a/mrp_production_cost/models/mrp_workorder.py b/mrp_production_cost/models/mrp_workorder.py index 182738cb..7ea9c6a0 100644 --- a/mrp_production_cost/models/mrp_workorder.py +++ b/mrp_production_cost/models/mrp_workorder.py @@ -22,17 +22,11 @@ class MrpWorkorder(models.Model): @api.depends("duration_expected", "costs_hour") def _compute_workorder_cost_estimated(self): for order in self: - workorder_cost_estimated = 0 - if order.duration_expected: - workorder_cost_estimated = order.costs_hour * ( - order.duration_expected / 60 - ) - order.workorder_cost_estimated = workorder_cost_estimated + order.workorder_cost_estimated = order.costs_hour * ( + order.duration_expected / 60 + ) @api.depends("duration", "costs_hour") def _compute_workorder_cost_real(self): for order in self: - workorder_cost_real = 0 - if order.duration: - workorder_cost_real = order.costs_hour * (order.duration / 60) - order.workorder_cost_real = workorder_cost_real + order.workorder_cost_real = order.costs_hour * (order.duration / 60)