27 min read · ERP and CRM

Before a production-system project starts, the team usually gets three kinds of Excel files that everyone calls "the recipe." One sheet is a list of parts for a cabinet. One is the ingredients of a sauce as percentages. One is a sequence of jobs with times. When they all go into software, everything is squeezed into one field, and then cost, the raw-material purchase plan and delivery time all go wrong at once.
This article separates the three sets of data with an example that actually runs: the BOM (which part, how many), the recipe (what to mix, how much, and how much comes out), and the routing (where it is made and how long it takes). It then connects all three into one calculator that answers: which materials are needed, what is short, how many hours each machine is used, how many days it takes, and what the standard cost is. A manager can read only the explanations and tables and still get the picture. An engineer can run the code and follow along.
The real problem: three sets of data lumped into one
Consider three made-up situations. They are not projects of any BT San customer.
- A control-cabinet assembly shop: the cabinet's BOM is written as one flat list of a hundred lines, with no sub-assemblies. When a power panel is used in three other cabinet models, it has to be edited in three places. Wire is also ordered short, because nobody added the scrap from cutting the wire.
- A small sauce maker: the recipe is written in kilograms per batch for a 200 kg pot. When a customer orders 500 kg, someone just multiplies, without thinking that some water evaporates during boiling. The result is dozens of bottles short, and nobody rounds the bottle count to a whole number.
- A manufacturer that has to quote: the cost per piece comes from material cost only. There is no setup time, and no labor and overhead by machine hour. Ordering 1 piece and ordering 20 pieces give the same cost, when they are not the same.
All three share one cause: nobody separated what question each set of data answers. The table below summarizes the question for each set. The names used in different software products may overlap (for example, some systems also call a food recipe a BOM). What matters is that the team agrees which data answers which question.
| Data | Answers the question | Example in this article | Related numbers |
|---|---|---|---|
| BOM | What parts are needed to make 1 unit, and how many of each | Cabinet CAB-100 uses 1 power panel set, 1 PLC and 24 screws | Quantity per parent, unit of measure, scrap per line |
| Recipe | What to mix, how much, and how much output it gives | Sauce SAU-300 takes 220 kg of ingredients and gives 198 kg of sauce | Proportions, batch size, yield, rounding by packaging |
| Routing | Where it is made, in what order, and how long it takes | The cabinet goes through drilling, wiring and testing; the sauce goes through boiling and filling | Work center, setup time, run time |
| Work center | How many hours per day a machine or bench can take on, and the labor and overhead rate per hour | WC-WIRE 16 hours/day | Hours per day, rate per hour |
What ERP systems say about this: what the documentation tells us
This article does not invent a new concept. The table below summarizes the documentation of Odoo (version 18) and ERPNext, cited at the end of the article, to show where real software places these three sets of data.
| Topic | What the documentation says | Effect on data preparation |
|---|---|---|
| BOM | Odoo says a BoM records the components and quantities needed to manufacture or repair a product. ERPNext defines a BOM as a list of items and sub-assemblies, with the quantities needed to manufacture. | A BOM is a list and quantities. It is not yet time or machines. |
| Multi-level | Odoo says a multi-level BoM is used when a product you make yourself is part of another assembly, and recommends building BoMs from the bottom level up. ERPNext says each sub-assembly can have its own BOM, forming a multi-level tree, and has an exploded item table. | A reused sub-assembly should have its own BOM. Do not copy its list into every model. |
| Operation and Routing | Odoo says an operation describes the steps and records time. The Work Orders feature must be turned on, and an operation belongs to only one BoM. ERPNext says a BOM can include operations by setting a workstation, a rate per hour and a time, and these can be pulled from a Routing template. | The sequence of jobs belongs to that product's BOM, but work centers can be shared. |
| Work center | Odoo has Capacity (the number that can be made at the same time), Time efficiency (a speed multiplier), setup and cleanup time per work order, and Cost per hour. ERPNext keeps the operating cost and working hours on the Workstation. | You need to know capacity and setup time separately from run time. |
| Cost | ERPNext says BOM cost is calculated from the valuation rate of the raw materials or sub-assemblies, plus the operation cost that comes from the hourly rate and time. | So standard cost includes material, labor and overhead based on hours. |
| Scrap and process loss | ERPNext says if a scrap line is the same item as the finished good, it becomes a Process Loss Item and is deducted from the output quantity. Version 16 replaces this table with Secondary Items. | Process loss must be recorded as data, not as a number in someone's head. |
| Multiple BOMs per product | ERPNext says one item can have several BOMs for alternative materials or operations. Is Active and Is Default choose the default in a production order. | You must define which version is in use and which is the default. |
The documentation pages we read do not describe a food recipe or yield as separate data. In practice many systems also keep ingredients inside the BOM. This article separates the recipe concept (proportions, yield, batch size) to show that there are questions a parts-style BOM does not answer. It does not say that software must have a separate recipe table.
Overview of the example
The code is in the folder examples/bom-recipe-routing-difference/. It uses only Node 24 built-ins and runs TypeScript directly, with no packages to install. All data is made up. Prices, labor rates, overhead rates and times are not anyone's real figures. Stock on-hand, reserved and available, which decide whether something is short, are not explained again here. See the article on-hand-reserved-available-stock, which has its own ledger example. This example uses only the simplified formula available = on-hand - reserved.
| File | Role |
|---|---|
| data/master.json | Made-up master data: products, BOMs, recipe, work centers, routing, stock |
| bom.ts | Multi-level BOM explosion, where-used, cycle check |
| recipe.ts | Scale the recipe to a target, yield, batch size, and rounding to bottles |
| routing.ts | Setup and run hours per work center, and lead time |
| cost.ts | Standard cost and stock comparison |
| demo.ts / calc.test.ts | A script that prints the report, and 8 node:test tests |
From the example folder, run node demo.ts to see the report and node --test calc.test.ts to run the tests. If you see the warning MODULE_TYPELESS_PACKAGE_JSON, you can ignore it. It is not mixed into the output.
Step 1: multi-level BOM, where a sub-assembly has its own BOM
Cabinet CAB-100 is assembled from a steel cabinet, the power panel set SUB-PWR, the control panel set SUB-CTL, a label and screws. SUB-PWR and SUB-CTL are made in-house, so each has its own BOM. Wire WIRE-1.5 is used in both sets. Without levels, you would have to edit the wire in two places every time the length changes. Each line has a quantity per parent, and scrapPct is the scrap percentage for that line (wire that is cut off, screws that are dropped). It is assumed to be included in the quantity to buy.
"boms": {
"CAB-100": [
{ "item": "ENC-01", "qty": 1, "scrapPct": 0 },
{ "item": "SUB-PWR", "qty": 1, "scrapPct": 0 },
{ "item": "SUB-CTL", "qty": 1, "scrapPct": 0 },
{ "item": "LBL-01", "qty": 2, "scrapPct": 0 },
{ "item": "SCR-M4", "qty": 24, "scrapPct": 5 }
],
"SUB-PWR": [
{ "item": "MCB-16A", "qty": 3, "scrapPct": 0 },
{ "item": "PSU-24V", "qty": 1, "scrapPct": 0 },
{ "item": "WIRE-1.5", "qty": 6, "scrapPct": 8 },
{ "item": "TERM-BLK", "qty": 12, "scrapPct": 2 }
],
"SUB-CTL": [
{ "item": "PLC-01", "qty": 1, "scrapPct": 0 },
{ "item": "DIN-RAIL", "qty": 0.5, "scrapPct": 3 },
{ "item": "WIRE-1.5", "qty": 4, "scrapPct": 8 },
{ "item": "TERM-BLK", "qty": 8, "scrapPct": 2 }
]
},The scrap formula chosen in the example is: child quantity = parent quantity x quantity per parent x (1 + scrap/100), compounded at every level. Some factories define it instead as dividing by (1 - scrap), which gives slightly different numbers. Agree on one before importing data.
Step 2: explode the BOM into a flat material list, and guard against a circular BOM
Explosion means walking down the BOM tree and multiplying the quantity at every level, until you reach items that have no BOM of their own. Those are the items to buy or pick from stock. Before exploding, check that there is no cycle. If A contains B and B contains A, the walk never ends. The code checks with a depth-first walk that remembers the current path. If it meets an item already on the path, it returns the path that loops back.
import type { Boms, Needs } from "./types.ts";
/** หาวงวน (A มี B, B มี A) คืนเส้นทางที่วนกลับ หรือ null ถ้าไม่มี */
export function findCycle(boms: Boms): string[] | null {
const done = new Set<string>();
const walk = (item: string, path: string[]): string[] | null => {
if (path.includes(item)) return [...path.slice(path.indexOf(item)), item];
if (done.has(item)) return null;
for (const line of boms[item] ?? []) {
const hit = walk(line.item, [...path, item]);
if (hit) return hit;
}
done.add(item);
return null;
};
for (const top of Object.keys(boms)) {
const hit = walk(top, []);
if (hit) return hit;
}
return null;
}/** ระเบิด BOM หลายระดับเป็นความต้องการวัสดุแบบแบน (เฉพาะชิ้นที่ไม่มี BOM ของตัวเอง)
* ของเสีย: ปริมาณลูก = ปริมาณแม่ x qty x (1 + scrap/100) และซ้อนกันทุกระดับ */
export function explode(boms: Boms, item: string, qty: number): Needs {
const cycle = findCycle(boms);
if (cycle) throw new Error(`BOM วนกลับ: ${cycle.join(" > ")}`);
const needs: Needs = new Map();
const go = (it: string, q: number) => {
const lines = boms[it];
if (!lines) {
needs.set(it, (needs.get(it) ?? 0) + q);
return;
}
for (const l of lines) go(l.item, q * l.qty * (1 + l.scrapPct / 100));
};
go(item, qty);
return needs;
}
/** where-used: ทุกเส้นทางจากชิ้นส่วนขึ้นไปถึงผลิตภัณฑ์บนสุด เช่น WIRE-1.5 < SUB-PWR < CAB-100 */
export function whereUsed(boms: Boms, item: string): string[] {
const parents = Object.keys(boms).filter((p) => boms[p].some((l) => l.item === item));
if (parents.length === 0) return [item];
return parents.flatMap((p) => whereUsed(boms, p).map((path) => `${item} < ${path}`));
}- explode always calls findCycle first. If it finds a cycle, it throws an error with the path, instead of looping until the stack is full.
- Sub-assemblies are not in the flat material list, because they are made in-house. If you want to plan the sub-assemblies as separate orders, keep them as a separate list.
- Where-used is a walk back up. Use it to answer: if we change this wire, which cabinet models are affected? Do it before approving a part change.
Step 3: the recipe, and why it is not just a BOM
A sauce recipe looks like a BOM because it has a list and quantities, but it asks three different questions. First, the quantity put in is not the quantity that comes out, because water evaporates during boiling. So there is a yield, which belongs to the whole batch, not to each ingredient. Second, the ingredients are proportions. They scale continuously, but the pot has a maximum capacity, so the work must be split into batches. Third, the final product is sold in bottles, so it must be rounded up to whole bottles first, then divided by the yield to get back to the raw materials. If the order is swapped, the numbers are wrong.
"recipes": {
"SAU-300": {
"refInputs": [
{ "item": "ING-CHILI", "kg": 60 },
{ "item": "ING-SUGAR", "kg": 70 },
{ "item": "ING-VINEGAR", "kg": 40 },
{ "item": "ING-GARLIC", "kg": 20 },
{ "item": "ING-SALT", "kg": 6 },
{ "item": "ING-WATER", "kg": 24 }
],
"yieldPct": 90,
"maxBatchInputKg": 300,
"netKgPerPack": 0.45,
"packaging": [
{ "item": "PK-BTL", "qty": 1, "scrapPct": 2 },
{ "item": "PK-CAP", "qty": 1, "scrapPct": 2 },
{ "item": "PK-LBL", "qty": 1, "scrapPct": 2 }
]
}
},/** สเกลสูตรไปยังเป้าหมายกิโลกรัมซอส: ปัดขึ้นเป็นขวดเต็ม แล้วหารด้วย yield ย้อนกลับไปหาวัตถุดิบ */
export function planRecipe(r: Recipe, targetKg: number): RecipePlan {
const packs = Math.ceil(targetKg / r.netKgPerPack - 1e-9);
const outputKg = packs * r.netKgPerPack;
const inputKg = outputKg / (r.yieldPct / 100);
const batches = Math.ceil(inputKg / r.maxBatchInputKg - 1e-9);
const refTotal = r.refInputs.reduce((s, i) => s + i.kg, 0);
const factor = inputKg / refTotal;
const needs: Needs = new Map();
const ingredients = r.refInputs.map((i) => {
needs.set(i.item, i.kg * factor);
return { item: i.item, pct: (i.kg / refTotal) * 100, kg: i.kg * factor };
});
for (const p of r.packaging) needs.set(p.item, packs * p.qty * (1 + p.scrapPct / 100));
return { packs, outputKg, inputKg, batches, batchInputKg: inputKg / batches, factor, ingredients, needs };
}Note that packaging (bottle, cap, label) is a BOM-style list: a quantity per bottle with scrap. The ingredients in the pot are recipe-style. Real mixing work therefore often has both styles in the same product. With only a BOM, you would not know to buy extra chili to cover the water that evaporates. With only a recipe, you would not know how many bottles you need.
Step 4: routing, where setup time and run time are different
A routing says which steps the work passes through, at which work center. Each step has a setup time (preparing the machine, washing the pot), which happens once per order or per batch, and a run time, which happens per unit or per batch. The example uses setupPer and per to say what the time is multiplied by. The cabinet uses 1 batch per order. The sauce has two batches, so it boils twice, but it fills bottles in one go.
"workCentres": {
"WC-CUT": { "name": "เจาะ/ตัดตู้", "hoursPerDay": 8, "labourRate": 180, "overheadRate": 120 },
"WC-WIRE": { "name": "โต๊ะเดินสาย (2 โต๊ะ)", "hoursPerDay": 16, "labourRate": 220, "overheadRate": 60 },
"WC-TEST": { "name": "โต๊ะทดสอบ", "hoursPerDay": 8, "labourRate": 260, "overheadRate": 90 },
"WC-COOK": { "name": "หม้อต้ม", "hoursPerDay": 8, "labourRate": 200, "overheadRate": 350 },
"WC-FILL": { "name": "สายบรรจุ", "hoursPerDay": 8, "labourRate": 200, "overheadRate": 280 }
},
"queueDaysPerOp": 0.5,
"routings": {
"CAB-100": [
{ "op": 10, "name": "เจาะและตัดตู้", "wc": "WC-CUT", "setupH": 0.5, "setupPer": "order", "runH": 0.3, "per": "unit" },
{ "op": 20, "name": "เดินสายและประกอบ", "wc": "WC-WIRE", "setupH": 0.25, "setupPer": "order", "runH": 2.5, "per": "unit" },
{ "op": 30, "name": "ทดสอบ", "wc": "WC-TEST", "setupH": 0.5, "setupPer": "order", "runH": 0.75, "per": "unit" }
],
"SAU-300": [
{ "op": 10, "name": "ต้มและผสม", "wc": "WC-COOK", "setupH": 0.5, "setupPer": "batch", "runH": 3, "per": "batch" },
{ "op": 20, "name": "บรรจุขวด", "wc": "WC-FILL", "setupH": 1, "setupPer": "order", "runH": 0.001, "per": "unit" }
]
},/** qty = จำนวนหน่วยของใบสั่งผลิต (ตู้ หรือขวด), batches = จำนวนรอบ (ตู้ = 1) */
export function planRouting(
ops: Op[], wcs: Record<string, WorkCentre>, qty: number, batches: number, queueDaysPerOp: number,
): RoutingPlan {
const results = ops.map((o) => {
const setupH = o.setupH * (o.setupPer === "batch" ? batches : 1);
const runH = o.runH * (o.per === "batch" ? batches : qty);
const hours = setupH + runH;
return { op: o.op, name: o.name, wc: o.wc, setupH, runH, hours, days: hours / wcs[o.wc].hoursPerDay };
});
const hoursByWc: Record<string, number> = {};
for (const r of results) hoursByWc[r.wc] = (hoursByWc[r.wc] ?? 0) + r.hours;
const workDays = results.reduce((s, r) => s + r.days, 0);
const queueDays = ops.length * queueDaysPerOp;
return { ops: results, hoursByWc, workDays, queueDays, leadDays: workDays + queueDays };
}Lead time in the example is the working time of each step (hours divided by the work center's hours per day) plus a queue time of 0.5 day per step, which is a made-up value. Steps are done one after another. The example does not allow handing over work in overlapping sub-lots, and it does not consider time efficiency or machine breakdowns (see the article mtbf-mttr-oee-difference on measuring machine effectiveness).
Step 5: standard cost and stock comparison
Standard cost is material (including scrap) plus labor and overhead charged by the work center's hours. Every rate in the example is made up. The stock comparison uses available = on-hand - reserved, as in the article on-hand-reserved-available-stock, without repeating the ledger.
/** ต้นทุนมาตรฐาน = วัสดุ (รวมของเสีย) + ค่าแรง + ค่าโสหุ้ย ตามชั่วโมงของ work centre */
export function rollup(
needs: Needs, items: Record<string, Item>,
hoursByWc: Record<string, number>, wcs: Record<string, WorkCentre>, outputQty: number,
): CostRollup {
let material = 0, labour = 0, overhead = 0;
for (const [item, q] of needs) material += q * items[item].stdCost;
for (const [wc, h] of Object.entries(hoursByWc)) {
labour += h * wcs[wc].labourRate;
overhead += h * wcs[wc].overheadRate;
}
const total = material + labour + overhead;
return { material, labour, overhead, total, perUnit: total / outputQty };
}
export type StockLine = { item: string; need: number; onHand: number; reserved: number; available: number; short: number };
/** เทียบความต้องการกับ available = on-hand - reserved (ดูบทความ on-hand-reserved-available-stock) */
export function checkStock(needs: Needs, inv: Record<string, { onHand: number; reserved: number }>): StockLine[] {
return [...needs].map(([item, need]) => {
const { onHand, reserved } = inv[item] ?? { onHand: 0, reserved: 0 };
const available = onHand - reserved;
return { item, need, onHand, reserved, available, short: Math.max(0, need - available) };
});
}Actual output you can reproduce
The output below is the stdout of node demo.ts, run for real on 2026-11-21. It matches the file output.txt.
ข้อมูลสมมติทั้งหมด: ราคา ค่าแรง ค่าโสหุ้ย และเวลาไม่ใช่ตัวเลขจริงของใคร
=== 1) BOM: ตู้ควบคุม CAB-100 x 20 ===
cycle check (ข้อมูลจริง): ไม่พบวงวน
cycle check (ใส่ CAB-100 เข้า SUB-PWR): CAB-100 > SUB-PWR > CAB-100
explode ปฏิเสธ: BOM วนกลับ: CAB-100 > SUB-PWR > CAB-100
where-used WIRE-1.5:
WIRE-1.5 < SUB-PWR < CAB-100
WIRE-1.5 < SUB-CTL < CAB-100
item need onHand reserved available short
ENC-01 20.00 30 5 25 0.00
MCB-16A 60.00 90 10 80 0.00
PSU-24V 20.00 25 0 25 0.00
WIRE-1.5 216.00 150 20 130 86.00 << ขาด
TERM-BLK 408.00 600 250 350 58.00 << ขาด
PLC-01 20.00 25 8 17 3.00 << ขาด
DIN-RAIL 10.30 30 0 30 0.00
LBL-01 40.00 200 0 200 0.00
SCR-M4 504.00 2,000 300 1,700 0.00
=== 2) Routing ตู้ CAB-100 x 20 (1 รอบ) ===
op work centre setup h run h hours days
10 WC-CUT 0.50 6.00 6.50 0.81
20 WC-WIRE 0.25 50.00 50.25 3.14
30 WC-TEST 0.50 15.00 15.50 1.94
capacity hours per work centre: WC-CUT=6.50 WC-WIRE=50.25 WC-TEST=15.50
lead time: buy 21 d + work 5.89 d + queue 1.50 d = 28.39 working days
=== 3) ต้นทุนมาตรฐานตู้ CAB-100 (ราคาและอัตราสมมติ) ===
material 221,001.90 + labour 16,255.00 + overhead 5,190.00 = 242,446.90 THB (12,122.35 THB/ตู้)
ถ้าสั่งทีละ 1 ตู้ (setup ไม่ถูกหารกับ 20 ตู้):
material 11,050.10 + labour 1,074.00 + overhead 373.50 = 12,497.60 THB (12,497.60 THB/ตู้)
=== 4) สูตร: ซอส SAU-300 เป้าหมาย 500 kg ===
ปัดเป็น 1112 ขวด x 0.45 kg = 500.4 kg
yield 90% -> ต้องใส่วัตถุดิบ 556.00 kg ใน 2 รอบ รอบละ 278.00 kg (หม้อจุ 300)
ส่วนผสม (สูตรอ้างอิงเป็นสัดส่วน, ตัวคูณ 2.5273):
ING-CHILI 27.3 % 151.64 kg
ING-SUGAR 31.8 % 176.91 kg
ING-VINEGAR 18.2 % 101.09 kg
ING-GARLIC 9.1 % 50.55 kg
ING-SALT 2.7 % 15.16 kg
ING-WATER 10.9 % 60.65 kg
item need onHand reserved available short
ING-CHILI 151.64 150 30 120 31.64 << ขาด
ING-SUGAR 176.91 400 100 300 0.00
ING-VINEGAR 101.09 300 0 300 0.00
ING-GARLIC 50.55 120 0 120 0.00
ING-SALT 15.16 80 0 80 0.00
ING-WATER 60.65 100,000 0 100,000 0.00
PK-BTL 1,134.24 1,500 600 900 234.24 << ขาด
PK-CAP 1,134.24 3,000 0 3,000 0.00
PK-LBL 1,134.24 2,000 100 1,900 0.00
=== 5) Routing ซอส (หน่วยคือขวด) ===
op work centre setup h run h hours days
10 WC-COOK 1.00 6.00 7.00 0.88
20 WC-FILL 1.00 1.11 2.11 0.26
capacity hours per work centre: WC-COOK=7.00 WC-FILL=2.11
lead time: buy 7 d + work 1.14 d + queue 1.00 d = 9.14 working days
=== 6) ต้นทุนมาตรฐานซอส ===
material 23,512.33 + labour 1,822.40 + overhead 3,041.36 = 28,376.09 THB (25.52 THB/ขวด)- 20 cabinets need 216 meters of wire (not 200), because 8% scrap is compounded across the two sub-assemblies. But only 130 meters are available, so it is 86 meters short, even though the 150 on-hand looks like enough. 20 meters are already reserved.
- The PLC is short by 3 units, and in the made-up data it has a 21-day purchase lead time. So the cabinet lead time is 21 days waiting for the part, plus 5.89 days of work, plus 1.5 days of queue, for a total of 28.39 working days. The material, not the machine, sets the delivery date.
- The wiring bench is used for 50.25 hours, the heaviest step. To add capacity, add it here, not at the test bench.
- The average cost of 20 cabinets is 12,122.35 baht each, but ordering one at a time it is 12,497.60 baht. The difference comes from setup that is not spread over several units. A quote based on material cost alone would not show this.
- 500 kg of sauce is rounded up to 1,112 bottles (500 / 0.45 = 1,111.1), which gives 500.4 kg of sauce and needs 556 kg of ingredients because of the 90% yield. This is split into 2 batches of 278 kg, because the pot holds 300 kg. If you put in 500 kg without counting yield, you get 450 kg of sauce, or 1,000 bottles, which is 112 bottles short.
- Chili is short by 31.64 kg and bottles are short by 234.24 pieces (the decimals appear because 2% scrap is included before rounding to the purchase unit). The real purchase must be rounded up to whole bottles and to the supplier's pack size. The example does not do this part.
Tests: pin down numbers you can calculate by hand
calc.test.ts has 8 tests, all using node:test. Each test calculates the expected value by hand first, for example wire 20 x (6 x 1.08 + 4 x 1.08) = 216, and then checks it against the code's result. This catches the case where someone changes the scrap formula or swaps the order of bottle rounding and yield.
- explode: two levels with scrap, and sub-assembly scrap that compounds down to the children
- cycle: A contains B contains A, an item that contains itself, and the real data must have no cycle
- recipe: round bottles up, divide by yield, split into batches, the ingredient total equals the raw material put in, and a target that divides evenly into bottles is not rounded up
- routing: setup per order differs from setup per batch, and lead time
- cost: a small lot size costs more per piece, and shortage = need - (onHand - reserved)
What a real system needs in addition
- Versions and effective dates: BOMs and recipes change. Keep the old version so open production orders can still refer to it, and require an approver. Editing a version in place changes history by accident. ERPNext has several BOMs per item with active and default status. Odoo says BoM versions are visible once the PLM app is installed.
- Alternates: which other part can be used instead, under what conditions, who approves it, and how the cost differs. This example does not have it.
- Unit conversion: bought in 100-meter rolls, used in meters, sold in bottles, calculated in kilograms. You need a conversion factor that can be verified, and the density of liquids if ordered in liters.
- Lots and batches: food and drug work must be traceable, so you know which chili lot went into this sauce lot. This example counts only quantities and has no lot codes.
- Real work center capacity: the example uses fixed hours per day. Odoo has Capacity, Time efficiency, setup and cleanup time per work order, and alternative work centers.
- Stocked sub-assemblies versus make-to-order sub-assemblies: the Odoo documentation recommends planning sub-assemblies mainly with a reordering rule, and says a sub-assembly must be finished before the upper level starts, which affects lead time.
- Starting from Odoo MRP: in Odoo you must turn on Work Orders first before operations and work centers can be set up. Check the menus for the version you actually install.
Adapting this to other businesses
- A machine or custom electrical-cabinet factory: use a multi-level BOM with a routing to quote from real labor hours. A quote that adds setup will not lose money on small orders.
- A food and beverage plant: focus on the recipe, yield and packaging. If there is a scale or an automatic dosing system, the values from the recipe are reference values passed on to the control system. See the article plc-dosing-weighing-system.
- A print shop or packaging job: the BOM is materials and packaging, and the routing is the print, cut and fold steps, which have a high setup per run.
Master data for all three should be stored as tables with clear relationships (see the article crud-relational-data-model-business). If you need to import from existing Excel files, validate them and do a dry run that saves nothing first (see the article excel-csv-import-validation-dry-run), because old BOM files often have mixed units and duplicate codes.
Common mistakes
- Using one flat BOM for every model of a product, so a part shared in many places has to be edited in many places.
- Multiplying a recipe directly without counting yield and without rounding to bottles or batch size.
- Rounding bottles after dividing by yield instead of before, so the final output is not a whole number of packages.
- Forgetting sub-assembly scrap that compounds down to the children, or counting scrap twice.
- Not checking for a circular BOM at import, until the first day the BOM is exploded and the system hangs.
- Merging setup and run into one time, which makes the cost and lead time of small lots wrong.
- Using on-hand instead of available when comparing stock, so it looks sufficient even though it is already reserved.
- Editing the same BOM or recipe version in place without versions, so old production orders change their values.
- Treating labor and overhead rates as fixed, and not reviewing them when real costs change.
Checklist before loading data into a production system
- Agree on the definition of scrap (multiply by 1 + scrap, or divide by 1 - scrap) and write it in the master data document.
- For products you make yourself, separate sub-assemblies that are reused into their own BOMs.
- Run the circular-BOM check on all data before import.
- Every recipe must have a yield, a maximum batch size, and the packaging unit used for rounding.
- Every operation must have a work center, setup time, run time, and a clear basis: per unit, per batch or per order.
- Define the unit of measure and the unit conversion factor of every item.
- Define the version, effective date and approver of the BOM, recipe and routing.
- Try the material-shortage and cost report with one real sample order, and have people on the floor check the numbers.
- Check what happens when a version changes while a production order is still open.
Caution: this is a learning example, not production code. All data, prices, labor rates, overhead rates, times and lead times are made up. The example does not cover versions, alternates, unit conversion, lots, real machine capacity, full MRP planning or finite-capacity scheduling. Menu names and features of Odoo and ERPNext change by version, so check the documentation of the version you actually use. Work that involves machine control must be tested on real equipment.
References
- Odoo 18 — Bill of materials (ส่วนประกอบ ปริมาณ operation by-product รุ่นของ BoM) (accessed 2026-11-21)
- Odoo 18 — Work centers (capacity, time efficiency, setup/cleanup time, cost per hour) (accessed 2026-11-21)
- Odoo 18 — Multilevel BoMs / sub-assemblies (accessed 2026-11-21)
- ERPNext — Bill of Materials (ต้นไม้หลายระดับ operation scrap ต้นทุน) (accessed 2026-11-21)
- ERPNext — Operation (accessed 2026-11-21)
- ERPNext — Workstation (ต้นทุนดำเนินการ ชั่วโมงทำงาน กำลังผลิต) (accessed 2026-11-21)




