-
- Downloads
[FIX] stock: make `do_unreserve` faster than ever
`do_unreserve` is a action that can be made in the tree view of
`stock.picking` but it was very slow and not batched.
For 80 picking with -/+ 10 `stock.move.line` related each
(calculate on 5 sample of 80 pickings):
It took 17947 +- 2741 SQL requests, 7.37 +- 1.09 sec of SQL
and 8.13 +- 1.31 sec of python execution (+- 15.5 sec in total)
Make some change to speed up the unreservation of
multiple picking/move:
- Batch the call of `_do_unreserve` of move in picking
- Use OrderedSet instead of RecordSet to reduce the complexity of
`_do_unreserve`. (Become significant when len(recordset) > 1000)
- Add `.with_prefetch()` in the unlink of stock move line
to patch issue with prefetching + unlink + cache.
- Batch `_recompute_state`
- Also batch the `do_unreserve` of MO
Result after change in the same samples:
It take now 1438 +- 20 SQL requests, 0.45 +- 0.02 sec of SQL
and 0.68 +- 0.02 sec of python execution (+- 1.13 sec in total,
13 times faster). Note that the gain increase proportionally.
task-2383111
closes odoo/odoo#61879
Signed-off-by:
Arnold Moyaux <amoyaux@users.noreply.github.com>
Showing
- addons/mrp/models/mrp_production.py 1 addition, 2 deletionsaddons/mrp/models/mrp_production.py
- addons/stock/models/stock_move.py 22 additions, 17 deletionsaddons/stock/models/stock_move.py
- addons/stock/models/stock_move_line.py 4 additions, 1 deletionaddons/stock/models/stock_move_line.py
- addons/stock/models/stock_picking.py 2 additions, 3 deletionsaddons/stock/models/stock_picking.py
Loading
Please register or sign in to comment