frappe / erpnext

Free and Open Source Enterprise Resource Planning (ERP)
https://erpnext.com
GNU General Public License v3.0
20.48k stars 7.09k forks source link

Stock Reconciliation - Issue with Batch Wise valuation rate #39226

Open guilmori opened 8 months ago

guilmori commented 8 months ago

Information about bug

I’m doing a Purchase Receipt with 2 different batches of the same item. Lot-5 with 10 qty at 5$. Lot-10 with 10 qty at 10$.

image

Here is the resulting Stock Ledger, all good. image

Then I create a stock reconciliation where I want to remove 1 qty of Lot-10. The system fetch a valuation rate of $7.50, even though my item valuation is FIFO with batch-wise activated. I think it should fetch $10 instead. image

After submit the stock reconcilation, here is the resulting Stock Ledger. image

Since I’m removing 1 qty of batch at $10, I was expecting my stock balance value to be reduced by $10. But instead, 10 qty were removed at $10, and 9 qty added at $7.50 resulting in a variation of -$32.50 in my stock balance value.

This makes no sense to me … any insights ? Bug ?

Module

stock

Version

ErpNext v14.23.0.

Installation method

None

Relevant log output / Stack trace / Full Error Message.

No response

guilmori commented 8 months ago

@rohitwaghchaure Could you reproduce ? This is an important mater to us.

How should we proceed to:

guilmori commented 8 months ago

I found this TODO comment. It explains why this isn't working ;-)

https://github.com/frappe/erpnext/blob/daf954057fc59b90a0f7e60e055ae9316f7d77cb/erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.py#L1082