[FIX] product_extended: workcenter cost
- Create a work center with a capacity of 1, an efficiency factor of 100% and a cost per hour of 40$ - Create a routing with two operations: one with a fixed duration of 30:00 minutes (OP1) and another with a duration computed on real time but with a default of 30:00 minutes (OP2) - Create a component with UOM "m" and a cost of 10$ - Create a finished product with an associated BoM - The BoM has a first line with 0.8m of component in the OP1 and a second line with 0.4m of component in the OP2 - Activate the Compute from BoM option on the finished product - The proposed cost is 32$ Expected cost: 52$ (30 minutes @40$/hour + 30 minutes @40$/hour + 1,2m @10$/m) We divide the WC cost by the number of operations, which does not make sense. opw-741032
This commit is contained in:
@@ -35,7 +35,6 @@ class ProductProduct(models.Model):
|
||||
|
||||
def _calc_price(self, bom):
|
||||
price = 0.0
|
||||
workcenter_cost = 0.0
|
||||
result, result2 = bom.explode(self, 1)
|
||||
for sbom, sbom_data in result2:
|
||||
if not sbom.attribute_value_ids:
|
||||
@@ -45,8 +44,7 @@ class ProductProduct(models.Model):
|
||||
total_cost = 0.0
|
||||
for order in bom.routing_id.operation_ids:
|
||||
total_cost += (order.time_cycle_manual/60) * order.workcenter_id.costs_hour
|
||||
workcenter_cost = total_cost / len(bom.routing_id.operation_ids)
|
||||
price += bom.product_uom_id._compute_price(workcenter_cost, bom.product_id.uom_id)
|
||||
price += bom.product_uom_id._compute_price(total_cost, bom.product_id.uom_id)
|
||||
# Convert on product UoM quantities
|
||||
if price > 0:
|
||||
price = bom.product_uom_id._compute_price(price / bom.product_qty, self.uom_id)
|
||||
|
||||
Reference in New Issue
Block a user