Skip to main content

License: MIT PyPI PEP

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.

Shopping cart panel

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.

Add to Cart button on the part detail page

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
Add to Cart form Add to Cart form, with supplier part pre-selected

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.

Shopping cart dashboard item

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

Create purchase order dialog

For each selected request, a supplier part is determined as follows:

  1. If the request specifies a supplier part, it must be from the selected supplier
  2. Otherwise, the default supplier part for the part is used (if it is from the selected supplier)
  3. 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.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for inventree-shopping-cart 1.0.0
File Size Uploaded Provenance Actions
inventree_shopping_cart-1.0.0.tar.gz 141.3 kB Without provenance Details for inventree_shopping_cart-1.0.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for inventree-shopping-cart 1.0.0
File Interpreter ABI Platform Actions
inventree_shopping_cart-1.0.0-py3-none-any.whl Python 3 none any Details for inventree_shopping_cart-1.0.0-py3-none-any.whl

Total release size: 320.1 kB

Release files / inventree_shopping_cart-1.0.0.tar.gz

Download URL inventree_shopping_cart-1.0.0.tar.gz
Size 141.3 kB
Tags Source
SHA-256 checksum
How to use checksums
ffa12f1a298ca99c12a819e584680a430eb36d3759a13b151a048de857d2f342
BLAKE2b-256 checksum
How to use checksums
8a27110d6e859e610cdb6870b4fd630cad640519c6c8f7cb483ff06f44e09f35
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.17

Release files / inventree_shopping_cart-1.0.0-py3-none-any.whl

Download URL inventree_shopping_cart-1.0.0-py3-none-any.whl
Size 178.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
cf77362c8680d75515bf2ac7bac43771f6585edf9aede660e8ae35dcf2f0c047
BLAKE2b-256 checksum
How to use checksums
79760ff62e484eedd3697b0ef884f78279b2a2905a2f2eb11b1aa18016a1d407
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.17

Security for inventree-shopping-cart 1.0.0

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.

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page