inventree-mouser
Mouser Electronics for InvenTree (1.5.1+):
- Import from Supplier — search Mouser from InvenTree's own Import Part wizard (Parts → Add Parts → Import from Supplier) and create the part with its manufacturer part, Mouser supplier part, price breaks, parameters and (optionally) picture.
- Mouser orders → purchase orders — once a day (or on demand) the orders on your Mouser account become InvenTree purchase orders with Mouser's actual prices. Parts that don't exist are created; anything that only might be a part you already have holds the order for you to decide. Receiving the stock stays with you (InvenTree's Receive Items).
- Send to Mouser cart — a purchase order's Mouser lines go into a cart on your Mouser account; check out on Mouser with the purchase order's reference as the PO number and the order import updates that same purchase order instead of making a new one.
It also ships mouser_lookup, a small Mouser API client with no Django dependency
(part search, order history, carts), for use outside InvenTree.
Install
Add to InvenTree's plugins.txt (pin a release tag) and run invoke update:
inventree-mouser @ git+https://github.com/SXSLYDA/inventree-mouser.git@v0.1.0
Or from PyPI: add inventree-mouser (or pin a version, e.g. inventree-mouser==0.1.7) to plugins.txt and run invoke update.
Or on a package-installer server, sudo inventree-mouser-update (install it once — see the top
of tools/server-update.sh): it adds or moves that line, backs up, updates and restarts.
Then in Admin Center → Plugins, activate Mouser Integration and open its settings.
After activating, run inventree run invoke update once more (or restart, if migrations run on
startup) so its tables are created.
Other plugins that use this one (e.g. OMG Harness Import) ask for a minimum version
(inventree-mouser>=0.1.0), never a git pin, so this plugin updates on its own.
InvenTree needs Enable app integration, Enable URL integration, Enable interface
integration and Enable schedule integration on (Admin Center → Plugin Settings), and its
background worker running for the daily check.
Set up
- Keys — My Mouser → APIs. Mouser gives two different keys:
- Search API key →
Search API key(part search, creating parts) - Order API key →
Order API key(reading your orders, filling carts)
- Search API key →
- Supplier — pick the Company that is Mouser in your InvenTree.
- Order import — set
Import orders placed from(DD-MM-YYYY, e.g. 24-10-2026). Orders before it are never imported, so purchase orders you already typed in by hand aren't doubled up. Then switch onImport Mouser orders daily. - Notifications: problems with the order import (a check failing, an order waiting for you)
show in InvenTree's notifications - set
Notifyto the users or groups who should get them (blank = everyone who may add purchase orders). - Optional:
Mouser website(e.g.au.mouser.com),Country code/Currency codefor cart pricing,New parts category,Receive into,Responsible.
Every setting is listed in docs/SETTINGS.md.
The Mouser Orders dashboard item shows what was imported, what's waiting for you, and has Check Mouser now and Import order (by sales or web order number — ignores the start date, handy for trying it on one order). The same view, bigger - every order, with filters (All / Needs you / Purchase orders / Ignored) and totals - is the Mouser Orders panel on InvenTree's Purchasing page.
How an order is imported
Each line is matched to an InvenTree part, first match wins:
| Match | Result | |
|---|---|---|
| 1 | A Mouser supplier part with this Mouser part number | used as is |
| 2 | The line's customer part number (set by Send to Mouser cart) is one part's IPN / name | that part; a Mouser supplier part is added |
| 3 | Exactly one part is this part number — name, IPN, a manufacturer part's MPN (e.g. an equivalent you added as another manufacturer part), or any supplier SKU | that part; a Mouser supplier part is added |
| 3b | Several parts are | held — you pick |
| 4 | A part is close — same once case / spaces / dashes are ignored, or the same apart from a trailing -suffix (DT04-12PA vs DT04-12PA-E005) |
held — you decide: that part, a new part, or leave the line off |
| 5 | Nothing | a new part is created from Mouser into New parts category |
If any line is held, the whole order is held and nothing is created — no half-built
purchase orders, and a held order never reaches anything downstream (like a Xero sync).
Once every line is settled the order goes through in one transaction: new parts, Mouser
supplier parts, then the purchase order with Mouser's unit prices and currency,
supplier reference = the Mouser sales order number, Mouser's additional fees as an extra
line, invoice numbers and tracking stored on the order. It is placed (or left
pending — New purchase orders are).
Also:
- A Mouser purchase order whose supplier reference is already this Mouser order number is linked and left exactly as it is.
- When the PO number typed at Mouser checkout is the reference of an open InvenTree purchase order (the cart loop below), that purchase order is updated instead: Mouser's prices, quantities (if nothing's been received), lines added at checkout, lines dropped at checkout noted.
- Cancelled Mouser orders are recorded as ignored. An error is recorded with its reason and tried again on the next check.
- After the purchase order is made, each check keeps it up to date with Mouser — the order's
Mouser status, each line's shipments (with their invoices), tracking and totals, on the Mouser
Orders list and the purchase order's Mouser panel. That carries on for
Keep updating fordays (180) after the order was placed, even outside the look-back window, until Mouser shows it complete with every line shipped. Lines, quantities, prices and receiving are never changed by this. - Back orders and split shipments. The purchase order always has the full quantities ordered. The Mouser panel's Shipping column shows, per line, each shipment Mouser has sent (date and invoice), "Not shipped yet" for a back-ordered line, and how much InvenTree has received, and the order lists show "3 / 5 lines shipped" until everything has gone. Receive each part as it arrives with InvenTree's own Receive Items (part quantities are fine). Mouser's API gives each shipment's invoice and date but not how many were in it, so the count comes from what you receive.
- Receive by Mouser invoice (the Mouser panel on the purchase order). Mouser's API says which
lines are on which invoice but not how many, so pick the invoice that came in the box: its lines
are listed with the quantity filled in when a line only ships once (enter it when it ships in
parts), choose where it goes, and confirm. The stock is received with InvenTree's own receiving,
and the invoice is recorded on the purchase order (
metadata['supplier_invoices']: number, date, due date, lines and quantities, and the fees that relate to it - a line's fees go on the invoice it first shipped on, order-level fees on the first invoice). The Xero plugin (inventree-xero) makes one bill per Mouser invoice from that, dated the invoice date. Every purchase order the import makes is marked to be billed this way, so receive Mouser boxes here rather than with Receive Items (stock received there isn't on an invoice, so it isn't billed - the Xero panel lists it). - Due dates: Mouser payment - Paid on order (card): due on the invoice date; On account: the invoice date plus Account terms (days). Only the bill's due date - no payment is recorded.
- Changes on Mouser are flagged, never applied for you: a line Mouser cuts (e.g. the rest of a back order cancelled - "Mouser now has 30 of the 50 ordered") or a whole order cancelled after import. Each is noted on the order and sent as a notification; change or cancel the purchase order yourself.
Send to Mouser cart
On a Mouser purchase order, the Mouser panel has Send to Mouser cart. Lines with a
Mouser supplier part (less anything already received) go into a new cart on your Mouser
account, with each part's IPN (or name) as the customer part number. Mouser's cart price
is copied to lines with no price (or every line — Copy cart prices to the purchase order).
Mouser keeps carts made through its API as separate saved carts. Sending the same purchase
order again replaces that cart's contents rather than making another; a new cart is made only
if Mouser no longer has it (checked out or deleted). On Mouser, open your saved carts, pick the
one with the key the panel shows, and check out, typing the purchase order's reference (e.g.
PO-0042) as the PO number. The next order check finds it and updates that purchase order.
Mouser needs a country code on cart calls: Country code, else worked out from
Currency code, else from InvenTree's default currency (AUD → AU).
With the Xero plugin
If inventree-xero exports placed purchase orders, imported Mouser orders go to Xero as soon as they're placed (held orders don't, nothing exists yet). With Xero bills made from received stock, don't also enter Mouser's invoice into Xero by hand — the invoice number is on the purchase order (Mouser panel) to check against.
For other plugins: hooks
A plugin can add its own data to parts made from Mouser by defining methods (no
registration — any active plugin with the method is called; see inventree_mouser/hooks.py):
def mouser_import_parameters(self, data):
"""[(template name, value)] to offer in the Import from Supplier wizard (offered first)."""
def mouser_part_created(self, part, data, source):
"""A part was just created from Mouser outside the wizard (source "order"). Return notes, or None."""
mouser_part_created is called after the purchase order is committed (outside the
order's lock, so it can make network calls) and only for parts really created - never
for an existing part the import reused. data is a mouser_lookup search result
(including Mouser's product category). Other plugins can also create parts the same
way this one does through registry.get_plugin('mouser') — get_import_data('mouser', pn),
import_part(...), import_manufacturer_part(...), import_supplier_part(...).
mouser_lookup (no InvenTree needed)
from datetime import date
from mouser_lookup import search_by_mpn, orders, cart
search_by_mpn("DT04-12PA", search_key) # normalized listings
orders.order_history(order_key, date(2026, 10, 1), date.today())
orders.order_detail(order_key, sales_order="282378302") # lines, prices, invoices, tracking
cart.add_items(order_key, [{"mouser_pn": "571-DT04-2P-E005", "quantity": 100}], country="AU", currency="AUD")
Install just for this: pip install "inventree-mouser @ git+https://github.com/SXSLYDA/inventree-mouser.git@vX.Y.Z"
(the plugin part only loads inside InvenTree).
Releasing
- Note changes under
## UnreleasedinCHANGELOG.md(say when a release adds a migration). .\build-and-bump.ps1(patch),-Bump minor, or-Version X.Y.Z— runs lint and tests, bumpsinventree_mouser/version.py, stamps the changelog, commits and tagsvX.Y.Z.- Push the commit and the tag. CI runs the unit, UI and end-to-end tests (against real InvenTree 1.5.1, 1.6.0 and 1.6.1) and publishes the GitHub release.
- On the server:
sudo inventree-mouser-update vX.Y.Z(install the script once — see the top oftools/server-update.sh), or move theplugins.txtpin andinvoke update. Deploying from CI is off unless theMOUSER_DEPLOYvariable and the SSH secrets are set (see thedeployjob in.github/workflows/ci.yml).
Tests
pip install -e . pytest pyflakes django
pytest -q tests/test_lookup.py # parsing + matching rules
npm install --no-save jsdom@24 && node --test tests/ui.test.mjs
# end-to-end against a real InvenTree, fake Mouser account (see the e2e job in CI):
MOUSER_TESTS=$PWD/tests python manage.py shell -c "exec(open('$PWD/tests/e2e_inventree.py').read())"
The end-to-end test uses a real Mouser order (tests/fixtures/order_282378302.json).
Licence
MIT
Metadata
Release files for inventree-mouser 0.1.8
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_mouser-0.1.8.tar.gz | 70.0 kB | With provenance | Details for inventree_mouser-0.1.8.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| inventree_mouser-0.1.8-py3-none-any.whl | Python 3 | none | any | Details for inventree_mouser-0.1.8-py3-none-any.whl |
Total release size: 141.0 kB
Release files / inventree_mouser-0.1.8.tar.gz
| Download URL | inventree_mouser-0.1.8.tar.gz |
|---|---|
| Size | 70.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
3d5321a19a4d945b76fc6e6081d7bcf433b216b3084a071710595b4b3cc2b9be
|
|
BLAKE2b-256 checksum How to use checksums |
54efaaba7c2f9475d25fc956665171924922a1cc671775b8af9e38693b940457
|
| 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_mouser-0.1.8-py3-none-any.whl
| Download URL | inventree_mouser-0.1.8-py3-none-any.whl |
|---|---|
| Size | 70.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c46c06f89786c51d49cc23155bc4ae59ec9da48b6fbde3943442d9d103abc712
|
|
BLAKE2b-256 checksum How to use checksums |
187f066475091274e1f9dd406f7243ca97c5a58cafd58ee7f8d9013e6992e091
|
| 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-mouser 0.1.8
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_mouser-0.1.8.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.