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

code

Text (unique)

The part number, like A348301

name

Text

Human-readable name, like “Aris Shaft”

type

Choice

One of: part, product, or commodity

category

FK → CategoryType

What group it belongs to (for example, “Plastic”, “EPS”, “Casting”)

description

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

part

FK → Part

Which part

supplier

FK → Supplier

Which supplier

share_of_business

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

parent

FK → Part

The assembly or finished product

child

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

code

Text

Supplier code like 602480 or MEGAKLC

name

Text

Company name like “Pune Polymer”

city

Text

Where they’re located

status

Choice

active or inactive

category

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

supplier

FK → Supplier

Which company they work for

user

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

name

Text (unique)

Machine-readable key like grossWt or existingPoPrice

display_name

Text

Human-readable like “Gross Weight” or “Existing PO Price”

description

Text

Optional extra context

Examples:

name

display_name

Used for

grossWt

Gross Wt

Weight in grams

existingRmRateKg

Existing RM Rate in Kg

Raw material price per kg

processCost

Process Cost in Rs

Manufacturing cost

existingPoPrice

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

head

FK → ValueHead

What type of value this is

value

Decimal

The actual number (for example, 42.5000)

unit

Text

Unit of measurement (Rs, gms, %, Rs/Kg)

type

Choice

price or weight

formula

Choice

How this value is calculated (see below)

expression

Text

Custom formula string (for custom formula type)

variables

JSON

References to other Value IDs used in the formula

is_current_price

Boolean

Is this the active/current price?

content_type + object_id

Generic FK

Points to a PartSupplier (or Bom)

Formula types:

Formula

What it does

Example

value

Just stores the raw number

Gross Weight = 45.5 gms

sum

Adds up other values

Total BOP = BOP Cost + BOP Handling

product

Multiplies values

MB Cost = MB Rate x MB %

division

Divides values

Process Cost = MHR / Parts per Shift

custom

Evaluates an expression

(Q*(1-T)+U)*L/1000

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

name

Text

Template name like part_plastic_supplier

content_type + object_id

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

template

FK → ViewTemplate

Which template

sequence

Float

Display order (0, 1, 2…)

value

FK → Value

Which value to show

styles

JSON

Optional CSS/display styles

Master Data#

CategoryType#

What is it? A category label for organizing Parts and Suppliers.

Field

Type

What it means

name

Text

Category name like “Plastic”, “EPS”, “CF”

parent

Text

What it categorizes: part or supplier

display_name

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

supplier

FK → Supplier

Who you’re buying from

expected_delivery_date

Date

When you need it

status

Choice

draftpending_approvalapprovedacceptedclosed

part_price

Decimal

Sum of all line items (auto-calculated)

gst_percentage

Decimal

Tax rate

shipping_charges

Decimal

Delivery cost

total_price_with_gst

Decimal

Final total (auto-calculated)

OrderItem#

What is it? A line item in a PurchaseOrder.

Field

Type

What it means

purchase_order

FK → PurchaseOrder

Which order

part

FK → Part

What you’re buying

quantity

Decimal

How many

unit_price

Decimal

Price per unit

discount

Decimal

Any discount

Negotiation#

What is it? A counter-offer on a PurchaseOrder.

Field

Type

What it means

purchase_order

FK → PurchaseOrder

Which order

order_item

FK → OrderItem

Which line item (optional)

quantity / unit_price / discount

Decimals

The counter-offer numbers

status

Choice

raisedaccepted or rejected

offered_by

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

field_name

Text

The action: create, edit, delete, or a specific field

content_type

FK → ContentType

What entity type (Part, PurchaseOrder, etc.)

matrix

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

content_type + object_id

Generic FK

What’s being changed

field_name

Text

What action

new_value

JSON

The proposed changes

status

Choice

pendingapproved or rejected

raised_by

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

change_request

FK → ChangeRequest

Which request

level

Integer

Which approval level (1, 2, 3…)

status

Choice

pendingapproved or rejected

action_by

FK → User

Who acted