Fix Install Stock Items shows only selected parts - #12596
Merged
SchrodingersGat merged 3 commits intoAug 9, 2026
Merged
Conversation
✅ Deploy Preview for inventree-web-pui-preview ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
Contributor
Author
|
Hi @SchrodingersGat , this is my first contribution to this project. I've fixed #12232 by making the "Install Stock Item" dialog's stock selector respect the same BOM/variant restrictions the part selector already enforces, so it no longer offers variant stock items that the backend would reject at submit time. Would appreciate a review when you have time! |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #12596 +/- ##
=======================================
Coverage 86.74% 86.74%
=======================================
Files 1447 1447
Lines 96675 96690 +15
Branches 11260 11259 -1
=======================================
+ Hits 83859 83876 +17
+ Misses 12752 12750 -2
Partials 64 64
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
Member
|
@siddhartha928 thanks for the contribution |
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.

What does this PR do?
Fixes the "Install Stock Item" dialog so the stock item selector only lists stock for the exact part chosen in the part selector, instead of also including stock for all of that part's variants. This closes a gap where the UI would let a user pick a variant's stock item that the backend would then reject at submit time.
Why was this PR needed?
When installing a stock item into an assembly with a BOM, the part selector already correctly restricts choices based on the BOM (respecting each line's "Allow Variants" setting). However, the stock item selector is filtered only by the selected part, and the stock list API's include_variants filter defaults to true when not specified, so it silently re-expanded the results to include every variant's stock, even for BOM lines with variants disallowed. This meant a user could select a variant's stock item in the UI that the install serializer's BOM check would then reject with "Selected part is not in the Bill of Materials", a mismatch between what the UI showed and what the API would accept. The fix passes include_variants: false explicitly in the stock item selector's filters so it never shows options the backend won't allow.
What are the relevant issue numbers?
Closes #12232
Does this PR meet the acceptance criteria?