-
Notifications
You must be signed in to change notification settings - Fork 2
Transport Consolidation Core Logic
The validate() method runs these checks in order:
Validates consolidation eligibility:
Source: Transport Job doctype
- Requires at least one Transport Job in
transport_jobschild table - All Transport Jobs must be submitted (
docstatus = 1) - All jobs must have the same
load_type(from Transport Job) - All jobs must belong to the same
company(from Transport Job) - Warns if jobs have different
vehicle_typevalues
Source: Load Type doctype
- Checks
can_be_consolidated(Load Type field) - Enforces
max_consolidation_jobsif set (Load Type field)
Auto-determines consolidation type from Transport Leg addresses:
Source: Transport Leg doctype
- Reads
pick_addressanddrop_addressfrom all Transport Legs linked to Transport Jobs - Logic:
- Both: 1 pick address, 1 drop address →
"Both" - Pick: 1 pick address, multiple drop addresses →
"Pick" - Drop: Multiple pick addresses, 1 drop address →
"Drop" - Route: Multiple pick and drop addresses →
"Route"
- Both: 1 pick address, 1 drop address →
Calculates aggregated weight and volume:
Source: Transport Job Package child table
- Iterates through all
packagesin each Transport Job - Sums
weightandvolumefrom each package - Sets
total_weightandtotal_volumeon the consolidation
Validates against Load Type capacity limits:
Source: Load Type doctype
- Compares
total_weightagainstmax_weight(if set) - Compares
total_volumeagainstmax_volume(if set) - Throws error if limits are exceeded
Validates accounting fields:
Source: Company, Cost Center, Profit Center, Branch doctypes
- Ensures
companyis set (required) - Validates
cost_centerbelongs to the company (if Cost Center hascompanyfield) - Validates
profit_centerbelongs to the company (if Profit Center hascompanyfield) - Validates
branchbelongs to the company (if Branch hascompanyfield)
- Field:
transport_jobs(Table) - Contains:
transport_job(Link to Transport Job),customer,weight,volume,pick_address,drop_address
- Relationship: One-to-many via child table
- Fields used:
-
load_type→ validates consolidation eligibility -
company→ must match across all jobs -
vehicle_type→ warning if different -
docstatus→ must be 1 (submitted) -
packages→ for weight/volume calculation
-
- Relationship: Indirect (via Transport Job)
- Fields used:
-
pick_address→ determines consolidation type -
drop_address→ determines consolidation type -
pick_consolidated/drop_consolidated→ set when creating Run Sheet
-
- Relationship: Via Transport Job's
load_type - Fields used:
-
can_be_consolidated(Check) → must be True -
max_consolidation_jobs(Integer, optional) → max jobs allowed -
max_weight(Float, optional) → weight capacity limit -
max_volume(Float, optional) → volume capacity limit
-
- Relationship: Via Transport Job's
packageschild table - Fields used:
-
weight→ summed fortotal_weight -
volume→ summed fortotal_volume
-
- Relationship: One-to-one via
run_sheetfield - Created by:
create_run_sheet_from_consolidation()function
Creates a Run Sheet from the consolidation:
- Validates consolidation has jobs
- Checks if Run Sheet already exists
- Collects all Transport Legs from all Transport Jobs
- Determines consolidation pattern (Pick/Drop/Both/Route)
- Creates Run Sheet with appropriate leg routing
- Sets
pick_consolidated/drop_consolidatedflags on Transport Legs - Links Run Sheet back to consolidation
Finds jobs eligible for consolidation:
- Filters by
docstatus = 1(submitted) - Filters by
company(if provided) - Checks Load Type's
can_be_consolidatedflag - Groups jobs by pick/drop addresses
- Returns jobs with consolidation type suggestions
Adds selected jobs to an existing consolidation:
- Validates each job is submitted
- Checks job has Transport Legs
- Prevents duplicate jobs
- Adds jobs to
transport_jobschild table
-
refresh(): Adds "Fetch Jobs" and "Create Run Sheet" buttons -
fetch_consolidatable_jobs(): Calls backend API to get eligible jobs -
show_jobs_dialog(): Displays dialog with selectable jobs -
add_jobs_to_consolidation(): Adds selected jobs via API -
create_run_sheet_from_consolidation(): Creates Run Sheet via API
Transport Job (submitted)
↓
Transport Leg (pick_address, drop_address)
↓
Transport Consolidation (validates & groups)
↓
Load Type (validates can_be_consolidated, max limits)
↓
Transport Job Package (weight, volume)
↓
Run Sheet (created with routing logic)
| Validation | Source Doctype | Field/Logic | Error Type |
|---|---|---|---|
| At least 1 job | Transport Consolidation |
transport_jobs table |
Required |
| Jobs must be submitted | Transport Job | docstatus = 1 |
Error |
| Same load type | Transport Job | load_type |
Error |
| Same company | Transport Job | company |
Error |
| Load type allows consolidation | Load Type | can_be_consolidated = True |
Error |
| Max jobs limit | Load Type | max_consolidation_jobs |
Error |
| Weight capacity | Load Type |
max_weight vs total_weight
|
Error |
| Volume capacity | Load Type |
max_volume vs total_volume
|
Error |
| Company required | Transport Consolidation |
company field |
Error |
| Account fields belong to company | Cost/Profit Center, Branch |
company field |
Error |
This structure ensures consolidations are valid, respect capacity limits, and maintain data integrity across related doctypes.
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