Org Web Adapter

hungryroot/jira/be_7278_stock_status_check_support_multiple_product_ids_in_a_single_request.org

ID
b09e2cd9-e1e2-40d3-b66d-3f694e450f48

BE-7278 Stock status check - Support multiple product IDs in a single request

- source :: https://hungryroot.atlassian.net/browse/BE-7278

- tags :: Hungryroot API Project

- epic :: EP-411 Eng Parking Lot

- sprint :: HR BE Sprint 105

- status :: Status - Code Review

Tasks

DONE Clean up PR suggestions from Ben

workfeaturebe7278ep411sprint105hungryroot
ID
f77d4045-dc7e-4436-c6e7-c5b3eeed92cb

Description

The Stock Status Check admin tool (/admin/app/stock/stock-status-check/) currently

accepts a single product_id (or pairing_id) and displays inventory information

for one product at a time. Operations and support teams frequently need to check

inventory for multiple products simultaneously, requiring them to open separate

tabs or make repeated lookups.

Current Behavior

The StockStatusCheckForm accepts a single product_id integer field

Users must look up products one at a time

Querystring support already exists for link sharing (form reads from

request.GET)

Proposed Changes

1. Accept comma-separated product IDs

Update the product_id field (or add a new product_ids field) in

StockStatusCheckForm to accept a comma-separated list of product IDs (e.g.,

product_ids=123,456,789)

Validate each ID is a positive integer

Set a reasonable upper limit on the number of IDs per request (e.g., 50) to

prevent abuse

2. Display inventory for all products in a single view

Call get_stock_status for each product ID and aggregate results

Group results by product in the template for easy scanning

Show product name/SKU alongside each product ID for clarity

3. Querystring support for link sharing

This already works since the form reads from request.GET

Ensure the multi-product-ID format works in the URL (e.g.,

?product_ids=123,456,789&verbose=on)

The existing embed URL generation should carry forward the new parameter

Files to Modify

app/forms/misc.py - Update StockStatusCheckForm to support comma-separated

product IDs

app/admin/stock.py - Update stock_status_check view to iterate over multiple

product IDs

templates/admin/stock_status_check.html - Update template to display grouped

multi-product results

app/tests/admin/test_stock_status_check.py - Add tests for multi-product lookup

Acceptance Criteria

[ ] Users can enter multiple product IDs separated by commas in the Product ID

field

[ ] Inventory information for all specified products is displayed in a single

page load

[ ] Results are clearly grouped/labeled by product

[ ] Querystring URLs with multiple product IDs work for link sharing (e.g.,

?product_ids=123,456,789)

[ ] Validation errors are shown for invalid IDs in the list

[ ] Reasonable limit on number of product IDs per request

[ ] Existing single product_id and pairing_id functionality continues to work