Skip to content

[19.0][MIG] stock_available_immediately_exclude_location: Migration to 19.0 - #93

Open
ivantodorovich wants to merge 13 commits into
OCA:19.0from
camptocamp:19.0-mig-stock_available_immediately_exclude_location
Open

ivantodorovich wants to merge 13 commits into
OCA:19.0from
camptocamp:19.0-mig-stock_available_immediately_exclude_location

Conversation

@ivantodorovich

@ivantodorovich ivantodorovich commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

Migration to 19.0.

Depends on:

Changes:

  • Compute the immediately usable quantity on the locations of the context that are not excluded, instead of deducing the quantity on hand in the excluded locations: a delivery reserved in an excluded location was deduced twice, a date without time was taken at midnight for the excluded locations, the lot, owner, package and expired quantities were ignored for them, and a transfer out of an excluded location now only makes its goods usable once they arrive.
  • Drop the _get_domain_locations_new override for the strict context key, which core supports again since 17.0, and cache the excluded locations apart with and without it.
  • Replace ormcache_context with ormcache.
  • Fix the typos in the method names (immadiatly, immediatley).
  • Refresh the cached excluded locations when the parent, usage or active state of a location changes (separate commit).

glitchov and others added 5 commits October 27, 2026 13:00
* Replace specific code to compute the location domain from the stock quant domain by a call to a method provided by the stock_available_location_get_domain addon. This new method significantly improves the performances by avoiding the call to the 'fields_get' method on the model. This reduce the processing time to compute the domain from 17.4ms to less than 1ms.
* Caching the list of locations to exclude from the immediately available
  quantity computation.
* Avoiding to query the incoming and outgoing quantities for the locations to
  exclude when computing the available quantity into the locations to exclude.

As result, on the workbench used when profiling the module, the time to compute
the available quantity is reduced from 158ms to 134ms (15% improvement). If we
take into account the performance gain of the previous commit, the time is
reduced from 244ms to 134ms (45% improvement).

* Restore the original behaviour on computing the available quantity
for excluded locations on strict mode. IOW the available quantity is computed
on records that are linked directly to the location_id and not on records that
are linked to a location child of the excluded locations.

This is a performance improvement and boost the computation from 134ms to 74ms (45% improvement) on the workbench test.
…ilable quantity update when excluding locations
@OCA-git-bot OCA-git-bot added series:19.0 mod:stock_available_immediately_exclude_location Module stock_available_immediately_exclude_location labels Oct 27, 2026
@ivantodorovich
ivantodorovich force-pushed the 19.0-mig-stock_available_immediately_exclude_location branch 4 times, most recently from 5ee1425 to 73ae4f1 Compare October 27, 2026 18:36
@ivantodorovich
ivantodorovich marked this pull request as ready for review October 27, 2026 19:37
@ivantodorovich
ivantodorovich force-pushed the 19.0-mig-stock_available_immediately_exclude_location branch from 73ae4f1 to 1e43976 Compare October 27, 2026 19:38
…e excluded locations

Compute the immediately usable quantity on the locations of the context that
are not excluded, instead of deducing the quantity on hand in the excluded
locations. A delivery reserved in an excluded location was deduced twice, a
date without time was taken at midnight for the excluded locations, and the
lot, owner, package and expired quantities were ignored for them. A transfer
out of an excluded location now only makes its goods usable once they arrive.
…excluded locations

The cache keys were taken as the names of context keys that never exist, so
the excluded locations only depended on the companies. Cache them for the
locations, warehouses and strict key of the context.
…verride

Core supports the strict context key again since 17.0.
@ivantodorovich
ivantodorovich force-pushed the 19.0-mig-stock_available_immediately_exclude_location branch from 1e43976 to 85af0d1 Compare October 28, 2026 12:18
@ivantodorovich

Copy link
Copy Markdown
Contributor Author

Hey @glitchov , @lmignon , @bizzappdev

As you worked on this module, you might be interested in its migration

…ved locations

An archived location can still hold goods, which are counted in the
quantities, but it was never found among the excluded locations.
…ded locations

The cached excluded locations also depend on the parent and the usage of the
locations, not only on their exclusion flag. Refresh them when any of these
change.
@ivantodorovich
ivantodorovich force-pushed the 19.0-mig-stock_available_immediately_exclude_location branch from 85af0d1 to 448b0fc Compare October 28, 2026 13:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

mod:stock_available_immediately_exclude_location Module stock_available_immediately_exclude_location series:19.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants