Skip to content

Fix Install Stock Items shows only selected parts - #12596

Merged
SchrodingersGat merged 3 commits into
inventree:masterfrom
siddhartha928:12232-install-stock-variant-filter
Aug 9, 2026
Merged

Fix Install Stock Items shows only selected parts#12596
SchrodingersGat merged 3 commits into
inventree:masterfrom
siddhartha928:12232-install-stock-variant-filter

Conversation

@siddhartha928

Copy link
Copy Markdown
Contributor

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?

  • Tests added for new/changed behavior
  • Follows project style guide
  • No breaking changes introduced

@netlify

netlify Bot commented Aug 9, 2026

Copy link
Copy Markdown

Deploy Preview for inventree-web-pui-preview ready!

Name Link
🔨 Latest commit 9b4b92f
🔍 Latest deploy log https://app.netlify.com/projects/inventree-web-pui-preview/deploys/6a77db58ecd7d6000813d116
😎 Deploy Preview https://deploy-preview-12596--inventree-web-pui-preview.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
Lighthouse
Lighthouse
1 paths audited
Performance: 98 (🟢 up 1 from production)
Accessibility: 81 (no change from production)
Best Practices: 100 (no change from production)
SEO: 78 (no change from production)
PWA: -
View the detailed breakdown and full score reports
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@siddhartha928

Copy link
Copy Markdown
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!

@SchrodingersGat SchrodingersGat added the User Interface Related to the frontend / User Interface label Aug 9, 2026
@SchrodingersGat SchrodingersGat added this to the 1.5.0 milestone Aug 9, 2026
@codecov

codecov Bot commented Aug 9, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 86.74%. Comparing base (214f472) to head (9b4b92f).

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           
Flag Coverage Δ
backend 90.76% <100.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Components Coverage Δ
Backend Apps 92.13% <100.00%> (+<0.01%) ⬆️
Backend General 93.53% <ø> (ø)
Frontend 79.65% <ø> (-0.01%) ⬇️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@SchrodingersGat
SchrodingersGat merged commit 76bce6a into inventree:master Aug 9, 2026
47 checks passed
@SchrodingersGat

Copy link
Copy Markdown
Member

@siddhartha928 thanks for the contribution

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

User Interface Related to the frontend / User Interface

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Install Stock Items shows all variants of part in stock list when Allow Variants is off

3 participants