[16.0][IMP] stock_available_to_promise_release no search available to promise qty on done / canceled moves
In databases with a large number of moves, this operation is slow and becomes slower as the number of moves increases. I wonder why we should look for available quantities in moves that are in the done or cancelled status? Perhaps there is a reason for this, but IMO we should exclude them from the search.
I am trying to improve the processing time of product.pickings_auto_release
@jbaudoux can I please have your opinion on that ?
side note, from what I see in the code, when a move is cancelled, need_release is set to False. But since there is an index on state it is still interesting.
IMO the issue is located in stock_move_auto_assign_auto_release which triggers too much queries due to unwanted search operations on release_ready + ordered_available_to_promise_qty. I did a fix here which greatly improved the situation in our project, and reduce the number of queries executed a lot:
- https://github.com/OCA/stock-logistics-workflow/pull/2169
IMO the issue is located in
stock_move_auto_assign_auto_releasewhich triggers too much queries due to unwanted search operations onrelease_ready+ordered_available_to_promise_qty. I did a fix here which greatly improved the situation in our project, and reduce the number of queries executed a lot:
@sebalix thanks a lot for that. Indeed your approach improves even more the processing time. I close this PR and backport your improvement. Done here: https://github.com/OCA/stock-logistics-warehouse/pull/2468
Closing in favor of this implementation https://github.com/OCA/stock-logistics-workflow/pull/2169