Skip to content

[Feature] BOM snapshot - #13133

Open
SchrodingersGat wants to merge 7 commits into
inventree:masterfrom
SchrodingersGat:bom-snapshot
Open

SchrodingersGat wants to merge 7 commits into
inventree:masterfrom
SchrodingersGat:bom-snapshot

Conversation

@SchrodingersGat

Copy link
Copy Markdown
Member

Captures a "BOM snapshot" whenever a BOM is validated, allowing users to view what has changed since BOM validation.

A BOM can be compared against historical snapshots via the user interface

@SchrodingersGat SchrodingersGat added this to the 1.7.0 milestone Oct 29, 2026
@SchrodingersGat SchrodingersGat added enhancement This is an suggested enhancement or new feature api Relates to the API feature User Interface Related to the frontend / User Interface area/BOM related to BOM/assembly logic and possible engine improvements labels Oct 29, 2026
@netlify

netlify Bot commented Oct 29, 2026 •

Copy link
Copy Markdown

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

Name Link
🔨 Latest commit fbb643d
🔍 Latest deploy log https://app.netlify.com/projects/inventree-web-pui-preview/deploys/6ae3d454a8f72900267ed13d
😎 Deploy Preview https://deploy-preview-13133--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: 95 (🟢 up 1 from production)
Accessibility: 82 (no change from production)
Best Practices: 92 (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.

@SchrodingersGat
SchrodingersGat requested a balanced review from Copilot October 29, 2026 21:45

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.

@codecov

codecov Bot commented Oct 29, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 99.20635% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 86.90%. Comparing base (e6bc21b) to head (fbb643d).

Additional details and impacted files
@@           Coverage Diff            @@
##           master   #13133    +/-   ##
========================================
  Coverage   86.90%   86.90%            
========================================
  Files        1562     1565     +3     
  Lines      110428   110622   +194     
  Branches    12121    12021   -100     
========================================
+ Hits        95967    96136   +169     
- Misses      14394    14420    +26     
+ Partials       67       66     -1     
Flag Coverage Δ
backend 91.26% <99.20%> (+0.05%) ⬆️

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

Components Coverage Δ
Backend Apps 92.80% <99.20%> (+0.04%) ⬆️
Backend General 94.78% <ø> (ø)
Frontend 79.40% <ø> (-0.16%) ⬇️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

if not get_global_setting('PART_BOM_SNAPSHOT'):
return None

latest = self.bom_snapshots.order_by('-created', '-pk').first()

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Full data of latest snapshot are available here - it can be used for comparison against items when checksums match, only stable sorting is needed

Snapshots can be compared against the current BOM - refer to [BOM Comparison](#comparing-against-a-snapshot) below.

!!! info "Substitute Parts"
Substitute parts are recorded in the snapshot, but are not included in the BOM checksum. Changing only the substitute parts for a BOM line item does not require the BOM to be revalidated.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

(AI-spoted)
This is a bit problematic: BOM checksum is also used to deduplicate/skip snapshot creation, so changing substitute part only will not create new snapshot, even after explicitly revalidating the BOM, although get_snapshot_data() includes them.

"""

serializer_class = part_serializers.BomSnapshotSerializer
queryset = BomSnapshot.objects.all().select_related('created_by')

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

(AI-spoted)

Suggested change
queryset = BomSnapshot.objects.all().select_related('created_by')
queryset = BomSnapshot.objects.select_related('created_by').defer('data')

possibly large data member is intentionally not used in BomSnapshotSerializer, but fetched from database

@SchrodingersGat SchrodingersGat modified the milestones: 1.7.0, 1.8.0 Nov 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api Relates to the API area/BOM related to BOM/assembly logic and possible engine improvements enhancement This is an suggested enhancement or new feature feature User Interface Related to the frontend / User Interface

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants