Skip to content

Support physical units for BOM lines#11631

Merged
SchrodingersGat merged 47 commits into
inventree:masterfrom
SchrodingersGat:physical-bom-lines
May 10, 2026
Merged

Support physical units for BOM lines#11631
SchrodingersGat merged 47 commits into
inventree: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 451d15a
🔍 Latest deploy log https://app.netlify.com/projects/inventree-web-pui-preview/deploys/69fffde6a2369e0008df14bc
😎 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.76190% with 16 lines in your changes missing coverage. Please review.
✅ Project coverage is 91.34%. Comparing base (b47091f) to head (451d15a).

Additional details and impacted files
@@            Coverage Diff             @@
##           master   #11631      +/-   ##
==========================================
- Coverage   91.35%   91.34%   -0.01%     
==========================================
  Files         972      973       +1     
  Lines       50421    50498      +77     
==========================================
+ Hits        46063    46129      +66     
- Misses       4358     4369      +11     
Flag Coverage Δ
backend 89.18% <84.76%> (-0.01%) ⬇️

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

Components Coverage Δ
Backend Apps 91.67% <84.46%> (-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
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
@SchrodingersGat SchrodingersGat merged commit bb2a72a into inventree:master May 10, 2026
39 checks passed
@SchrodingersGat SchrodingersGat deleted the physical-bom-lines branch May 10, 2026 05:32
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