odoo/odoo#204070

Created by fw-bot
Merged at 788ff94c66fd7a9754ea5f6f740bcf280c19c47e

Statuses:

label
odoo-dev:saas-18.2-18.0-opw-4509006-stock_landed_cost-fix-lot-standard-price-otd-417893-fw
head
8edc65635ec7bdd8e6c4a8c73f74e79bb8efb2eb
merged
3 months ago by Bugfix, Djamel Touati (otd)
odoo/odoo
18.0 #197019
saas-18.1 #198777
saas-18.2 #204070
saas-18.3
master #204074

[FW][FIX] stock_landed_cost: update the lot standard price correctly

Steps to reproduce the bug:
- Create two storable products, P1 and P2:
- tracked by: lot
- Valuated by: lot

  • Create a service product, S1:

    • is landed cost: True
    • value: $100
  • Create a receipt:

    • unit of P1, unit price: $1
    • unit of P2, unit price: $1
  • Add the landed cost S1, split by quantity.

Problem:

The cost valuation of the products is then $51 each. The product form
and valuation are displayed correctly. However, if we check the lot,
the cost appears as $101.
This issue occurs because, when validating the landed cost, we have a
dictionary mapping lots to values. Then, we iterate over each product,
but we do not filter the lot dictionary for the current product.
Instead, we traverse the entire dictionary, leading to the lot values
being processed twice.

opw-4509006

Forward-Port-Of: #198777
Forward-Port-Of: #197019