Repository navigation
[Feature] BOM snapshot - #13133
[Feature] BOM snapshot#13133SchrodingersGat wants to merge 7 commits into
Conversation
✅ Deploy Preview for inventree-web-pui-preview ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
Codecov Report❌ Patch coverage is 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
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
| if not get_global_setting('PART_BOM_SNAPSHOT'): | ||
| return None | ||
|
|
||
| latest = self.bom_snapshots.order_by('-created', '-pk').first() |
There was a problem hiding this comment.
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. |
There was a problem hiding this comment.
(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') |
There was a problem hiding this comment.
(AI-spoted)
| 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

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