InvenTree Loan Manager
A loan and return management plugin for InvenTree 1.6+ (developed and tested
against InvenTree 1.7.4). It adds a complete request → approval → handout →
return workflow with audit history, barcode/QR support, due-date reminders, and
a role-aware interface for requesters and loan desk staff.
Features
- A public request catalogue that works without an InvenTree account.
- Browse loanable parts by category or search, open part details, and request a
part and quantity. Specific stock units are assigned by the loan desk.
- Anonymous requesters enter their name and email, so no InvenTree user account
is required. Additional questions can be added with the custom field builder.
- Requesters sign at submission. The loan desk captures a second signature at
handout, and a third at return.
- Approvers can approve individual lines and quantities, leave lines unapproved,
and approve more later until the request is fully approved. Allocation is
limited to approved quantities.
- Approved requests can be packed into a pickup box or bag with its own
reference and QR code, then moved to Ready for pickup. The box label is
printable and shows the box reference, request reference, requester, contents
and a scannable QR code. A separate printable return sheet gives every packed
stock item its own QR code for fast return counting.
- The admin console has a View action for every request, showing requester
details, purpose, dates, requested items, notes and the submitted signature
before approval or handout.
- Loan desk staff can hand out items by scanning barcodes or searching the catalog.
- Trackable/serialized parts are loaned as whole units and returned in full.
Non-trackable parts support partial quantities; split items are moved to the
loan location and returned to their original location and status.
- Items move to a dedicated On Loan location and receive an On Loan status.
- While on loan, stock items are excluded from availability and normal allocation flows.
- Direct edits, moves, quantity changes, allocation, and deletion of loaned items are
blocked by plugin validation.
- Returns support full or partial quantities, condition notes, and restoring the
original location and status.
- Every request, decision, handout, reminder, renewal, loss, and return is recorded
in an append-only audit timeline.
- Every anonymous request gets a secret tracking link showing its status, loan
progress, and signatures.
- QR codes identify loans and pickup boxes; printed receipts and box labels
include the QR, references, due date and captured signatures where relevant.
- Barcode scanning supports USB/keyboard scanners and camera scanning where the
browser exposes
BarcodeDetector.
- The internal console has a context-aware Scan action: scan a pickup box,
request, loan, stock item or part and it offers the relevant handout, return or
detail action.
- The public request path and the visibility/required state of core public form
fields are configurable from plugin settings.
- Public pages have an Auto / Light / Dark theme switch. The choice is
remembered per browser. Logged-in users inherit their current InvenTree theme
on first visit; Auto follows the operating system.
- Administrators can add arbitrary custom fields to the public form from a
Public form tab, with text, long text, number, email, phone, date,
checkbox and dropdown types, required/optional state, help text and ordering.
Values appear on the request page, printable receipt, public tracking page and
CSV export.
- Optional email notifications for submitted, partial/full approval, rejection,
cancellation, ready for pickup, handout, partial return and returned events;
in-app notifications are always available for signed-in users.
- Scheduled due-soon and overdue reminders.
- CSV export for requests and loans.
- Responsive, accessible interface with light and dark mode support.
Requirements
- InvenTree 1.6+ (
MIN_VERSION = 1.6.0, MAX_VERSION = 1.7.99)
- InvenTree 1.5.x does not support plugin-defined React routes, so the native
Loans tab requires an upgrade to 1.6 or newer.
- Python 3.10+
- The global settings
ENABLE_PLUGINS_APP, ENABLE_PLUGINS_URL, and
ENABLE_PLUGINS_INTERFACE must be enabled
ENABLE_PLUGINS_APP is required for the plugin's models and migrations.
ENABLE_PLUGINS_INTERFACE is required for the Loans tab and native page.
- The public request page (
/plugin/loan/request/) does not require an
InvenTree account. It must be reachable from the network that will use it.
- Optional for camera scanning: a browser with
BarcodeDetector support
Upgrading from 1.5.x: enable ENABLE_PLUGINS_APP before restarting. Without
it the plugin can appear in the list but its Django app, tables, and URLs are
never registered, which produces the intermittent empty/broken pages.
Installation
As a Python package
pip install inventree-loan
Then restart InvenTree, open the plugin management page
(/web/settings/admin/plugin), find InvenTree Loan Manager, and activate it.
Editable development install
pip install -e .
Restart the InvenTree server after installation.
Docker development workflow
When InvenTree runs in Docker, the container filesystem is ephemeral. Keep the
editable install in a mounted plugin directory and record it in
data/plugins.txt:
-e /home/inventree/data/plugins/inventree-loan
Plugin JavaScript, CSS, and templates are served directly from the installed
package through the plugin's own URL (/plugin/loan/assets/...). They therefore
do not depend on collectplugins and are not left stale by the static-file
cache. Python and template changes need a restart because plugins are discovered
at startup:
docker restart inventree-server inventree-worker
Database migration
The plugin uses its own Django app and migrations. After activating the plugin,
run the InvenTree update/migration command for your deployment, for example:
invoke update
or, in a source install:
python manage.py migrate
Upgrading existing installs runs a data migration that converts the old
phone, organization, student/employee ID and project/course fields into active
custom fields and backfills existing request values. Fresh installs do not
create those fields.
Using the plugin
The plugin adds a Loans tab to the InvenTree navigation bar, a Loans card
to the dashboard widget list, and a Loan Manager spotlight action.
- Request equipment (
/plugin/loan/request/) is the public catalogue.
It requires no account. It uses an InvenTree-style table with a collapsible
category tree, category counts that include subcategories, search, barcode
input, pagination, and a request drawer. Requesters open item details, choose
available stock, enter their contact details, sign, and submit. The
confirmation shows the reference code, tracking link, and a printable
request receipt.
- Track a request (
/plugin/loan/track/) lets an anonymous requester enter
the reference code and email address to open their request.
- Request status (
/plugin/loan/track/<token>/) shows the request, loan
dates, decisions, and captured signatures.
- Loans (navigation) opens a native InvenTree page at
/web/plugin/loan/management. It is rendered inside the normal InvenTree
layout, so the header, navigation, theme, and user menu behave exactly like
the Stock or Parts pages. Requests and loans use searchable, filterable,
sortable tables with pagination and CSV export; summary cards show pending,
approved, active and overdue counts. Signed-in requesters use the same page
for their requests and loans; the old server-rendered My Requests pages
redirect here, so there is only one version.
- Request details (
/web/plugin/loan/requests/<pk>) is a full native page,
like a build-order detail page. It shows requester/contact details, purpose,
dates, lines, signatures, stock allocations, part/stock links, approval and
handout actions, and print buttons for request/handout/return receipts.
- Loans (dashboard widget) provides a requester shortcut and an
Open loan desk button which opens the same native page.
- The plugin settings page (Admin Center → Plugins → InvenTree Loan Manager)
contains focused Setup and Public form panels, with a link to the loan
desk.
- Public request path: plugin setting
Public request path changes the
public form from /plugin/loan/request/ to /plugin/loan/<slug>/. The old
path redirects to the configured one. A full custom domain can be added later
with a reverse proxy.
- Public form fields: purpose, notes, pickup date and return date can each be
Hidden, Optional or Required from plugin settings. Name and email
remain required for tracking and notifications. Signature and responsibility
acknowledgement remain controlled by their existing toggles.
- Phone, organization, student/employee ID and project/course are no longer
hard-coded core fields. On upgrade they are migrated into active custom
fields with existing request values retained. Fresh installs start without
them.
- Custom public form fields: administrators can add any number of extra
fields in the Public form tab. Support text, long text, number, email,
phone, date, checkbox and dropdown fields, including help text, placeholders,
required state and display order. Archived fields keep their historical values
on existing requests. Submitted values are shown on the request page, request
receipt, public tracking page and in a dedicated column in the request CSV.
The native console adapts to the signed-in user's loan role: requesters see
their own requests and loans, while loan staff additionally see the handout,
staff, and audit-history tabs. Handout and return dialogs require the borrower's
signature. The Staff tab searches InvenTree users by name, username or email, so
you do not need to know the exact username. Setup and public-form configuration
live in the plugin settings page.
Initial setup
The plugin needs two stock objects:
- A dedicated On Loan stock location.
- A custom On Loan stock status whose logical value is
Quarantined
(so InvenTree treats loaned items as unavailable).
Run the setup action from the Setup tab of the Loan Manager console, or use
the management command:
python manage.py loan_setup --create-location --location-name "On Loan"
The command is idempotent and can be re-run safely. It creates the custom status,
creates or selects the location, and saves the location to the plugin settings.
The custom status is what makes an item unavailable. The location keeps the
stock history and the return path clear. If the custom status cannot be created,
the plugin falls back to InvenTree's built-in Quarantined status.
Staff roles
The plugin has its own roles, separate from InvenTree's stock roles:
| Role |
Capabilities |
| Approver |
View all requests/loans, approve or reject requests |
| Loan desk |
Everything an approver can do, plus hand out, return, renew, mark lost |
| Loan administrator |
Everything, plus manage staff and plugin setup |
Superusers always have full plugin access.
Grant the first role from the Staff tab of the Loan Manager console or with:
python manage.py loan_add_manager <username> --role admin
Only a superuser can grant the Loan administrator role through the web UI.
The last active administrator cannot be demoted or removed.
Optional core stock permission
By default, plugin roles govern handout and return actions. If your organization
requires InvenTree's core stock change permission as well, enable
Require core stock permission in the plugin settings. Loan desk users will then
also need the normal InvenTree stock change role.
Workflows
Request
- Open the public page at
/plugin/loan/request/ (no account required).
- Browse categories or search, open a part to see its description and available
stock items, and add the items you need.
- Enter your name and email, plus pickup/return dates, purpose and any custom
fields configured by the administrator.
- Accept the responsibility statement and sign in the signature box.
- Send the request. The confirmation includes a secret tracking link.
- Approvers receive an in-app notification (and email if enabled).
Allocate stock
After approving quantities, staff can plan which physical stock items will be
used:
- Open the request detail page and select Auto allocate.
- Only approved quantities are allocated. Unapproved lines are ignored.
- Review the allocated stock sub-rows. Each row links to the stock item and
shows its location and quantity.
- Use Allocate on a line to add a specific stock item manually, or scan
the stock item's barcode/QR in the allocation dialog. Use Remove to
release an allocation.
- Use Clear allocations to start again.
Allocations are plans, not stock movements. They reduce the reported public
availability, and checkout revalidates them before moving stock. Non-trackable
parts can be allocated partially across stock items; serialized assets are
allocated one unit per stock item. The part name links to the native InvenTree
part page, and each allocation links to its stock item page.
Approve or reject
Approvers open the Loan Manager console or the request detail page. The approval
dialog lists every requested line with its requested and allocated quantities
and an approved-quantity input.
- Set a line to
0 to leave it unapproved.
- Approve a partial quantity of a line.
- Use Approve all requested for a full approval.
- At least one line must have a non-zero approved quantity.
- Once allocations exist on a line, its approved quantity can only be increased.
Remove allocations first to reduce it.
- Further approvals can increase quantities until the request is fully approved.
- Requests with some approved and some unapproved quantities use the
Partially approved status.
- Reject the whole request when needed.
Anonymous requesters receive approval, partial approval and rejection updates at
the email address they provided, and can follow the request through their
tracking link.
Pack and mark ready for pickup
- Open an approved or partially approved request. A pickup box reference is
created automatically when the first quantities are approved.
- Allocate all approved stock. The ready action is disabled while any approved
quantity is still unallocated. Unapproved lines do not block readiness.
- Select Mark ready for pickup, optionally enter a box/bag name (for
example
Shelf A – blue box) and packing notes.
- The request moves to Ready for pickup and the requester receives an
in-app notification and email when email is enabled.
- Select Print box label to print an A6 label with the box QR, box
reference, request reference, requester, allocated contents and pickup date.
Only allocated quantities are printed; partial boxes are marked as such.
The box reference and name are shown on the request page. The pickup box is
marked Collected automatically when the request is handed out.
Use Print return sheet to print the A4 contents sheet. It lists every
allocated stock item with its own QR code. Keep it with the box; on return, scan
each item QR in the return counter. Serialized QRs count one unit, while bulk
item QRs count the outstanding quantity for that stock item.
Hand out