Manages dated inventory lots for products with expiry tracking, supporting FEFO (First-Expired-First-Out) logic. Use this for inventory systems requiring shelf-life management and stock rotation.
// Source: https://github.com/HeyPuter/everything | License: MIT | Copyright 2026 Puter Technologies Inc
// Provided via justclaw.it.com; keep this notice with the code.
/**
* Dated lots for products that track expiry ("track expiry dates" on
* the product form). Deliberately lean: a lot is { date, qty } — no
* supplier lot numbers, no per-lot cost — enough to answer "what do I
* need to sell or toss this week?".
*
* A tracked product holds `lots: { [locationId]: [{ date, qty }] }`
* alongside its `stock` buckets; the buckets stay the cached totals
* (sum of lots per location), so everything that reads quantities keeps
* working untouched. Dates are local 'YYYY-MM-DD' strings; '' means
* "date unknown" (stock from before tracking, or receipts that didn't
* say). FEFO order is ea
... (truncated -- full source via MCP)
See the full source, get the GitHub permalink, and search for more like it.
Get a free API key