odoo/odoo#198777

Created by fw-bot
Merged at 92ecb239624067cb0699b43ee40d92d53d28cccf

Statuses:

label
odoo-dev:saas-18.1-18.0-opw-4509006-stock_landed_cost-fix-lot-standard-price-otd-414975-fw
head
0fc124cbee0772e5040e630ad275a7dec65f3eb2
merged
7 months ago by Bugfix, Djamel Touati (otd)
odoo/odoo
18.0 #197019
saas-18.1 #198777
saas-18.2 #204070
saas-18.3
saas-18.4
19.0
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: #197019