From ffbcf69af5a06b6d99d4208a17ffa4a368233845 Mon Sep 17 00:00:00 2001 From: Martin Trigaux Date: Tue, 12 Dec 2017 11:36:58 +0100 Subject: [PATCH] [FIX] product_extended: remove not working price computation costs_hour field no longer exists Some modules in a different repository (let say enterprise), may be still using it but it is not its place here. For stability reasons, we keep the computation if an external module adds the missing field anyway Fixes #16269 Closes #20899 --- addons/product_extended/models/product.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/addons/product_extended/models/product.py b/addons/product_extended/models/product.py index f0f886b66d4..0efd659dd79 100644 --- a/addons/product_extended/models/product.py +++ b/addons/product_extended/models/product.py @@ -41,10 +41,12 @@ class ProductProduct(models.Model): # No attribute_value_ids means the bom line is not variant specific price += sbom.product_id.uom_id._compute_price(sbom.product_id.standard_price, sbom.product_uom_id) * sbom_data['qty'] if bom.routing_id: - total_cost = 0.0 - for order in bom.routing_id.operation_ids: - total_cost += (order.time_cycle/60) * order.workcenter_id.costs_hour - price += bom.product_uom_id._compute_price(total_cost, bom.product_id.uom_id) + # FIXME master: remove me + if hasattr(self.env['mrp.workcenter'], 'costs_hour'): + total_cost = 0.0 + for order in bom.routing_id.operation_ids: + total_cost += (order.time_cycle/60) * order.workcenter_id.costs_hour + 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)