Skip to content
Snippets Groups Projects
Commit 4d3147a0 authored by Anh Thao Pham (pta)'s avatar Anh Thao Pham (pta)
Browse files

[FIX] stock_account: fix computation of anglo saxon price unit


- Create a product with Category configured with:
  * Costing Method: First In First Out (FIFO)
  * Inventory Valuation: Automated
- Create a PO to buy 2 units at $100 (PO1) and receive the products
- Create a SO to sell 2 units (SO1) and deliver the products
  => COGS of SO1 should be $200 ($100 * 2)
- Return 1 unit from previous delivery
  => COGS of SO1 should be $100
- Create a SO to sell 1 unit (SO2) and deliver product
  => COGS of SO2 is $100
- Create a PO to buy 1 unit at $200 (PO2) and receive the product
- Re-deliver the returned unit from SO1
  => COGS of SO1 should be $300 ($100 + $200)
- Create invoice for SO1 and post it
The journal items (account.move.line) corresponding to the COGS have an incorrect
value: $200 ($100 + $100), instead of $300 ($100 + $200)

The issue comes from the method computing the anglo saxon price unit.
It does not take into account quantities from stock moves that have been returned.

This commit computes the number of units that have been returned for each stock
moves used to compute the anglo saxon price unit and to take the result into account
during the computation (of the anglo saxon price unit).

opw-2501260

closes odoo/odoo#69923

Signed-off-by: default avatarWilliam Henrotin <Whenrow@users.noreply.github.com>
parent 6a66fc3a
Branches
Tags
No related merge requests found
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment