ShoppingCart
Collect purchase requests in a shopping cart, and consolidate them into purchase orders.
Users add purchase requests for parts they need to a shared shopping cart. A purchasing officer later reviews the cart, selects multiple requests, and converts them into a purchase order in a single step.
Installation
InvenTree Plugin Manager
Install the inventree-shopping-cart package from the InvenTree plugin manager, then activate the Shopping Cart plugin.
Command Line
To install manually via the command line, run the following command:
pip install inventree-shopping-cart
Configuration
This plugin requires InvenTree 1.7.0 or newer, and the following global settings must be enabled:
- Enable app integration: The plugin provides a database table, so migrations must be run after activation.
- Enable URL integration: The plugin provides custom API endpoints.
- Enable interface integration: The plugin provides a custom UI panel.
Usage
The Shopping Cart panel is displayed on the Purchasing page.
Requesting Items
Any user with view permission for purchase orders can add items to the cart. Each request records:
| Field | Description |
|---|---|
| Part | The (purchaseable) part to be purchased |
| Supplier Part | Preferred supplier part (optional) |
| Quantity | Required quantity, in the units of the part |
| Required Date | Date by which the items are needed (optional) |
| Reason | Reason for the purchase (optional) |
| Project Code | Project code for the purchase (optional) |
| User | The user who made the request (assigned automatically) |
Items can also be added using the Add to Cart button in the page header, on the detail page of any active, purchaseable part, or of an active supplier part for a purchaseable part. When added from a supplier part page, the supplier part is pre-selected.
The required quantity is suggested based on the existing requirements for the part (see API). The suggested quantity is displayed as a placeholder, and can be auto-filled by clicking on the button next to the quantity field.
| Added from a part page | Added from a supplier part page |
|---|---|
The Shopping Cart dashboard item can be added to the InvenTree dashboard. It displays the number of items in the cart, and links to the shopping cart panel.
Users can edit or remove their own requests. Users with change or delete permission for purchase orders can edit or remove any request.
Creating Purchase Orders
Users with add permission for purchase orders can select multiple requests in the cart, and create a purchase order from them. Only requests which specify a supplier part can be selected, and all selected requests must be from the same supplier (the supplier is determined from the selected requests). Then either:
- Leave the purchase order empty, to create a new purchase order for the supplier, or
- Select an existing pending purchase order for the supplier, to add the items to it, or
- Create a new purchase order directly from the form (using the + button next to the purchase order field), to customize the new order
For each selected request, a supplier part is determined as follows:
- If the request specifies a supplier part, it must be from the selected supplier
- Otherwise, the default supplier part for the part is used (if it is from the selected supplier)
- Otherwise, the part must have exactly one active supplier part from the selected supplier
If a supplier part cannot be determined for any selected request, no changes are made.
Each request becomes a separate line item. The requested quantity is converted to supplier pack quantity (rounded up to whole packs), and the required date, project code and reason are copied to the line item. If all of the selected requests share a single project code, it is also assigned to a newly created purchase order.
Converted requests are removed from the cart.
API
| Endpoint | Description |
|---|---|
/plugin/shopping-cart/cart/ |
List and create cart entries |
/plugin/shopping-cart/cart/<pk>/ |
Retrieve, update or delete a cart entry |
/plugin/shopping-cart/cart/convert/ |
Convert cart entries into a purchase order |
/plugin/shopping-cart/cart/requirements/<part>/ |
Suggested purchase quantity for a part (requires part view permission) |
The list endpoint supports the following filters: part, supplier_part, project_code, user, mine, has_supplier_part, supplier and overdue.
The suggested quantity is the shortfall between the quantity required (open build orders, open sales orders and the part's minimum stock level) and the quantity available (total stock, quantity on order, and quantity already in the cart).
Development
Run the unit tests from the InvenTree backend directory:
INVENTREE_PLUGIN_TESTING=True INVENTREE_PLUGIN_TESTING_SETUP=True python manage.py test shopping_cart
Metadata
Release files for inventree-shopping-cart 1.0.1
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_shopping_cart-1.0.1.tar.gz | 143.2 kB | Without provenance | Details for inventree_shopping_cart-1.0.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| inventree_shopping_cart-1.0.1-py3-none-any.whl | Python 3 | none | any | Details for inventree_shopping_cart-1.0.1-py3-none-any.whl |
Total release size: 324.6 kB
Release files / inventree_shopping_cart-1.0.1.tar.gz
| Download URL | inventree_shopping_cart-1.0.1.tar.gz |
|---|---|
| Size | 143.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
283bf06e87dd88fcf0161b29e7d2846c4a671f478ab902cc35e16affbaf87dc4
|
|
BLAKE2b-256 checksum How to use checksums |
6b2c9e2cf1bf4f92ff72e4870e7790609a7cf06afbf898d3e9c104c1a0f2f826
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.11.18
|
Release files / inventree_shopping_cart-1.0.1-py3-none-any.whl
| Download URL | inventree_shopping_cart-1.0.1-py3-none-any.whl |
|---|---|
| Size | 181.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f6729f7d610a7a453c38d4dae7cdbf49968ba3631c4ebd4bbd86fcf612615948
|
|
BLAKE2b-256 checksum How to use checksums |
8c68681eb90ef493a948d4875a99565c461b689f1f3f8b197ad721442c2aaaf5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.11.18
|
Security for inventree-shopping-cart 1.0.1
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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A 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.