GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - inventree/inventree-shopping-cart: Shopping cart plugin for InvenTree

BranchesTags
Open more actions menu

Latest commit

 

History

52 Commits
52 Commits

Folders and files

NameName
Last commit message
Last commit date
.github/workflows
.github/workflows
 
 
docs
docs
 
 
frontend
frontend
 
 
shopping_cart
shopping_cart
 
 
.gitignore
.gitignore
 
 
.pre-commit-config.yaml
.pre-commit-config.yaml
 
 
LICENSE
LICENSE
 
 
MANIFEST.in
MANIFEST.in
 
 
README.md
README.md
 
 
biome.json
biome.json
 
 
pyproject.toml
pyproject.toml
 
 
setup.cfg
setup.cfg
 
 

Repository files navigation

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.

Plugin Settings

The following plugin settings control which fields must be provided for each shopping cart entry:

Setting Description
Require Project Code Cart entries must specify a project code (only applies if project codes are enabled)
Require Destination Cart entries must specify a destination location
Require Reason Cart entries must specify a reason for the purchase

Required fields are enforced by the API (including data import), and cannot be cleared from existing entries.

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)
Destination Stock location where the received items should be placed (optional). Pre-filled from the default location of the part (or its category)
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, destination and reason are copied to the line item. If all of the selected requests share a single project code (or destination), 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

About

Shopping cart plugin for InvenTree

Resources

Readme
MIT license
Activity
Custom properties

Stars

0 stars

Watchers

0 watching

Forks

0 forks
Report repository

Releases

Packages

Contributors

Languages

You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.