Skip to content

CookiesWe use the cookies the site needs to work. Analytics and marketing only turn on with your permission. Privacy policy

My choices
What stays on

Your choice lasts 12 months. To change it, open “Cookies” in the footer.

IntData
IntData · https://intdata.com.br/en/metrics/recent-stockouts · November 30, 2026

Recent stockouts

Which products ran out of stock in the last few days, and how much did I fail to sell because of it?

Verified Metric version 1.0.0

What it is

A product whose balance in internal locations is zero (or negative) now and whose last move out of internal locations happened in the last N hours. The average sale is the quantity shipped to customers in the reference period divided by its days; what went unsold is that average × the time since the last outgoing move × the sales price on record.

What it is not

  • It is not 'products with a zero balance': one that has been at zero for months is not a recent stockout, it is a discontinued or forgotten product (it shows up with more hours in the window).
  • It is not what was actually lost: it is an estimate, from the average sale of the period and the price on record. Discounts, seasonality and customers who waited for the restock change the number.
  • It does not count services or products that do not track stock.

Pitfalls this metric handles

The traps a hasty calculation falls into — and how this metric avoids each one.

A zero balance is not a recent stockout

The mistake
Listing every product with a zero balance.
Why it happens
The list fills up with products idle for months, and yesterday's stockout, the one that costs sales, gets lost in it.
How we handle it
Require the last outgoing move to be inside the window of hours.

Transfer between warehouses as an outgoing move

The mistake
Counting a move from one internal location to another as a sale.
Why it happens
The company's balance did not change; the product only changed shelves. The average sale goes up, and so does the estimated loss.
How we handle it
Outgoing means internal origin and destination outside internal locations, as in dead stock; and the average sale counts only what went to customers (scrap empties the stock, but it is not a sale).

One warehouse's balance

The mistake
Calling the empty warehouse a stockout when another one of the same company still has the product.
Why it happens
The store sells by transferring from the other warehouse; no sale is lost.
How we handle it
Add up the balance of every internal location of the company before deciding.

UTC time

The mistake
Comparing the move date, stored in UTC, with local time.
Why it happens
Three hours of difference put the evening's move in or out of the window.
How we handle it
The window is computed in UTC, and the screen shows Brasília time.

Where the number comes from

Audit trail

Odoo model
stock.move + stock.quant + product.product
Fields
stock.move.date, stock.move.quantity, stock.move.location_id.usage, stock.move.location_dest_id.usage, stock.move.state, stock.quant.quantity, stock.quant.location_id.usage, product.product.list_price
Why this path
A done stock.move, leaving an internal location for outside, is the outgoing move that actually happened (sale, POS, scrap); stock.quant is the balance right now. The balance alone does not say when the product ran out.

How you can adjust it

ParameterWhat it doesOptions
Companies company ids, always explicit —
Ran out in the last (hours) the window: ran out in the last N hours —
Period {from, to}: the period of the average sale; without a period, the 30 days up to now —
Filters narrow down by categories or products (lists of ids; a category includes its children) or codes (the codes the person gave — reference, variant, barcode, vendor code or name — matched by the engine) categories, products, and codes
Group by breakdown inside each company company and category
Sort by order of the products estimated loss, last outgoing move, and product
Items listed how many products to list; the total always covers the whole set —

Validation

To be validated on a real database. The method comes from a script that already ran in a customer's operation, and the calculation passes the automated tests against the demo database. IntData has not yet checked it on a real database; until then, check the first result in Odoo using the path in the audit trail.

Date
October 25, 2026
Checked against
Recount from the moves and balances of the demo database and of the six test Odoo instances (14, 16 to 20). To be validated on a real database.
Expected Odoo versions
14.0, 16.0, 17.0, 18.0, 19.0, 20.0, saas~19.2+e, saas~19.3+e
Note
Does not use read_group nor the stock value: a read-only user with Inventory access is enough.

Need a variation of this metric, or another one that does not exist yet?