Sunday, September 27, 2026
1 change · 19.0
Resolved issues and error corrections
The Peruvian PLE 13.1 inventory report now calculates average-cost product values in the same date-based order as the Inventory at Date report. This prevents mismatched closing balances when receipts are backdated or deliveries are returned, improving consistency for accounting and audits.
Original PR description
## Description of the issue Stock valuation is recorded per move: the value stored on an outgoing move is `quantity * standard price` at **validation** time. When moves are validated out of…
## Description of the issue Stock valuation is recorded per move: the value stored on an outgoing move is `quantity * standard price` at **validation** time. When moves are validated out of chronological order (backdated receipts) or deliveries are returned, those recorded values diverge from the weighted average that results from walking the moves in date order, which is how the inventory valuation at date (`_run_average_batch(at_date)`) computes the stock value. The PLE 13.1 report (Registro de Inventario Permanente Valorizado, SUNAT) summed the recorded values, so its balances did not match the Inventory at Date report nor the stock closing entries, and an auditor recomputing the weighted average in date order could not reproduce the outgoing costs line by line. ## Steps to reproduce 1. PE company, AVCO product. 2. Receive 10 units at 100. Deliver 5 units (valued 5 x 100 = 500). 3. Receive 10 units at 200, then set the move date **before** the delivery. 4. Generate PLE 13.1 for the period and compare with the Inventory at Date report at the period end. Current behavior: the delivery line shows 500 and the ending balance 2,500, while the Inventory at Date report shows 2,250. Expected behavior: the delivery is valued at the date-ordered average (5 x 150 = 750) and the ending balance (2,250) matches the valuation at date. ## Solution Value outgoing lines of average costed products with the running average maintained in date order, seed it from the recomputed opening balance (reusing `product.product._run_average_batch()`), and reset it from the receipt unit cost when the previous quantity is not positive, replicating the valuation-at-date walk. Opening and historic balance lines use the same recomputed value. Products with standard or FIFO cost methods keep the recorded values. Manual standard price revaluations dated inside the reported period are not replayed by the period walk. task-100934