odoo/odoo#238933

Created by fw-bot
Merged at cfa0cf5fcceee686c85a24023d034168b22e2fd4

Statuses:

label
odoo-dev:saas-18.4-17.0-opw-4806023-inventory-valuation-intricated-BoM-cohe-449254-fw
head
0ffd77394993d8244b8ef9061d99e231518f0a32
merged
1 week ago by Bugfix, Lancelot Semal (lase)
odoo/odoo
saas-18.3 #218326
saas-18.4 #238933
19.0 #240425 missing r+
saas-19.1
master

[FIX] purchase_mrp, mrp: correct BoM Kit valuation with nested kits

[FIX] purchase_mrp, mrp: correct BoM Kit valuation with nested kits

Issue:

When purchasing a BoM Kit (50/50) containing others BoM Kits (50/50), cost share was applied at each level (50% instead of 25%), leading to overvaluation (e.g., 200% total instead of 100%)

Cause:

cost_share was always applied fully during BoM explosion and as a portion of the full price on _get_unit_price()

Other bug fixed:

Fix _get_cost_share() to correctly return 0 when BoM total cost_share already equals 100%

Requirement:

AVCO (Average Cost) must be enabled on all components/BoMs

Steps to reproduce:

  1. Recreate that hierarchy with AVCO Products
    - A kit "Testing Kit Complete" containing:
    -- "Component01", cost share 50%
    -- A kit "Testing Kit 1", cost share 50%:
    --- "Component02", cost share 50%
    --- "Component03", cost share 50%
  2. Create and validate a Purchase Order for "Testing Kit Complete" (unit price: 1000)
  3. Receive the products
  4. Go in Inventory > Reporting > Valuation and search for Component
  5. All 3 components are set to 500, instead of Component01: 500 / Component02: 250/ Component03: 250

opw-4806023

[FIX] purchase_mrp: correct BoM valuation with product variants or optional lines

Issue:

BoM valuation ignores variant-specific lines and does not skip lines with quantity 0

Cause:

The code only checks that the BoM adds up to 100%
But this can cause issues with variants that do not include all products or with optional lines
As a result, the total valuation may be incorrect

Steps to reproduce:

  1. Recreate a kit hierarchy with AVCO products:
    - Kit "Variant Kit" (Variant Color: White and Wood) containing:
    -- "Component01", cost share 0%, only for variant White
    -- "Component02", cost share 0%
  2. Create and confirm a Purchase Order for "Variant Kit" (variant: Wood, unit price: 1000)
  3. Receive the products
  4. Go to Inventory > Reporting > Valuation and search for the components
  5. Only Component02 appears with 500$, so only half of the total value is shown

opw-4806023
opw-5085457

Forward-Port-Of: #218326