stock-logistics-reporting icon indicating copy to clipboard operation
stock-logistics-reporting copied to clipboard

[17.0][IMP] stock_quant_history: performance improvements

Open bosd opened this issue 4 months ago • 1 comments

FW port of #424

Depends on #415

Creating a new snapshot has 2 main phases that we optimize in different ways:

  • duplicate previous snapshot
  • compute new stock parsing stock.move.line

duplicate previous snapshot

This can be at SQL level to avoid ORM overhead creating the request dynamically.

On my laptop duplicate 93633 previous stock.quant.history records goes from 5'21 to 0'09'' (x35 faster)

Compute new stock

This loop over stock.move.line between previous snapshot and the new one to compute new stock.quant.history. Looping over 2 read_group improve the situation in my current context processing 96462 stock.move.line from 1'37'' to 0'23''.

bosd avatar Aug 11 '25 19:08 bosd

Hi @petrus-v, some modules you are maintaining are being modified, check this out!

OCA-git-bot avatar Aug 11 '25 19:08 OCA-git-bot