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.
The Auto Builds panel
Sales orders with assembly lines get an Auto Builds panel. It shows what the plugin did for each assembly part the last time it ran:
- Build created, with a link to the build order
- Nothing to build, because stock or existing builds already cover it
- Skipped, with the full reason. Examples: BOM not validated, part inactive, or a validation plugin's reason such as an OMG BOM check. The notification only has room for 250 characters, so check the panel for the complete text.
The panel also lists every build order linked to the sales order. Once a reason is fixed, press Run again to create whatever is still needed. Only the missing quantity is built, so nothing is duplicated. Run again needs permission to add build orders, and only works on issued orders.
Each run is stored on the sales order under the metadata key salesorderbuilds. The panel reads it from:
GET /plugin/salesorderbuilds/order/<pk>/: the last run and the linked build ordersPOST /plugin/salesorderbuilds/order/<pk>/run/: run again
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/version.py (PLUGIN_VERSION, shown on InvenTree's Plugins page). Don't edit it by hand. build-and-bump.ps1 bumps it, the same way the other OMG InvenTree plugins do.
pip install -e .[dev] # once, in your venv
# 1. Add your notes under "## Unreleased" in CHANGELOG.md as you work
# 2. Build, check, bump, commit and tag (it does NOT push)
.\build-and-bump.ps1 # 0.1.0 -> 0.1.1 (patch)
.\build-and-bump.ps1 -Bump minor # 0.1.0 -> 0.2.0
.\build-and-bump.ps1 -Bump major # 0.1.0 -> 1.0.0
.\build-and-bump.ps1 -Version 0.2.0 # an exact version
# 3. Push the commit and the tag (PyCharm: Git -> Push, tick "Push tags")
git push --follow-tags
Before changing anything, the script checks the new tag doesn't already exist. It then builds the package and runs PyPI's metadata check, and runs ruff. It stops at the first problem. If everything passes, it bumps the version, turns ## Unreleased into ## X.Y.Z — date, commits everything as "Release vX.Y.Z" and tags it.
Pushing the tag runs the InvenTree test suite in CI. CI then checks the tag matches version.py and has a CHANGELOG section. If all of that passes, it publishes the GitHub release (with that section as the notes) and the PyPI package. If the tag and the code disagree, nothing is published.
To undo before pushing: git tag -d vX.Y.Z; git reset --soft HEAD~1
License
MIT
Metadata
Release files for inventree-sales-order-builds 0.1.2
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.2.tar.gz | 23.8 kB | With provenance | Details for inventree_sales_order_builds-0.1.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| inventree_sales_order_builds-0.1.2-py3-none-any.whl | Python 3 | none | any | Details for inventree_sales_order_builds-0.1.2-py3-none-any.whl |
Total release size: 48.1 kB
Release files / inventree_sales_order_builds-0.1.2.tar.gz
| Download URL | inventree_sales_order_builds-0.1.2.tar.gz |
|---|---|
| Size | 23.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e812fc2111d1f9271bdc60cd03cb0821a4d0929d89059dd14cd55952ff58b385
|
|
BLAKE2b-256 checksum How to use checksums |
80851183a272c11b448e0c2364d26ad2b2710442d3b9038b249ff0e97a971825
|
| 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 26, 2026.
Transparency logRelease files / inventree_sales_order_builds-0.1.2-py3-none-any.whl
| Download URL | inventree_sales_order_builds-0.1.2-py3-none-any.whl |
|---|---|
| Size | 24.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
5f66ad32438a148df9d39f6ff404f6a6ba5df617b302ec0d45607d99df4ebac1
|
|
BLAKE2b-256 checksum How to use checksums |
5dd313498f2d5ce0360aaa217a066c0cd7aaee8cb3272481af43036fe45fc887
|
| 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 26, 2026.
Transparency logSecurity for inventree-sales-order-builds 0.1.2
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.2.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 26, 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.