Skip to content

PRD: Units of Measure & Conversion

ModuleInventoryPRD IDPRD-UOM-001
StatusNo itemFEATUOM
EpicPlane
Date2026-07-13Versionv1.0
Packages@nx/inventoryURDUOM
SurfaceClient · Owner/Mgr
OwnerPhát Nguyễn

What units of measure and conversion are

A merchant counts goods in several ways at once: they buy Coke by the case and sell it by the can, buy sugar in 25 kg sacks and measure it into a recipe in grams. A unit of measure is the catalog of those ways of counting, and conversion is what brings every number onto one common scale.

The system ships a shared set of units out of the box (piece, box, case, kg, g, litre, ml and so on), usable from day one. A merchant adds their own units when the shared set falls short.

The base unit and the three roles

Every item declares three unit roles. This is the vocabulary every other Inventory PRD leans on whenever it talks about a quantity:

RoleMeaningRequired
Base unitThe smallest unit the item is counted in. All stock is always held in this unit, and its factor is always 1Yes
Purchasing unitThe default unit when raising a purchase order and receiving goodsNo
Selling unitThe default unit when sellingNo

The number sitting in a stock item is always a number in the base unit. Paperwork written in cases or in sacks still raises stock in the base unit, after conversion.

Why the document author does not multiply the factor

Stock has to settle on one common unit, otherwise the arithmetic is meaningless: 2 cases plus 5 cans adds up to nothing usable.

Pushing the conversion work onto whoever writes the document - giving the line a factor field and letting the person multiply by hand - is how stock figures rot. One bad entry and the number is wrong forever, and nobody notices until the next stock count.

There is a second problem specific to the Vietnamese market: a "case" of Coke is 24 cans, a case of beer is 20 cans, a case of instant noodles is 30 packs. Force the factor to live in the shared unit catalog and the merchant has to spawn "case-24", "case-20", "case-30". The catalog bloats, people keep picking the wrong one, and reports can no longer group anything together.

Three items, one "case" unit

The catalog holds exactly one "case" unit. The packaging spec is declared on each item instead.

ItemBase unitPurchasing unitDeclared on the itemReceive 2 purchasing unitsStock rises by
Cokecancase242 cases48 cans
Beercancase202 cases40 cans
Sugargkgblank5 kg5000 g
  • Coke and beer use the same "case" unit from the catalog and still produce two different numbers. The number declared on the item beats the catalog's shared factor.
  • Sugar leaves the override blank, so the system walks the catalog's chain of factors: 1 kg = 1000 g. That is the right answer for standard measurement units, because 1 kg is 1000 g everywhere.
  • The document author only picks a unit and types a quantity. The entry screen echoes back "2 cases = 48 cans" for a sanity check before approval.

The easiest thing to get wrong

The factor is locked the moment an item has any stock movement

Once an item has ever been received, sold, transferred or counted, the factor field is locked. Editing it at that point rewrites history: the old quantities stay put but their meaning changes, and past periods' cost drifts with them.

A vendor shipping a different pack size gets a new unit declared on the item (Case of 10 alongside Case of 12); the existing unit is left alone.

The consequence: a document freezes both the unit and the base-unit quantity the moment it is raised. Reopening an old purchase order always shows the figures of the day it was written.

Proprietary and Confidential. Unauthorized copying, distribution, or use of this software is strictly prohibited.