Skip to content

Support physical units for BOM lines#11631

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

Support physical units for BOM lines#11631
SchrodingersGat wants to merge 22 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 units demo-dataset#108
  • 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 canceled.

Name Link
🔨 Latest commit f5483b1
🔍 Latest deploy log https://app.netlify.com/projects/inventree-web-pui-preview/deploys/69db08175c4c120008703fdb

@codecov
Copy link
Copy Markdown

codecov bot commented Mar 30, 2026

Codecov Report

❌ Patch coverage is 83.96226% with 17 lines in your changes missing coverage. Please review.
✅ Project coverage is 91.33%. Comparing base (40b67f5) to head (f5483b1).

Additional details and impacted files
@@            Coverage Diff             @@
##           master   #11631      +/-   ##
==========================================
- Coverage   91.34%   91.33%   -0.02%     
==========================================
  Files         967      968       +1     
  Lines       50277    50357      +80     
==========================================
+ Hits        45928    45996      +68     
- Misses       4349     4361      +12     
Flag Coverage Δ
backend 89.23% <83.96%> (-0.01%) ⬇️

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

Components Coverage Δ
Backend Apps 91.69% <83.65%> (-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
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

1 participant