From 044c98879b8a999508be44d8d2c0d7e429caf272 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C3=A9ctor=20Villarreal=20Ortega?= Date: Tue, 28 Jun 2022 10:39:28 +0200 Subject: [PATCH] [13.0][MIG] product_cost_rollup_to_bom: Backport from 14.0 --- product_cost_rollup_to_bom/__manifest__.py | 7 ++----- product_cost_rollup_to_bom/models/product.py | 5 ++--- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/product_cost_rollup_to_bom/__manifest__.py b/product_cost_rollup_to_bom/__manifest__.py index 534e8dd7e..64673aa0c 100644 --- a/product_cost_rollup_to_bom/__manifest__.py +++ b/product_cost_rollup_to_bom/__manifest__.py @@ -3,7 +3,7 @@ { "name": "Product BOM Cost Rollup", - "version": "14.0.1.0.0", + "version": "13.0.1.0.0", "author": "Open Source Integrators, Odoo Community Association (OCA)", "summary": """Update BOM costs by rolling up. Adds scheduled job for unattended rollups.""", @@ -12,10 +12,7 @@ "maintainer": "dreispt", "development_status": "Alpha", "website": "https://github.com/OCA/manufacture", - "depends": [ - "mrp_account", - "stock_account", - ], + "depends": ["mrp_account", "stock_account"], "data": [ "views/product_views.xml", "views/mrp_bom.xml", diff --git a/product_cost_rollup_to_bom/models/product.py b/product_cost_rollup_to_bom/models/product.py index d123e9456..6ac155402 100644 --- a/product_cost_rollup_to_bom/models/product.py +++ b/product_cost_rollup_to_bom/models/product.py @@ -78,7 +78,7 @@ class ProductProduct(models.Model): if not boms_to_recompute: boms_to_recompute = [] total = 0 - for opt in bom.operation_ids: + for opt in bom.routing_id.operation_ids: duration_expected = ( opt.workcenter_id.time_start + opt.workcenter_id.time_stop @@ -114,8 +114,7 @@ class ProductProduct(models.Model): * line.product_qty ) if not float_is_zero( - child_total - line.product_id.standard_price, - precision_rounding=2, + child_total - line.product_id.standard_price, precision_rounding=2, ): line.product_id._change_standard_price(child_total) line.product_id.std_cost_update_date = datetime.now()