[16.0] [FIX] stock_available_immediately: kit immediately_usable_qty computed from components#73
Open
alvaro-gmz wants to merge 1 commit into
Open
Conversation
…igurable without module uninstall
50c1c94 to
f15ef58
Compare
e9cc43a to
f1ad23b
Compare
AdrianaSaiz
approved these changes
Apr 28, 2026
| "incoming_qty", | ||
| "bom_ids", | ||
| "bom_ids.bom_line_ids", | ||
| "bom_ids.bom_line_ids.product_qty", |
There was a problem hiding this comment.
you can add bom_ids.bom_line_ids.product_id
alvaro-gmz
added a commit
to factorlibre/stock-logistics-availability
that referenced
this pull request
Apr 28, 2026
…epends Address review comment from @AdrianaSaiz on PR OCA#73: extend the @api.depends of _compute_available_quantities to also track bom_ids.bom_line_ids.product_id so the kit cache is invalidated when a component is replaced (not only when its quantity changes).
65ec67a to
2024341
Compare
98664d8 to
2024341
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
For products with a phantom BoM (kits), the formula
immediately_usable_qty = virtual_available - incoming_qtyapplied to theaggregated kit fields produces inconsistent results because each aggregated
kit field (
virtual_available,incoming_qty, ...) is computed by Odoo MRPas an independent
minover the components and may be limited by differentcomponents. Subtracting two such mins is not equivalent to
qty_available - outgoing_qtyfor kits, even though that algebraiccancellation does hold for plain products.
Example
Kit with two components,
need=2each:Fix
When the
mrpmodule is installed, recomputeimmediately_usable_qtyforproducts with a phantom BoM directly from the components (whose individual
values do hold the correct cancellation) and aggregate them with
min(component / qty_per_kit). The other kit fields (qty_available,virtual_available,incoming_qty,outgoing_qty,free_qty) areintentionally left untouched and keep the standard Odoo MRP aggregation.
If
mrpis not installed, behaviour is unchanged.Tests
Added covering: