-
Notifications
You must be signed in to change notification settings - Fork 2
Design: Global Measurements
This document defines a global, uniform implementation of measurements across the logistics module: a single set of dimension, volume, weight, and chargeable-weight fields, with base UOMs for internal conversion and automatic conversion when users change UOMs on transaction documents.
- Uniform field set: Same measurement field names and semantics everywhere (packages, order items, shipments, etc.).
- Base UOMs: Single base UOM for dimension, volume, and weight; all conversions can be expressed via base when needed.
- Conversion on UOM change: When a user changes the default/display UOM on a transaction (e.g. dimension UOM from CM to M), existing numeric values are converted so that physical quantity is preserved and only the unit of measure changes.
Every doctype that carries measurements (e.g. package lines, order items, shipment lines) should expose the following standard fields.
| Field | Type | Description |
|---|---|---|
length |
Float | Length in dimension_uom
|
width |
Float | Width in dimension_uom
|
height |
Float | Height in dimension_uom
|
dimension_uom |
Link (UOM) | Unit for length, width, height (single UOM for all three axes) |
Note: Using one dimension_uom for all three axes is the standard; optional per-axis UOMs (length_uom, width_uom, height_uom) can be added later if required.
| Field | Type | Description |
|---|---|---|
volume |
Float | Volume in volume_uom (can be auto-calculated from dimensions) |
volume_uom |
Link (UOM) | Unit for volume (e.g. CBM, CFT) |
| Field | Type | Description |
|---|---|---|
weight |
Float | Actual weight in weight_uom
|
weight_uom |
Link (UOM) | Unit for weight (e.g. KG, LB) |
| Field | Type | Description |
|---|---|---|
chargeable_weight |
Float | Chargeable weight in chargeable_weight_uom
|
chargeable_weight_uom |
Link (UOM) | Unit for chargeable weight (e.g. KG) |
Chargeable weight is typically derived (e.g. max of actual weight and volume weight) but may be overridden; when present it should use this UOM.
For reporting or aggregation in a single unit, the system may maintain base values. These are optional in the schema and can be computed on the fly if preferred.
| Concept | Purpose |
|---|---|
| Base dimension UOM | All dimension conversions can go through this (e.g. CM or M). |
| Base volume UOM | All volume conversions can go through this (e.g. CBM). |
| Base weight UOM | All weight (and chargeable weight) conversions can go through this (e.g. KG). |
Stored base fields (e.g. length_base, volume_base, weight_base) are not required on every child doctype if we always convert from display UOM to base when needed (e.g. in reports or roll-ups). The design only requires that base UOMs are defined in settings and used by conversion APIs.
- Logistics Settings (single doctype) is the preferred place for base UOMs and default display UOMs used across the whole logistics module.
- Existing module-specific settings (Warehouse Settings, Transport Capacity Settings, Air/Sea Freight Settings) can reference these defaults or override them per sub-module if needed.
Proposed fields in Logistics Settings (or a dedicated Logistics Measurement Settings single doc):
| Field | Type | Description |
|---|---|---|
base_dimension_uom |
Link (UOM) | Base UOM for length/width/height (e.g. CM). All dimension conversions use this as pivot. |
base_volume_uom |
Link (UOM) | Base UOM for volume (e.g. CBM). |
base_weight_uom |
Link (UOM) | Base UOM for weight and chargeable weight (e.g. KG). |
default_dimension_uom |
Link (UOM) | Default for dimension_uom on new transaction lines. |
default_volume_uom |
Link (UOM) | Default for volume_uom on new transaction lines. |
default_weight_uom |
Link (UOM) | Default for weight_uom on new transaction lines. |
default_chargeable_weight_uom |
Link (UOM) | Default for chargeable_weight_uom. |
Default UOMs are used when creating new rows; base UOMs are used for conversion logic and reporting.
-
User UOM → Base:
value_base = value_display × factor(display_uom → base_uom) -
Base → User UOM:
value_display = value_base × factor(base_uom → display_uom) -
When user changes UOM on a doc:
Preserve physical quantity:
value_new = value_old × factor(old_uom → new_uom)
Then setdimension_uom/volume_uom/weight_uom/chargeable_weight_uomto the new selection.
When the user changes a UOM dropdown on a transaction document (e.g. dimension_uom from CM to M):
- For each numeric field that uses that UOM (e.g. length, width, height for
dimension_uom), convert the value so that the physical quantity is unchanged:new_value = old_value × conversion_factor(old_uom → new_uom)
- Set the UOM field to the new selection.
- If volume is derived from dimensions, recalculate volume (in the new volume UOM if needed).
- If chargeable weight is derived from volume/weight, recalculate it (in the new chargeable_weight_uom if needed).
Same logic applies when changing volume_uom, weight_uom, or chargeable_weight_uom: convert the corresponding numeric field(s) so that physical quantity is preserved.
-
Client (JS): On change of
dimension_uom,volume_uom,weight_uom,chargeable_weight_uomin forms (e.g. in table rows), call a shared helper that:- Reads current numeric values and old UOM (from field or from last known value).
- Gets conversion factor (via server or a small client-side factor table for common UOMs).
- Writes back converted values and new UOM.
- Server (Python): On validate (or before_save), if UOM fields were changed compared to DB, perform the same conversion so that stored values are consistent and physical quantity is preserved. This avoids relying solely on client-side logic.
- New row: No “old” UOM; use default UOMs from Logistics Settings (or module settings).
- Missing conversion: If a conversion factor is not defined (Dimension Volume UOM Conversion for dimension→volume; UOM Conversion Factor or logistics utility for weight/volume/dimension), either block the UOM change with a clear message or keep the previous UOM and warn.
A single module should provide all conversion helpers so that base UOMs and conversion tables are used consistently.
Suggested location: logistics/utils/measurements.py (or extend existing logistics/transport/capacity/uom_conversion.py and logistics/warehousing/utils/volume_conversion.py behind a single facade).
-
get_base_uoms()
Returns{ "dimension": base_dimension_uom, "volume": base_volume_uom, "weight": base_weight_uom }from Logistics Settings. -
get_default_uoms(company=None)
Returns default dimension, volume, weight, chargeable_weight UOMs (from Logistics Settings and optionally company-specific overrides). -
convert_dimension(value, from_uom, to_uom, company=None)
Convert a single dimension value (length/width/height). Use base UOM as pivot if needed. -
convert_volume(value, from_uom, to_uom, company=None)
Convert volume. Use existing Dimension Volume UOM Conversion where applicable; otherwise linear dimension factors cubed or UOM Conversion Factor. -
convert_weight(value, from_uom, to_uom, company=None)
Convert weight (and chargeable weight). Use UOM Conversion Factor and base weight UOM. -
calculate_volume_from_dimensions(length, width, height, dimension_uom, volume_uom, company=None)
Already exists in warehousing/transport; ensure it uses base UOMs and the central conversion API where appropriate. -
convert_measurements_to_uom(doc, uom_type, new_uom)
Given a doc (or dict) with measurement fields and a UOM type (dimension|volume|weight|chargeable_weight), convert the relevant numeric fields tonew_uomand set the corresponding UOM field. Used by server-side validation and by client-triggered logic.
All conversion factors must be defined in the database. The logistics module does not use any hardcoded UOM conversion fallbacks. If a conversion is missing, the API raises a clear error and the user must add the corresponding record.
- Dimension ↔ dimension: UOM Conversion Factor (Setup). No hardcoded factors; missing conversions raise an error.
- Dimension (cubic) ↔ volume: Dimension Volume UOM Conversion (Warehousing). No hardcoded factors; volume-from-dimensions requires this table (and the Warehousing module) or raises.
- Volume ↔ volume: UOM Conversion Factor (Setup). No hardcoded factors.
- Weight ↔ weight: UOM Conversion Factor (Setup). No hardcoded factors.
All conversions should be expressible via base UOM (e.g. display → base → display) so that only one set of factors (each UOM ↔ base) is required if desired. Implementations must not fall back to literal constants or in-code factor tables.
- Create a Custom Field Group (e.g. “Logistics Measurements”) containing the full set of fields:
- length, width, height, dimension_uom
- volume, volume_uom
- weight, weight_uom
- chargeable_weight, chargeable_weight_uom
- Add this field group to every child doctype that needs measurements (e.g. Transport Order Package, Transport Job Package, Inbound Order Item, VAS Order Item, Air Booking Packages, Sea Booking Packages, etc.).
- Ensures one definition, one place to update labels/options, and consistent behaviour.
- Add the same fields explicitly to each doctype JSON. More duplication but no dependency on custom field group.
- Doctypes that already have a subset (e.g. only
dimension_uomand novolume_uom) should be extended to the full set; existing fields can be renamed or retained with mapping to the standard names in the conversion API. - Existing behaviour (e.g. volume calculated from dimensions, chargeable weight from weight/volume) should remain; the new layer only unifies field names and UOM handling.
- Transport: Transport Order Package, Transport Job Package
- Warehousing: Inbound Order Item, Release Order Item, Transfer Order Item, VAS Order Item, Stocktake Order Item, Warehouse Job Item, Warehouse Item, etc.
- Air: Air Booking Packages, consolidation/shipment package tables
- Sea: Sea Booking Packages, Sea Consolidation Packages, etc.
- Pricing/Charges: Any child that has weight/volume (e.g. Transport Job Charges, Sales Quote lines) should use the same UOM and base UOM rules.
Each of these should eventually expose the uniform fields and use the central conversion API when UOMs change or when aggregating (e.g. total weight in base UOM).
| Item | Decision |
|---|---|
| Uniform fields | length, width, height, dimension_uom; volume, volume_uom; weight, weight_uom; chargeable_weight, chargeable_weight_uom |
| Base UOMs | Stored in Logistics Settings: base_dimension_uom, base_volume_uom, base_weight_uom; used as pivot for all conversions |
| Default UOMs | default_dimension_uom, default_volume_uom, default_weight_uom, default_chargeable_weight_uom in Logistics Settings (or overridden per module) |
| On UOM change | Convert numeric values so physical quantity is preserved; implement on client and server |
| Conversion API | Central module (e.g. logistics/utils/measurements.py) with get_base_uoms, get_default_uoms, convert_* , convert_measurements_to_uom |
| Field reuse | Custom Field Group “Logistics Measurements” applied to all measurement-bearing child doctypes |
| No hardcoded fallbacks | All UOM conversion factors must come from UOM Conversion Factor (Setup) and Dimension Volume UOM Conversion (Warehousing). Missing conversions raise an error; no in-code factor tables or literal constants. |
This design yields a single, consistent way to handle dimensions, volume, weight, and chargeable weight across the logistics module, with clear base UOMs and predictable conversion when users change UOMs on transaction documents.
Getting Started
- Getting Started
- Recent Platform Updates
- CargoNext v1 — Release Notes
- CargoNext v1 — Astraea Press Release
- Document Management
- Milestone Tracking
- Customer Portal
Setup and Settings
- Logistics Settings
- Credit Management
- Default Details and Relationships
- Sea Freight Settings
- Air Freight Settings
- Transport Settings
- Warehouse Settings
- Customs Settings
Sea Freight
- Sea Freight Module
- Sea Booking
- Sea Shipment
- Sea Consolidation
- Master Bill
- Shipper
- Consignee
- Container Type
- Container Management
Air Freight
Transport
- Transport Module
- Transport Order
- Transport Job
- Transport Consolidation
- Transport Leg
- Transport Plan
- Run Sheet
- Proof of Delivery
- Transport Template
- Load Type
- Transport Order — Inter-module Field Copy
Customs
Warehousing
- Warehousing Module
- Inbound Order
- Release Order
- Transfer Order
- VAS Order
- Stocktake Order
- Warehouse Job
- Warehouse Contract
- Gate Pass
- Periodic Billing
- Storage Location
- Handling Unit Type
Pricing Center
- Sales Quote
- Sales Quote — Separate Billings and Internal Job
- Change Request
- Sales Quote – Calculation Method
Job Management
- Job Management Module
- Revenue Recognition Policy — Accounts, Dates, and Charges
- Proforma GL Entries
- WIP and Accrual Reversal on Invoicing
Sustainability
Intercompany
Special Projects
Pages
Features
Reports
Glossary