[13.0][MIG] product_cost_rollup_to_bom: Backport from 14.0

This commit is contained in:
Héctor Villarreal Ortega
2022-06-28 10:39:28 +02:00
committed by Héctor Vi Or
parent 47576de8b2
commit 044c98879b
2 changed files with 4 additions and 8 deletions

View File

@@ -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",

View File

@@ -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()