Automatically link and synchronize Manufacturer parts to Supplier parts for sponsored manufacturers with zero overhead.
AutoSponsor is a plugin for InvenTree designed to bridge the gap between manufacturer part definitions and supplier sourcing. For organizations that have sponsor manufacturers or direct supply partnerships, this plugin completely automates the manual work of matching and creating supplier parts.
It runs in two distinct, complementary modes:
- Reactive (Zero-Touch): Automatically detects newly saved manufacturer parts. If their manufacturer is on your sponsor list, it instantly creates a corresponding
SupplierPartand flags the manufacturer company as a supplier. - Proactive (Global Sync): A background-threaded sync engine that audits your entire database against your current sponsor mapping, automatically resolving discrepancies by adding missing links and soft-deactivating stale ones.
- Signal-Driven: Hooked into Djangoβs
post_savesignal onManufacturerPartto capture part creation events in real-time. - Instant Sourcing: Automatically flags the manufacturer company as a Supplier if not already configured, and instantly generates a linked
SupplierPartwith the correct SKU/MPN and description.
- Full Database Auditing: Evaluates all existing manufacturer parts against the configuration.
- Daemonized Threading: Large sync operations are dispatched to a background thread (
threading.Thread(daemon=True)), ensuring that the InvenTree web server never hangs or times out. - State & Progress Tracking: Real-time job statistics are cached in-memory and served via lightweight JSON REST endpoints.
- Soft-Deactivation Only: To protect your historical records, purchase orders, and audit trails, the sync engine never hard-deletes
SupplierPartrecords. Stale parts are gracefully deactivated (active = False). - Plugin Isolation: The plugin only modifies or deactivates
SupplierPartentries that it originally created, identified via a secure description sentinel:"Auto-generated Sponsorship Link". - Purchase Order Safeguard: Before deactivating any stale link, the engine checks for open/active Purchase Order lines. If any are found, the deactivation is aborted, logged as a warning, and highlighted on the dashboard.
You can install the plugin directly through the InvenTree web interface:
- Navigate to Settings -> Plugins in InvenTree.
- Click on the Install Plugin button.
- Fill in the installation form:
- Package Name:
inventree-auto-sponsor - Source URL:
git+https://github.com/0neShot/AutoSponsor.git#egg=inventree-auto-sponsor
- Package Name:
- Click Install.
- Restart your InvenTree server containers:
docker restart inventree-server inventree-worker
- Enable the plugin via the Admin β Plugins configuration list.
Navigate to InvenTree β Admin β Plugins β AutoSponsor β Settings to customize:
| Setting | Type | Default | Description |
|---|---|---|---|
SPONSOR_LIST |
String | "WΓΌrth Elektronik" |
Comma-separated list of manufacturer names (e.g. "WΓΌrth Elektronik, Texas Instruments"). Matches are case-insensitive. |
CLEANUP_STALE_ON_SYNC |
Boolean | True |
Automatically soft-deactivates SupplierPart entries for manufacturers that were removed from your sponsor list during a full sync. |
When you add or import a new ManufacturerPart (e.g., using SmartParts or standard admin interfaces) under a sponsored manufacturer (e.g. WΓΌrth Elektronik):
- InvenTree saves the manufacturer part.
- AutoSponsor intercepts the event, flags WΓΌrth Elektronik as a supplier in InvenTree, and links a new
SupplierPartto the main part with the SKU matching the MPN. - The part is instantly purchase-ready.
When you update your sponsor list, or want to audit a newly imported database:
- Open the Auto Sponsor Linker Dashboard (
/plugin/autosponsor/). - Click Start Sync or toggle options like "Cleanup Stale Links".
- Watch the progress bar in real-time as the background thread processes every manufacturer part in the database.
- Review the detailed log table at the bottom of the page showing exact actions taken for each part.
The plugin registers several API endpoints under the namespace /plugin/autosponsor/api/:
- URL:
/plugin/autosponsor/api/sync/run/ - Method:
POST - Permission required:
company.change_company - Payload (JSON, optional):
{ "cleanup_stale": true } - Response:
{ "success": true, "job_id": "a1b2c3d4", "message": "Sync started for 2 sponsor(s).", "sponsors": ["WΓΌrth Elektronik", "Texas Instruments"] }
- URL:
/plugin/autosponsor/api/sync/status/<job_id>/ - Method:
GET - Response:
{ "job_id": "a1b2c3d4", "status": "completed", "started_at": "2026-05-30T13:45:00.123456", "completed_at": "2026-05-30T13:45:05.654321", "total_manufacturer_parts": 1420, "processed": 1420, "progress_percent": 100, "created": 15, "already_exist": 1400, "deactivated": 5, "skipped": 0, "errors": 0, "error_details": [], "results": [ { "manufacturer_part_id": 12, "mpn": "744311100", "part_name": "Inductor 10uH 2.5A", "manufacturer_name": "WΓΌrth Elektronik", "action": "created", "success": true, "message": "Created SupplierPart #56" } ] }
- URL:
/plugin/autosponsor/api/sync/stats/ - Method:
GET - Response:
{ "sponsors": ["WΓΌrth Elektronik"], "stats": { "total_manufacturer_parts": 1420, "sponsor_parts_ok": 1400, "sponsor_parts_missing": 20, "stale_supplier_parts": 5, "unmapped_manufacturers": ["Samsung", "Yageo"] } }
- URL:
/plugin/autosponsor/api/sync/jobs/ - Method:
GET - Response: Returns a history list of all sync jobs executed since the plugin server started.
InventreeAutoSponsor/
βββ setup.py # Setuptools packaging script
βββ MANIFEST.in # Asset packaging manifest
βββ README.md # This documentation file
βββ CHANGELOG.md # Version history
βββ LICENSE # MIT License
βββ __init__.py # Package initializer
β
βββ inventree_auto_sponsor/ # Main source package
βββ __init__.py # Core initializer & crash-safe loader
βββ plugin.py # Main plugin class, settings & signal listener
βββ sync_engine.py # Threaded background sync manager & data safety rules
βββ views.py # Django dashboard rendering & JSON API endpoints
β
βββ static/ # Static frontend assets
β βββ inventree_auto_sponsor/ui/
β βββ autosponsor_panel.js # Contextual UI injection panel script
β
βββ templates/ # Django-rendered HTML templates
βββ inventree_auto_sponsor/
βββ dashboard.html # Interactive admin sync control dashboard
This project is licensed under the MIT License β see the LICENSE file for details.
Developed with passion by 0neShot / StarkStrom Augsburg e.V. Powered by InvenTree.