CleanupBuildOrders
An InvenTree plugin that removes consumed stock records from old, completed build orders.
Over time, InvenTree accumulates stock items that were consumed during the build process. These records are useful for traceability while a build is active or recently completed, but become unnecessary clutter after a sufficient period has passed. This plugin automatically identifies and deletes those stale records on a weekly schedule.
How It Works
Each week the plugin queries for stock items that meet all of the following criteria:
- The item has no serial number
- The item is not installed in another assembly
- The item is associated with a completed (non-active) build order
- The build order's completion date is older than the configured threshold
Deletion is gated behind an explicit confirmation step — the plugin will never delete anything unless the Confirm Deletion setting has been manually enabled. On each scheduled run without confirmation, the plugin sends a notification listing the items that would be deleted, so administrators can review before approving.
Installation
InvenTree Plugin Manager
Search for cleanup-build-orders in the InvenTree plugin manager and install directly from there.
Command Line
pip install cleanup-build-orders
Settings
Build Cleanup Period
| Key | STOCK_DELETE_PERIOD |
| Type | Integer (months) |
| Default | 24 |
| Minimum | 6 |
How far back to look when identifying old stock records. Any consumed stock item belonging to a build order completed more than this many months ago is eligible for deletion.
Confirm Deletion
| Key | CONFIRM_DELETE |
| Type | Boolean |
| Default | False |
Acts as a one-shot authorisation gate. When set to True, the next scheduled run will proceed with deletion. The setting is automatically reset to False immediately before the deletion loop runs, so each deletion run requires a fresh manual confirmation.
When this setting is False (the default), the scheduled task skips deletion and instead sends a notification summarising the items that are pending removal.
Notification Owner
| Key | NOTIFY_OWNER |
| Type | Owner (User or Group) |
| Default | (not set) |
The user or group to notify when items are pending deletion. Accepts an InvenTree Owner, which can be either a single user or a user group — if a group is chosen, every member receives the notification email listing the eligible stock items, grouped by build order.
If no owner is configured, the notification is sent to all active superuser accounts instead.
Usage
- Install the plugin and enable it in InvenTree.
- Configure the Build Cleanup Period to match your data retention policy.
- Optionally set a Notification Group so the right team members receive the daily digest.
- Each week the plugin will log how many items are eligible and send a notification email.
- Review the email. When ready to delete, enable Confirm Deletion in the plugin settings.
- The next scheduled run (within 7 days) will perform the deletion and reset the confirmation flag.
Metadata
Release files for inventree-build-cleanup 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| inventree_build_cleanup-0.1.0.tar.gz | 7.8 kB | Without provenance | Details for inventree_build_cleanup-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| inventree_build_cleanup-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for inventree_build_cleanup-0.1.0-py3-none-any.whl |
Total release size: 16.0 kB
Release files / inventree_build_cleanup-0.1.0.tar.gz
| Download URL | inventree_build_cleanup-0.1.0.tar.gz |
|---|---|
| Size | 7.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
340ee25a7af3ab84b7202bb033810ea11c201ea8d0ca619231a0f264accf5171
|
|
BLAKE2b-256 checksum How to use checksums |
0d0911e2f900b45a9fc3af470dd84dc5c691eb3d6ed723843893e87e43187305
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.15
|
Release files / inventree_build_cleanup-0.1.0-py3-none-any.whl
| Download URL | inventree_build_cleanup-0.1.0-py3-none-any.whl |
|---|---|
| Size | 8.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
54aa5748af48ec357d77b55e7983930bbe78dab237d1c27f569d6ad923502475
|
|
BLAKE2b-256 checksum How to use checksums |
6ea8254f39838ad6cb17f14fa1fe6a36ee7d74ebab8a64aaa3b8c0905d2a17ab
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.15
|
Security for inventree-build-cleanup 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.