Models & Database#
This page explains every model (database table) in the system. Think of each model as a spreadsheet — it has columns (fields) and rows (records).
Part Ecosystem#
Part#
What is it? Anything physical that Atomberg buys, makes, or sells.
Think of it as: A catalog entry. “M5 Screw”, “Aris Shaft”, “Renesa Fan”.
Field |
Type |
What it means |
|---|---|---|
|
Text (unique) |
The part number, like |
|
Text |
Human-readable name, like “Aris Shaft” |
|
Choice |
One of: |
|
FK → CategoryType |
What group it belongs to (for example, “Plastic”, “EPS”, “Casting”) |
|
Text |
Extra info (often stores raw material metadata as JSON) |
The three types:
Part — Raw materials and components (screws, plastic parts, shafts)
Product — Finished goods (a complete fan)
Commodity — General materials (steel, copper, adhesive)
All three live in the same table — the type field tells them apart.
PartSupplier#
What is it? The link between a Part and a Supplier.
Think of it as: “This supplier sells this part.”
Field |
Type |
What it means |
|---|---|---|
|
FK → Part |
Which part |
|
FK → Supplier |
Which supplier |
|
Decimal |
What % of this part we buy from them (for example, 0.60 = 60%) |
Why it matters: All pricing data (Values) attaches to PartSupplier, not to Part alone. That’s because the same part costs different amounts from different suppliers.
Bom (Bill of Materials)#
What is it? A parent-child relationship between parts.
Think of it as: “To make Part A, you need Part B and Part C.”
Field |
Type |
What it means |
|---|---|---|
|
FK → Part |
The assembly or finished product |
|
FK → Part |
A component that goes into it |
Example: A fan motor (parent) contains a shaft, bearings, and windings (children).
Supplier Ecosystem#
Supplier#
What is it? A company that sells parts to Atomberg.
Field |
Type |
What it means |
|---|---|---|
|
Text |
Supplier code like |
|
Text |
Company name like “Pune Polymer” |
|
Text |
Where they’re located |
|
Choice |
|
|
FK → CategoryType |
Optional grouping |
SupplierUser#
What is it? A login account for a supplier’s employee to access the vendor portal.
Field |
Type |
What it means |
|---|---|---|
|
FK → Supplier |
Which company they work for |
|
FK → User |
Their login account |
Pricing & Values#
ValueHead#
What is it? A definition of a type of measurement.
Think of it as: Column headers in a pricing spreadsheet — “Gross Weight”, “RM Cost”, “Freight Cost”.
Field |
Type |
What it means |
|---|---|---|
|
Text (unique) |
Machine-readable key like |
|
Text |
Human-readable like “Gross Weight” or “Existing PO Price” |
|
Text |
Optional extra context |
Examples:
name |
display_name |
Used for |
|---|---|---|
|
Gross Wt |
Weight in grams |
|
Existing RM Rate in Kg |
Raw material price per kg |
|
Process Cost in Rs |
Manufacturing cost |
|
Existing PO Price |
Final purchase order price |
Value#
What is it? An actual number — a price, a weight, a percentage — attached to a PartSupplier.
Think of it as: A cell in a pricing spreadsheet.
Field |
Type |
What it means |
|---|---|---|
|
FK → ValueHead |
What type of value this is |
|
Decimal |
The actual number (for example, |
|
Text |
Unit of measurement ( |
|
Choice |
|
|
Choice |
How this value is calculated (see below) |
|
Text |
Custom formula string (for |
|
JSON |
References to other Value IDs used in the formula |
|
Boolean |
Is this the active/current price? |
|
Generic FK |
Points to a PartSupplier (or Bom) |
Formula types:
Formula |
What it does |
Example |
|---|---|---|
|
Just stores the raw number |
Gross Weight = 45.5 gms |
|
Adds up other values |
Total BOP = BOP Cost + BOP Handling |
|
Multiplies values |
MB Cost = MB Rate x MB % |
|
Divides values |
Process Cost = MHR / Parts per Shift |
|
Evaluates an expression |
|
How is_current_price works: Only one Value per PartSupplier per ValueHead can be the “current” price. When a new price is recorded, the old one’s is_current_price flips to false. This gives you a full price history.
View Templates#
ViewTemplate#
What is it? A layout definition for displaying pricing data.
Think of it as: A template that says “show these values in this order for this PartSupplier.”
Field |
Type |
What it means |
|---|---|---|
|
Text |
Template name like |
|
Generic FK |
Which PartSupplier this is for |
ViewTemplateValue#
What is it? A single entry in a ViewTemplate — “show this value at position X.”
Field |
Type |
What it means |
|---|---|---|
|
FK → ViewTemplate |
Which template |
|
Float |
Display order (0, 1, 2…) |
|
FK → Value |
Which value to show |
|
JSON |
Optional CSS/display styles |
Master Data#
CategoryType#
What is it? A category label for organizing Parts and Suppliers.
Field |
Type |
What it means |
|---|---|---|
|
Text |
Category name like “Plastic”, “EPS”, “CF” |
|
Text |
What it categorizes: |
|
Text |
Human-friendly name |
Examples from the database:
name |
parent |
Used for |
|---|---|---|
Plastic |
part |
Injection-molded parts |
EPS |
part |
Expanded polystyrene foam parts |
CF |
part |
Ceiling fan components |
Casting |
part |
Die-cast aluminum parts |
Tape |
part |
BOPP adhesive tapes |
RSC Box |
part |
Corrugated boxes |
Purchase Orders#
PurchaseOrder#
What is it? An order sent to a supplier to buy parts.
Field |
Type |
What it means |
|---|---|---|
|
FK → Supplier |
Who you’re buying from |
|
Date |
When you need it |
|
Choice |
|
|
Decimal |
Sum of all line items (auto-calculated) |
|
Decimal |
Tax rate |
|
Decimal |
Delivery cost |
|
Decimal |
Final total (auto-calculated) |
OrderItem#
What is it? A line item in a PurchaseOrder.
Field |
Type |
What it means |
|---|---|---|
|
FK → PurchaseOrder |
Which order |
|
FK → Part |
What you’re buying |
|
Decimal |
How many |
|
Decimal |
Price per unit |
|
Decimal |
Any discount |
Negotiation#
What is it? A counter-offer on a PurchaseOrder.
Field |
Type |
What it means |
|---|---|---|
|
FK → PurchaseOrder |
Which order |
|
FK → OrderItem |
Which line item (optional) |
|
Decimals |
The counter-offer numbers |
|
Choice |
|
|
FK → User |
Who made the offer |
Approval System#
ChangeMatrix#
What is it? A rule that says “when someone tries to do X, these people need to approve it.”
Field |
Type |
What it means |
|---|---|---|
|
Text |
The action: |
|
FK → ContentType |
What entity type (Part, PurchaseOrder, etc.) |
|
JSON |
Who needs to approve, at each level |
Example matrix:
{
"level_1": { "role": ["procurement_team"], "user": [] },
"level_2": { "role": ["finance_manager"], "user": ["ceo@atomberg.com"] }
}
This means: first procurement team approves, then finance manager or CEO.
ChangeRequest#
What is it? A pending change waiting for approval.
Field |
Type |
What it means |
|---|---|---|
|
Generic FK |
What’s being changed |
|
Text |
What action |
|
JSON |
The proposed changes |
|
Choice |
|
|
FK → User |
Who requested the change |
Approval#
What is it? A single approval task — one person’s decision on a ChangeRequest.
Field |
Type |
What it means |
|---|---|---|
|
FK → ChangeRequest |
Which request |
|
Integer |
Which approval level (1, 2, 3…) |
|
Choice |
|
|
FK → User |
Who acted |