Skip to content

Commit

Permalink
[IMP] mrp_production_cost: no need of if
Browse files Browse the repository at this point in the history
  • Loading branch information
oihane committed Oct 29, 2024
1 parent 398019b commit 9f9069c
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 11 deletions.
7 changes: 6 additions & 1 deletion mrp_production_cost/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
3 changes: 3 additions & 0 deletions mrp_production_cost/models/mrp_production.py
Original file line number Diff line number Diff line change
Expand Up @@ -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":
Expand Down
14 changes: 4 additions & 10 deletions mrp_production_cost/models/mrp_workorder.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

0 comments on commit 9f9069c

Please sign in to comment.