InvenTree Sales Order Builds
An InvenTree plugin that automatically creates build orders for the assembly lines on a sales order when the order is issued.
InvenTree only lets you raise a build from a sales order one line at a time. If you build to order, that's a lot of clicking for every order. This plugin does it for you:
- When a sales order is issued, every line whose part is an assembly gets a build order. The build is linked to the sales order, so finished outputs can be allocated back to it.
- Lines for the same part are added together into one build.
- Build orders are created whether or not the components are in stock. That's normal for InvenTree: you allocate stock (or order it) afterwards.
- Assemblies whose BOM isn't validated (or has changed since it was validated) are skipped, and the order's owner is notified.
- It's idempotent. Re-issuing an order, or adding or increasing lines after it's issued, only creates builds for quantity that isn't already covered. It never cancels or shrinks existing builds.
It works alongside InvenTree's built-in Auto Create Builds plugin. That plugin creates child builds for sub-assemblies when a build is issued. Turn on this plugin's Issue builds setting to cascade sales order → top-level build → sub-assembly builds.
Requirements
- InvenTree 1.0 or newer
- Settings → Plugins → Enable event integration must be on, and the background worker must be running
Installation
From the InvenTree admin, go to Settings → Plugins → Install Plugin, enter inventree-sales-order-builds, then activate Sales Order Builds.
Or add it to plugins.txt:
inventree-sales-order-builds
Settings
| Setting | Default | What it does |
|---|---|---|
| Build quantity | Full | Full: build everything ordered, less stock already allocated to the order (build to order). Shortfall: also use free stock first and only build the rest. |
| Require validated BOM | On | Skip assemblies whose BOM isn't validated, or has changed since validation. |
| Require active part | On | Skip inactive assemblies. |
| Require locked part | Off | Only build assemblies that are locked. |
| Follow line changes | On | On an issued order, adding a line or raising a quantity creates a top-up build. |
| Issue builds | Off | Put new builds straight into production. This also triggers the built-in Auto Create Builds plugin for sub-assemblies. |
| Auto-allocate stock | Off | Allocate available untracked component stock to new builds. Missing stock is left unallocated. |
| Build title | Build for {order} |
Placeholders: {order}, {customer}, {part}. |
| Notify skipped lines | On | Notify the order's creator and responsible owner when an assembly line didn't get a build. |
How the quantity is worked out
For each assembly part on the order:
to build = ordered quantity
- stock allocated/shipped to the order that did not come from one of its builds
- existing (non-cancelled) builds for this order and part
- free stock (Shortfall mode only)
The result is rounded up, because build quantities are whole numbers.
Blocking builds from your own plugin
The plugin creates builds with Build.objects.create(), so InvenTree's own checks still apply:
- InvenTree's Require valid BOM, Require active part and Require locked part build settings
- any ValidationMixin plugin's
validate_model_instance()
If a check raises a ValidationError, that part is skipped, the reason is included in the notification, and the other lines carry on. This lets you add business rules (for example, "the BOM must match the current design revision") in your own plugin. The same rule also guards builds created by hand:
from django.core.exceptions import ValidationError
from plugin import InvenTreePlugin
from plugin.mixins import ValidationMixin
class MyRules(ValidationMixin, InvenTreePlugin):
NAME = 'MyRules'
def validate_model_instance(self, instance, deltas=None):
from build.models import Build
if isinstance(instance, Build) and instance.pk is None:
if not design_revision_matches(instance.part):
raise ValidationError(
{'part': 'BOM does not match the current design revision'}
)
Return None, not True, from validate_model_instance. Returning True stops InvenTree from running any other validation plugins.
Development
Tests run inside an InvenTree source checkout:
pip install -e .
cd /path/to/InvenTree/src/backend/InvenTree
INVENTREE_PLUGINS_ENABLED=True INVENTREE_PLUGIN_TESTING_SETUP=True \
python manage.py test inventree_sales_order_builds
See .github/workflows/ci.yml for the full set of environment variables.
Releasing
The version lives in inventree_sales_order_builds/__init__.py (PLUGIN_VERSION, shown in InvenTree's plugin list). bump-my-version updates it, so you never edit it by hand.
pip install -e .[dev]
# 1. Add your changes under "## Unreleased" in CHANGELOG.md and commit them
# 2. Bump: updates the version and CHANGELOG, commits "Release vX.Y.Z" and tags it
bump-my-version bump patch # 0.1.0 -> 0.1.1 bug fixes
bump-my-version bump minor # 0.1.0 -> 0.2.0 new features
bump-my-version bump major # 0.1.0 -> 1.0.0 breaking changes
# 3. Push the commit and the tag
git push --follow-tags
Pushing a v* tag runs the tests, builds the package, and checks the tag matches PLUGIN_VERSION and has a CHANGELOG entry. It then publishes to PyPI and creates a GitHub release using that version's CHANGELOG section as the notes. If the tag and the code disagree, nothing is published.
Use bump-my-version show-bump to preview, or bump-my-version bump patch --dry-run -v to see exactly what would change.
License
MIT
Metadata
Release files for inventree-sales-order-builds 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_sales_order_builds-0.1.0.tar.gz | 14.9 kB | With provenance | Details for inventree_sales_order_builds-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| inventree_sales_order_builds-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for inventree_sales_order_builds-0.1.0-py3-none-any.whl |
Total release size: 29.6 kB
Release files / inventree_sales_order_builds-0.1.0.tar.gz
| Download URL | inventree_sales_order_builds-0.1.0.tar.gz |
|---|---|
| Size | 14.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
92c3c48353aaff82209109d78ba07ffc5e725ac5f81afbc4278399f7f2c20b41
|
|
BLAKE2b-256 checksum How to use checksums |
0673952c37970f0fb30d1d428cb7ddafdcea2aff631a20003f157123a573dc48
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 25, 2026.
Transparency logRelease files / inventree_sales_order_builds-0.1.0-py3-none-any.whl
| Download URL | inventree_sales_order_builds-0.1.0-py3-none-any.whl |
|---|---|
| Size | 14.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ad7da74c78215809854e2b1a1a43a79d62081e313c7502f9fe8a596246cd8cc3
|
|
BLAKE2b-256 checksum How to use checksums |
2c341b7d955bb356f21569c39533e106301a49921ee772e13d0c871133159b47
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 25, 2026.
Transparency logSecurity for inventree-sales-order-builds 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.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for inventree_sales_order_builds-0.1.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 25, 2026.
Transparency logA 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.