Skip to content

Support physical units for BOM lines#11631

Open
SchrodingersGat wants to merge 39 commits intoinventree:masterfrom
SchrodingersGat:physical-bom-lines
Open

Support physical units for BOM lines#11631
SchrodingersGat wants to merge 39 commits intoinventree:masterfrom
SchrodingersGat:physical-bom-lines

Conversation

@SchrodingersGat
Copy link
Copy Markdown
Member

@SchrodingersGat SchrodingersGat commented Mar 30, 2026

This PR implements support for physical units in BOM items.

Breaking Change

The "quantity" field on the BOMItem model is now calculated based on the provided "raw_amount" field - any plugins which are trying to write directly to the "quantity" field will experience errors.

Plugins should either write to the "raw_amount" field directly, or use the new "set_quantity" helper method on the BOMItem model.

API Change

This PR introduces a new "raw_amount" field to the BomItem API - which is preferenced over the "quantity" field. However, if only the "quantity" field is provided, it will be used, to allow backwards compatibility with existing systems.

Tasks

  • Data / schema migrations
  • Update serializers and API endpoints
  • Continue to allow write to "quantity" field (if "raw_amount" field not present)
  • Logic for validating raw amount
  • Update existing unit tests
  • Additional unit tests for physical unit / quantity validation
  • Additional playwright tests
  • Update documentation
  • Update CHANGELOG.md
  • Update "wireviz" plugin to allow specification in raw amount values - Do not use BulkCreate inventree-wireviz#60
  • Perform data migration on demo dataset - BOM raw amount demo-dataset#111
  • Add non-numeric raw-amount values to demo dataset (for testing) - Bom units demo-dataset#108

@SchrodingersGat SchrodingersGat added part Related to Part models api Relates to the API breaking Indicates a major update or change which breaks compatibility User Interface Related to the frontend / User Interface labels Mar 30, 2026
@netlify
Copy link
Copy Markdown

netlify Bot commented Mar 30, 2026

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

Name Link
🔨 Latest commit 7091076
🔍 Latest deploy log https://app.netlify.com/projects/inventree-web-pui-preview/deploys/69f9af70e2d9db0009a608c2
😎 Deploy Preview https://deploy-preview-11631--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: 92 (🔴 down 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.

@codecov
Copy link
Copy Markdown

codecov Bot commented Mar 30, 2026

Codecov Report

❌ Patch coverage is 84.25926% with 17 lines in your changes missing coverage. Please review.
✅ Project coverage is 91.36%. Comparing base (6f1d40d) to head (7091076).

Additional details and impacted files
@@            Coverage Diff             @@
##           master   #11631      +/-   ##
==========================================
- Coverage   91.37%   91.36%   -0.02%     
==========================================
  Files         971      972       +1     
  Lines       50377    50457      +80     
==========================================
+ Hits        46031    46099      +68     
- Misses       4346     4358      +12     
Flag Coverage Δ
backend 89.19% <84.25%> (-0.01%) ⬇️

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

Components Coverage Δ
Backend Apps 91.69% <83.96%> (-0.02%) ⬇️
Backend General 93.41% <ø> (ø)
Frontend ∅ <ø> (∅)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@SchrodingersGat SchrodingersGat added this to the 1.4.0 milestone Apr 2, 2026
SchrodingersGat added a commit to inventree/inventree-wireviz that referenced this pull request Apr 12, 2026
- Allows for forwards / backwards compatibility
- Ref: inventree/InvenTree#11631
Copy link
Copy Markdown
Member

@matmair matmair left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM; I am not sure if showing "raw" quantity and quantity to the user is an implementation detail the user needs to see long-term

Comment thread src/frontend/src/forms/BomForms.tsx Outdated
Comment thread src/frontend/tests/customization/customization.spec.ts Outdated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api Relates to the API breaking Indicates a major update or change which breaks compatibility documentation part Related to Part models User Interface Related to the frontend / User Interface

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature] Support physical units for BOM lines

2 participants