Trying to understand the design decision behind using Average Rate for purchase/incoming transactions when stock goes negative, rather than the Incoming Rate.
Context
We have a multi-entity setup and one of our subsidiaries occasionally hits negative stock due to sequencing issues between inter-company transactions. When this happens, ERPNext falls back to Average Rate for valuation, and this creates GL entries that don’t reflect the actual cost at which the stock was received.
The confusion
I understand why negative stock is problematic for valuation — the system can’t reliably determine cost when stock doesn’t exist yet. FIFO and Moving Average both break down conceptually when quantity goes below zero. But here’s what I don’t get: for an incoming transaction specifically (Purchase Receipt, Stock Entry with type Receipt, etc.), we do know the rate. The supplier invoice or PO has the rate. It’s not unknown. So why not use the Incoming Rate from that transaction for the GL entry, rather than falling back to Average Rate (which could be stale, zero, or completely unrelated)?
### What we observed When stock is negative and a Purchase Receipt comes in: - The Stock Ledger Entry uses Average Rate, not the actual incoming rate - This causes the GL to post at a rate different from what’s on the Purchase Receipt - Results in valuation differences that need manual correction
### My question Was this an intentional design decision? If so, what’s the rationale — is it to keep the valuation method consistent across all SLEs for a given item, even at the cost of accuracy on individual transactions? Or is this a known limitation that’s been deprioritized? Would also appreciate if anyone has a workaround short of disabling negative stock entirely (which isn’t always operationally feasible).