inventree-loan 0.2.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (74) hide show
  1. inventree_loan-0.2.0/LICENSE +21 -0
  2. inventree_loan-0.2.0/MANIFEST.in +5 -0
  3. inventree_loan-0.2.0/PKG-INFO +420 -0
  4. inventree_loan-0.2.0/README.md +399 -0
  5. inventree_loan-0.2.0/inventree_loan/__init__.py +5 -0
  6. inventree_loan-0.2.0/inventree_loan/admin.py +94 -0
  7. inventree_loan-0.2.0/inventree_loan/api/__init__.py +1 -0
  8. inventree_loan-0.2.0/inventree_loan/api/serializers.py +183 -0
  9. inventree_loan-0.2.0/inventree_loan/api/views.py +1685 -0
  10. inventree_loan-0.2.0/inventree_loan/apps.py +17 -0
  11. inventree_loan-0.2.0/inventree_loan/config.py +120 -0
  12. inventree_loan-0.2.0/inventree_loan/core.py +496 -0
  13. inventree_loan-0.2.0/inventree_loan/management/__init__.py +0 -0
  14. inventree_loan-0.2.0/inventree_loan/management/commands/__init__.py +0 -0
  15. inventree_loan-0.2.0/inventree_loan/management/commands/loan_add_manager.py +47 -0
  16. inventree_loan-0.2.0/inventree_loan/management/commands/loan_setup.py +61 -0
  17. inventree_loan-0.2.0/inventree_loan/migrations/0001_initial.py +180 -0
  18. inventree_loan-0.2.0/inventree_loan/migrations/0002_loanitem_stock_item_label_loanitem_stock_item_serial_and_more.py +30 -0
  19. inventree_loan-0.2.0/inventree_loan/migrations/0003_loan_borrower_email_loan_borrower_name_and_more.py +111 -0
  20. inventree_loan-0.2.0/inventree_loan/migrations/0004_loanrequestallocation.py +36 -0
  21. inventree_loan-0.2.0/inventree_loan/migrations/0005_loanrequestallocation_loan_allocation_quantity_positive.py +20 -0
  22. inventree_loan-0.2.0/inventree_loan/migrations/__init__.py +0 -0
  23. inventree_loan-0.2.0/inventree_loan/models.py +881 -0
  24. inventree_loan-0.2.0/inventree_loan/permissions.py +136 -0
  25. inventree_loan-0.2.0/inventree_loan/selectors.py +88 -0
  26. inventree_loan-0.2.0/inventree_loan/services/__init__.py +1 -0
  27. inventree_loan-0.2.0/inventree_loan/services/allocation.py +257 -0
  28. inventree_loan-0.2.0/inventree_loan/services/barcode.py +204 -0
  29. inventree_loan-0.2.0/inventree_loan/services/checkout.py +406 -0
  30. inventree_loan-0.2.0/inventree_loan/services/notifications.py +189 -0
  31. inventree_loan-0.2.0/inventree_loan/services/requests.py +811 -0
  32. inventree_loan-0.2.0/inventree_loan/services/returns.py +315 -0
  33. inventree_loan-0.2.0/inventree_loan/services/setup.py +134 -0
  34. inventree_loan-0.2.0/inventree_loan/signals.py +68 -0
  35. inventree_loan-0.2.0/inventree_loan/static/admin.js +3052 -0
  36. inventree_loan-0.2.0/inventree_loan/static/loan.css +756 -0
  37. inventree_loan-0.2.0/inventree_loan/static/loan.js +1521 -0
  38. inventree_loan-0.2.0/inventree_loan/static/public.css +1624 -0
  39. inventree_loan-0.2.0/inventree_loan/tasks.py +63 -0
  40. inventree_loan-0.2.0/inventree_loan/templates/inventree_loan/_js_config.html +52 -0
  41. inventree_loan-0.2.0/inventree_loan/templates/inventree_loan/_status_badge.html +25 -0
  42. inventree_loan-0.2.0/inventree_loan/templates/inventree_loan/base.html +124 -0
  43. inventree_loan-0.2.0/inventree_loan/templates/inventree_loan/base_external.html +78 -0
  44. inventree_loan-0.2.0/inventree_loan/templates/inventree_loan/checkout.html +125 -0
  45. inventree_loan-0.2.0/inventree_loan/templates/inventree_loan/dashboard.html +192 -0
  46. inventree_loan-0.2.0/inventree_loan/templates/inventree_loan/history.html +68 -0
  47. inventree_loan-0.2.0/inventree_loan/templates/inventree_loan/loan_detail.html +119 -0
  48. inventree_loan-0.2.0/inventree_loan/templates/inventree_loan/loans.html +77 -0
  49. inventree_loan-0.2.0/inventree_loan/templates/inventree_loan/receipt.html +84 -0
  50. inventree_loan-0.2.0/inventree_loan/templates/inventree_loan/request_detail.html +93 -0
  51. inventree_loan-0.2.0/inventree_loan/templates/inventree_loan/request_form.html +198 -0
  52. inventree_loan-0.2.0/inventree_loan/templates/inventree_loan/request_receipt.html +87 -0
  53. inventree_loan-0.2.0/inventree_loan/templates/inventree_loan/requests.html +84 -0
  54. inventree_loan-0.2.0/inventree_loan/templates/inventree_loan/return.html +73 -0
  55. inventree_loan-0.2.0/inventree_loan/templates/inventree_loan/setup.html +58 -0
  56. inventree_loan-0.2.0/inventree_loan/templates/inventree_loan/staff.html +81 -0
  57. inventree_loan-0.2.0/inventree_loan/templates/inventree_loan/track_lookup.html +34 -0
  58. inventree_loan-0.2.0/inventree_loan/templates/inventree_loan/track_request.html +119 -0
  59. inventree_loan-0.2.0/inventree_loan/tests/__init__.py +0 -0
  60. inventree_loan-0.2.0/inventree_loan/tests/test_allocation.py +196 -0
  61. inventree_loan-0.2.0/inventree_loan/tests/test_api.py +271 -0
  62. inventree_loan-0.2.0/inventree_loan/tests/test_permissions.py +63 -0
  63. inventree_loan-0.2.0/inventree_loan/tests/test_services.py +217 -0
  64. inventree_loan-0.2.0/inventree_loan/urls.py +246 -0
  65. inventree_loan-0.2.0/inventree_loan/utils.py +48 -0
  66. inventree_loan-0.2.0/inventree_loan/views.py +306 -0
  67. inventree_loan-0.2.0/inventree_loan.egg-info/PKG-INFO +420 -0
  68. inventree_loan-0.2.0/inventree_loan.egg-info/SOURCES.txt +72 -0
  69. inventree_loan-0.2.0/inventree_loan.egg-info/dependency_links.txt +1 -0
  70. inventree_loan-0.2.0/inventree_loan.egg-info/entry_points.txt +2 -0
  71. inventree_loan-0.2.0/inventree_loan.egg-info/requires.txt +6 -0
  72. inventree_loan-0.2.0/inventree_loan.egg-info/top_level.txt +1 -0
  73. inventree_loan-0.2.0/pyproject.toml +60 -0
  74. inventree_loan-0.2.0/setup.cfg +4 -0
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 InvenTree Loan Contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,5 @@
1
+ include README.md
2
+ include LICENSE
3
+ recursive-include inventree_loan/templates *
4
+ recursive-include inventree_loan/static *
5
+ recursive-include inventree_loan/migrations *.py
@@ -0,0 +1,420 @@
1
+ Metadata-Version: 2.4
2
+ Name: inventree-loan
3
+ Version: 0.2.0
4
+ Summary: Loan and return management for InvenTree, with requests, approvals, barcode/QR support and full history.
5
+ Author: InvenTree Loan Contributors
6
+ License-Expression: MIT
7
+ Project-URL: Homepage, https://github.com/inventree/inventree-loan
8
+ Keywords: inventree,plugin,loan,library,barcode,qr
9
+ Classifier: Programming Language :: Python :: 3
10
+ Classifier: Framework :: InvenTree
11
+ Classifier: Operating System :: OS Independent
12
+ Requires-Python: >=3.10
13
+ Description-Content-Type: text/markdown
14
+ License-File: LICENSE
15
+ Requires-Dist: qrcode>=7.4
16
+ Provides-Extra: dev
17
+ Requires-Dist: pytest>=8; extra == "dev"
18
+ Requires-Dist: pytest-django>=4.8; extra == "dev"
19
+ Requires-Dist: ruff>=0.6; extra == "dev"
20
+ Dynamic: license-file
21
+
22
+ # InvenTree Loan Manager
23
+
24
+ A loan and return management plugin for **InvenTree 1.6+** (developed and tested
25
+ against InvenTree 1.7.4). It adds a complete request → approval → handout →
26
+ return workflow with audit history, barcode/QR support, due-date reminders, and
27
+ a role-aware interface for requesters and loan desk staff.
28
+
29
+ ## Features
30
+
31
+ - A **public request catalogue** that works without an InvenTree account.
32
+ - Browse loanable parts by category or search, open part details, and inspect
33
+ available stock items before adding them to a request.
34
+ - Anonymous requesters enter their own name, email, phone, organisation and ID,
35
+ so no InvenTree user account is required.
36
+ - Requesters sign at submission. The loan desk captures a second signature at
37
+ handout, and a third at return.
38
+ - Approvers can review, approve, and reject requests.
39
+ - The admin console has a **View** action for every request, showing requester
40
+ details, purpose, dates, requested items, notes and the submitted signature
41
+ before approval or handout.
42
+ - Loan desk staff can hand out items by scanning barcodes or searching the catalog.
43
+ - Trackable/serialized parts are loaned as whole units and returned in full.
44
+ Non-trackable parts support partial quantities; split items are moved to the
45
+ loan location and returned to their original location and status.
46
+ - Items move to a dedicated **On Loan** location and receive an **On Loan** status.
47
+ - While on loan, stock items are excluded from availability and normal allocation flows.
48
+ - Direct edits, moves, quantity changes, allocation, and deletion of loaned items are
49
+ blocked by plugin validation.
50
+ - Returns support full or partial quantities, condition notes, and restoring the
51
+ original location and status.
52
+ - Every request, decision, handout, reminder, renewal, loss, and return is recorded
53
+ in an append-only audit timeline.
54
+ - Every anonymous request gets a secret tracking link showing its status, loan
55
+ progress, and signatures.
56
+ - QR codes identify loans; printed receipts include the QR, due date, and
57
+ captured signatures.
58
+ - Barcode scanning supports USB/keyboard scanners and camera scanning where the
59
+ browser exposes `BarcodeDetector`.
60
+ - Optional email notifications; in-app notifications are always available.
61
+ - Scheduled due-soon and overdue reminders.
62
+ - CSV export for requests and loans.
63
+ - Responsive, accessible interface with light and dark mode support.
64
+
65
+ ## Requirements
66
+
67
+ - InvenTree **1.6+** (`MIN_VERSION = 1.6.0`, `MAX_VERSION = 1.7.99`)
68
+ - InvenTree 1.5.x does not support plugin-defined React routes, so the native
69
+ **Loans** tab requires an upgrade to 1.6 or newer.
70
+ - Python 3.10+
71
+ - The global settings `ENABLE_PLUGINS_APP`, `ENABLE_PLUGINS_URL`, and
72
+ `ENABLE_PLUGINS_INTERFACE` must be enabled
73
+ - `ENABLE_PLUGINS_APP` is required for the plugin's models and migrations.
74
+ - `ENABLE_PLUGINS_INTERFACE` is required for the **Loans** tab and native page.
75
+ - The public request page (`/plugin/loan/request/`) does **not** require an
76
+ InvenTree account. It must be reachable from the network that will use it.
77
+ - Optional for camera scanning: a browser with `BarcodeDetector` support
78
+
79
+ > **Upgrading from 1.5.x:** enable `ENABLE_PLUGINS_APP` before restarting. Without
80
+ > it the plugin can appear in the list but its Django app, tables, and URLs are
81
+ > never registered, which produces the intermittent empty/broken pages.
82
+
83
+ ## Installation
84
+
85
+ ### As a Python package
86
+
87
+ ```bash
88
+ pip install inventree-loan
89
+ ```
90
+
91
+ Then restart InvenTree, open the plugin management page
92
+ (`/web/settings/admin/plugin`), find **InvenTree Loan Manager**, and activate it.
93
+
94
+ ### Editable development install
95
+
96
+ ```bash
97
+ pip install -e .
98
+ ```
99
+
100
+ Restart the InvenTree server after installation.
101
+
102
+ #### Docker development workflow
103
+
104
+ When InvenTree runs in Docker, the container filesystem is ephemeral. Keep the
105
+ editable install in a mounted plugin directory and record it in
106
+ `data/plugins.txt`:
107
+
108
+ ```text
109
+ -e /home/inventree/data/plugins/inventree-loan
110
+ ```
111
+
112
+ Plugin JavaScript, CSS, and templates are served directly from the installed
113
+ package through the plugin's own URL (`/plugin/loan/assets/...`). They therefore
114
+ do not depend on `collectplugins` and are not left stale by the static-file
115
+ cache. Python and template changes need a restart because plugins are discovered
116
+ at startup:
117
+
118
+ ```bash
119
+ docker restart inventree-server inventree-worker
120
+ ```
121
+
122
+ ### Database migration
123
+
124
+ The plugin uses its own Django app and migrations. After activating the plugin,
125
+ run the InvenTree update/migration command for your deployment, for example:
126
+
127
+ ```bash
128
+ invoke update
129
+ ```
130
+
131
+ or, in a source install:
132
+
133
+ ```bash
134
+ python manage.py migrate
135
+ ```
136
+
137
+ ## Using the plugin
138
+
139
+ The plugin adds a **Loans** tab to the InvenTree navigation bar, a **Loans** card
140
+ to the dashboard widget list, and a **Loan Manager** spotlight action.
141
+
142
+ - **Request equipment** (`/plugin/loan/request/`) is the public catalogue.
143
+ It requires no account. It uses an InvenTree-style table with category tabs,
144
+ search, barcode input, pagination, and a request drawer. Requesters open item
145
+ details, choose available stock, enter their contact details, sign, and
146
+ submit. The confirmation shows the reference code, tracking link, and a
147
+ printable request receipt.
148
+ - **Track a request** (`/plugin/loan/track/`) lets an anonymous requester enter
149
+ the reference code and email address to open their request.
150
+ - **Request status** (`/plugin/loan/track/<token>/`) shows the request, loan
151
+ dates, decisions, and captured signatures.
152
+ - **Loans (navigation)** opens a native InvenTree page at
153
+ `/web/plugin/loan/management`. It is rendered inside the normal InvenTree
154
+ layout, so the header, navigation, theme, and user menu behave exactly like
155
+ the Stock or Parts pages. Requests and loans use searchable, filterable,
156
+ sortable tables with pagination and CSV export; summary cards show pending,
157
+ approved, active and overdue counts. Signed-in requesters use the same page
158
+ for their requests and loans; the old server-rendered My Requests pages
159
+ redirect here, so there is only one version.
160
+ - **Request details** (`/web/plugin/loan/requests/<pk>`) is a full native page,
161
+ like a build-order detail page. It shows requester/contact details, purpose,
162
+ dates, lines, signatures, stock allocations, part/stock links, approval and
163
+ handout actions, and print buttons for request/handout/return receipts.
164
+ - **Loans (dashboard widget)** provides a requester shortcut and an
165
+ **Open loan desk** button which opens the same native page.
166
+ - The plugin settings page (Admin Center → Plugins → InvenTree Loan Manager)
167
+ uses the same native console for initial setup.
168
+
169
+ The native console adapts to the signed-in user's loan role: requesters see
170
+ their own requests and loans, while loan staff additionally see the handout,
171
+ staff, setup, and audit-history tabs. Handout and return dialogs require the
172
+ borrower's signature. The Staff tab searches InvenTree users by name, username
173
+ or email, so you do not need to know the exact username.
174
+
175
+ ## Initial setup
176
+
177
+ The plugin needs two stock objects:
178
+
179
+ 1. A dedicated **On Loan** stock location.
180
+ 2. A custom **On Loan** stock status whose logical value is `Quarantined`
181
+ (so InvenTree treats loaned items as unavailable).
182
+
183
+ Run the setup action from the **Setup** tab of the Loan Manager console, or use
184
+ the management command:
185
+
186
+ ```bash
187
+ python manage.py loan_setup --create-location --location-name "On Loan"
188
+ ```
189
+
190
+ The command is idempotent and can be re-run safely. It creates the custom status,
191
+ creates or selects the location, and saves the location to the plugin settings.
192
+
193
+ > The custom status is what makes an item unavailable. The location keeps the
194
+ > stock history and the return path clear. If the custom status cannot be created,
195
+ > the plugin falls back to InvenTree's built-in `Quarantined` status.
196
+
197
+ ## Staff roles
198
+
199
+ The plugin has its own roles, separate from InvenTree's stock roles:
200
+
201
+ | Role | Capabilities |
202
+ |---|---|
203
+ | **Approver** | View all requests/loans, approve or reject requests |
204
+ | **Loan desk** | Everything an approver can do, plus hand out, return, renew, mark lost |
205
+ | **Loan administrator** | Everything, plus manage staff and plugin setup |
206
+
207
+ Superusers always have full plugin access.
208
+
209
+ Grant the first role from the **Staff** tab of the Loan Manager console or with:
210
+
211
+ ```bash
212
+ python manage.py loan_add_manager <username> --role admin
213
+ ```
214
+
215
+ Only a superuser can grant the **Loan administrator** role through the web UI.
216
+ The last active administrator cannot be demoted or removed.
217
+
218
+ ### Optional core stock permission
219
+
220
+ By default, plugin roles govern handout and return actions. If your organization
221
+ requires InvenTree's core stock change permission as well, enable
222
+ **Require core stock permission** in the plugin settings. Loan desk users will then
223
+ also need the normal InvenTree stock change role.
224
+
225
+ ## Workflows
226
+
227
+ ### Request
228
+
229
+ 1. Open the public page at `/plugin/loan/request/` (no account required).
230
+ 2. Browse categories or search, open a part to see its description and available
231
+ stock items, and add the items you need.
232
+ 3. Enter your name, email, phone, organisation and optional ID, plus pickup and
233
+ return dates and the purpose.
234
+ 4. Accept the responsibility statement and sign in the signature box.
235
+ 5. Send the request. The confirmation includes a secret tracking link.
236
+ 6. Approvers receive an in-app notification (and email if enabled).
237
+
238
+ ### Allocate stock
239
+
240
+ Before approval or handout, staff can plan which physical stock items will be
241
+ used:
242
+
243
+ 1. Open the request detail page and select **Auto allocate**.
244
+ 2. Review the allocated stock sub-rows. Each row links to the stock item and
245
+ shows its location and quantity.
246
+ 3. Use **Allocate** on a line to add a specific stock item manually, or
247
+ **Remove** to release an allocation.
248
+ 4. Use **Clear allocations** to start again.
249
+
250
+ Allocations are plans, not stock movements. They reduce the reported public
251
+ availability, and checkout revalidates them before moving stock. Non-trackable
252
+ parts can be allocated partially across stock items; serialized assets are
253
+ allocated one unit per stock item. The part name links to the native InvenTree
254
+ part page, and each allocation links to its stock item page.
255
+
256
+ ### Approve or reject
257
+
258
+ Approvers open the Loan Manager console or the request detail page. The detail
259
+ view shows the requester, contact details, purpose, dates, items, signature and
260
+ stock allocations. **Approve** or **Reject**, optionally adding a decision
261
+ note. Anonymous requesters receive the decision at the email address they
262
+ provided, and can follow the request through their tracking link.
263
+
264
+ ### Hand out
265
+
266
+ 1. Open the **Handout** tab in the Loan Manager console, or open the request
267
+ detail page.
268
+ 2. Select **Hand out** on an approved request.
269
+ 3. Review the request details and have the borrower sign in the signature box.
270
+ 4. Confirm the handout.
271
+ 5. Print the **handout receipt** or show the loan QR. The receipt QR code opens
272
+ the request tracking/detail page.
273
+
274
+ The service selects available stock items, moves or splits the requested quantities
275
+ to the On Loan location, applies the On Loan status, and records the original
276
+ location and status. The handout signature is stored on the loan and shown on the
277
+ requester's tracking page and the printed receipt.
278
+
279
+ ### Return
280
+
281
+ 1. Open the **Loans** tab in the Loan Manager console.
282
+ 2. Choose the loan and select **Return**.
283
+ 3. Adjust return quantities and select the condition.
284
+ 4. Ask the borrower to sign, then confirm.
285
+ 5. Print the **return receipt** from the loan row or request detail page.
286
+
287
+ The item is returned to its original location, the original status is restored, and
288
+ the loan is marked partially returned or returned. The return signature is stored
289
+ on the loan. The returned stock item remains linked to the loan line for audit
290
+ history.
291
+
292
+ ### Trackable and non-trackable parts
293
+
294
+ - **Non-trackable parts** are quantity-tracked. A request can ask for part of a
295
+ stock item; the plugin splits the item, moves the split quantity to the loan
296
+ location, and returns it to the original location and status. The returned
297
+ split remains a separate stock item so the loan line keeps its audit link.
298
+ - **Trackable/serialized assets** are individual stock items with a serial or
299
+ asset label. The public page lists the available units, and each unit is added
300
+ as quantity 1. Trackable parts are requested in whole units; serialized items
301
+ cannot be partially returned.
302
+
303
+ ### Renew, lose, and overdue
304
+
305
+ - **Renew** extends the due date, up to the configured maximum.
306
+ - **Lost** closes a line and marks the stock item `Lost` without losing history.
307
+ - A daily scheduled task sends due-soon and overdue reminders once per period.
308
+
309
+ ## Barcode and QR
310
+
311
+ Loan QR codes contain a JSON payload:
312
+
313
+ ```json
314
+ {"inventree_loan": "<loan-uuid>"}
315
+ ```
316
+
317
+ Loan QR codes can still open the return workflow at the desk. Printed request,
318
+ handout, and return receipts use a separate QR code that links to the request
319
+ tracking/detail page. Scanning a stock item barcode delegates to InvenTree's
320
+ registered barcode plugins, so existing labels continue to work.
321
+
322
+ The scanner accepts:
323
+
324
+ - USB/keyboard-wedge scanners (type + Enter)
325
+ - Manual entry
326
+ - Camera scanning in browsers that support `BarcodeDetector`
327
+
328
+ ## Stock behavior
329
+
330
+ - On handout, the item is moved to the On Loan location and its status is changed to
331
+ the custom On Loan status.
332
+ - `StockItem.is_in_stock()` becomes false, so the item drops out of available stock
333
+ calculations and normal sales-order/build/transfer allocation flows.
334
+ - On return, the original location and status are restored.
335
+ - If the custom status is missing, `Quarantined` is used as a safe fallback.
336
+ - Direct core edits, moves, quantity changes, customer/order assignment, and deletion
337
+ of loaned stock items are rejected by `ValidationMixin`.
338
+ - Superusers and direct database/shell access can always override plugin protections.
339
+
340
+ ## Plugin settings
341
+
342
+ | Setting | Default | Purpose |
343
+ |---|---|---|
344
+ | On Loan location | — | Stock location used while items are out |
345
+ | On Loan status name | `ON_LOAN` | Internal custom status name |
346
+ | Loanable part category | — | Restrict requests to a category tree |
347
+ | Request group | — | Restrict signed-in users on the account pages; public requests remain open |
348
+ | Default loan duration | 14 days | Default pickup-to-return period |
349
+ | Due soon reminder | 2 days | Reminder lead time |
350
+ | Overdue reminder interval | 1 day | Repeat interval for overdue notices |
351
+ | Max active loans per user | 0 | 0 means unlimited |
352
+ | Max items per request | 25 | Request line limit |
353
+ | Require approval | on | Requests must be approved before handout |
354
+ | Allow walk-in checkout | on | Desk staff can create direct loans |
355
+ | Allow renewals / max renewals | on / 1 | Renewal policy |
356
+ | Require responsibility acknowledgement | on | Requester agreement checkbox |
357
+ | Allow public requests | on | Allow requests without an InvenTree account |
358
+ | Require a signature on requests | on | Requester must sign before submitting |
359
+ | Require a signature on handout | on | Borrower must sign when items are issued |
360
+ | Require a signature on return | on | Borrower must sign when items are returned |
361
+ | Require core stock permission | off | Also check InvenTree stock change permission |
362
+ | Lock loaned stock items | on | Block core edits/moves/allocations |
363
+ | Hide borrower details from requesters | on | Privacy for scanned items |
364
+ | Enable email | off | Send emails in addition to in-app notifications |
365
+ | Email from address | — | Optional sender override |
366
+ | Loan QR prefix | `LOAN:` | Accepted prefix before QR token |
367
+ | Catalog page size | 20 | Search result limit |
368
+
369
+ ## Development
370
+
371
+ ```bash
372
+ python -m venv .venv
373
+ .venv\Scripts\activate
374
+ pip install -e ".[dev]"
375
+ ```
376
+
377
+ Run the plugin tests inside an InvenTree environment:
378
+
379
+ ```bash
380
+ python manage.py test inventree_loan
381
+ ```
382
+
383
+ or with pytest-django:
384
+
385
+ ```bash
386
+ python manage.py test inventree_loan
387
+ ```
388
+
389
+ The tests expect the plugin app to be enabled, as InvenTree's test runner enables
390
+ installed plugins. Tests cover role hierarchy, request visibility, approval
391
+ permissions, automatic/manual allocation, public availability limits,
392
+ serialized stock rules, checkout, partial returns, and status restoration.
393
+
394
+ ## Packaging
395
+
396
+ ```bash
397
+ python -m build
398
+ ```
399
+
400
+ The built wheel includes templates, static assets, migrations, and the
401
+ `inventree_plugins` entry point.
402
+
403
+ ## Limitations and notes
404
+
405
+ - The plugin targets InvenTree 1.6–1.7. Test against a new major series before
406
+ widening `MAX_VERSION`.
407
+ - Plugin roles are separate from InvenTree groups by design; see the optional core
408
+ stock permission setting.
409
+ - The custom On Loan status must exist before handout. The setup page and management
410
+ command handle this.
411
+ - Returned stock items are not automatically merged into their parent item
412
+ (`merge=False`), which preserves the loan history link. Staff can merge stock
413
+ manually if desired.
414
+ - Camera scanning depends on browser support; USB scanners and manual entry always
415
+ work.
416
+ - The public catalogue intentionally exposes part names, descriptions, stock
417
+ locations and available quantities. It does not expose pricing, suppliers,
418
+ borrower details, or other users.
419
+ - Loan history is append-only in the UI. Use the Django admin only for emergency
420
+ maintenance.