-
- Downloads
[FIX] stock: compute forecasted inventory with inter-wh
When moving some products between two warehouses thanks to an internal transfer, the forecasted inventory becomes incorrect To reproduce the issue: 1. In Settings, enable "Multi-Warehouses" 2. Let WH01 be the existing warehouse. Create a second one WH02 3. Create a storable product P 4. Update the quantity of P: - 3 in WH01/Stock 5. Create a planned and internal transfer T: - Source: WH01/Stock - Destination: WH02/Stock - Ignore the warning - Operations: - 1 x P 6. Mark T as todo 7. Open the Forecasted Inventory: - Filters: - Forecasted Stock - Product: P - Group By: Warehouse Error: The report is incorrect, it says there are 3 P in WH01 and 0 in WH02 (should be 2 and 1). It becomes worst if T is done (the quantities in the past become incorrect) We should be able to move a product between two warehouses thanks to an internal transfer (so the warning of the step 5 should be removed). Moreover, the `report.stock.quantity` should consider that use case. When processing a stock move, the SQL view translates it as an in-move or out-move for a specific warehouse. For instance, if the SM comes from a warehouse and goes to a location without any warehouse (e.g., customer location), the SM is considered as an out-move. But here is the issue: in case of an inter-warehouse SM, both source and destination have a defined warehouse. Therefore, we need to: - Duplicate the inter-warehouses SM (so we have one in and one out) - Fake the values (no destination warehouse for the out move, no source warehouse for the in move) Also, before duplicating all SM, we filter out some useless SM: - Draft and cancelled ones - SM done more than 3 months ago (because the report only works for [-3 months; +3 months]) Considering some tests: (SM are confirmed. Each test has been repeated 5 times to get an average) | | | |:-------------------------------------:|:--------:| | 5000 SM, 0% inter-wh, without the fix | ~715 ms | | 5000 SM, 0% inter-wh, with the fix | ~710 ms | | Impact | 0.99x | | | | | 6666 SM, 0% inter-wh, without the fix | ~911 ms | | 5000 SM, 33% inter-wh, with the fix | ~999 ms | | Impact | 1.10x | | | | | 7500 SM, 0% inter-wh, without the fix | ~1004 ms | | 5000 SM, 50% inter-wh, with the fix | ~1097 ms | | Impact | 1.09x | The impact is not that significant OPW-2752017 task-2822157 closes odoo/odoo#91056 X-original-commit: b6833702 Signed-off-by:Arnold Moyaux <arm@odoo.com> Signed-off-by:
Adrien Widart <awt@odoo.com>
Showing
- addons/stock/i18n/stock.pot 0 additions, 9 deletionsaddons/stock/i18n/stock.pot
- addons/stock/models/stock_picking.py 0 additions, 12 deletionsaddons/stock/models/stock_picking.py
- addons/stock/report/report_stock_quantity.py 68 additions, 35 deletionsaddons/stock/report/report_stock_quantity.py
- addons/stock/tests/test_report_stock_quantity.py 59 additions, 1 deletionaddons/stock/tests/test_report_stock_quantity.py
Loading
Please register or sign in to comment