Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The purpose of this PR is to be able to process a lot of serial numbers at once. In receipt and deliveries
In the current situation, the number of serial already in stock has an impact on the perf (due to
update_available_quantity
that do a_gather
on current stock). All the metrics below are made with 50 000 SN already in stockBefore (in seconds):
After:
By operations/ receipts (for 5000):
By operations/ deliveries (for 5000):
The main issues:
_action_assign
use strict=False in_gather
(mts case). It means a child_of operator is in the domain, and it will perform an extra query anywaystock.move.line
bystock.move.line
on 30 000, half of the time is spent to find them.After some testing. The quant_cache could contain too many items than needed by the current operation. Example receive 1 serial number (that will not have an existing quant) will use a quant_cache with all the serial number of the products. As a result, the group by will be super slow. Allow to add an extra domain, to limit the cache size. /!\ could be dangerous if it filter out too much
Forward-Port-Of: #158229
Forward-Port-Of: #146494