Skip to content

Transactional Testing Report

Agilasoft Cloud Technologies edited this page Feb 23, 2026 · 2 revisions

Logistics App – Transactional Testing Report

Date: February 23, 2026
Scope: All modules – unit tests, transactional flows, conversions, validations


1. Executive Summary

Transactional testing was performed across all logistics modules. Unit tests pass for all modules. Transactional flow tests (conversion flows) revealed several validation gaps, missing default propagation, and areas requiring additional controls.

Category Status
Unit tests (Air Freight) ✅ Pass
Unit tests (Sea Freight) ✅ Pass
Unit tests (Transport) ✅ Pass
Unit tests (Warehousing) ✅ Pass
Unit tests (Pricing Center) ✅ Pass
Unit tests (Special Projects) ✅ Pass
Unit tests (Job Management) ✅ Pass
Transactional flows ⚠️ Partial – see Section 3

2. Modules and Test Coverage

2.1 Air Freight

  • DocTypes: Air Shipment, Air Booking, Air Consolidation, Air Shipment Charges, Air Shipment Packages, Air Shipment Routing Leg, Master Air Waybill
  • Unit tests: test_air_booking.py, test_air_shipment.py, test_air_consolidation.py, test_master_air_waybill.py, test_air_freight_rate.py, test_helpers.py, test_airline.py, test_air_freight_settings.py
  • Flows tested: Air Booking → Air Shipment (convert_to_shipment), Sales Quote → Air Shipment

2.2 Sea Freight

  • DocTypes: Sea Shipment, Sea Booking, Sea Consolidation, Sea Shipment Charges, Sea Shipment Packages, Sea Shipment Routing Leg
  • Unit tests: test_sea_booking.py, test_sea_shipment.py
  • Flows tested: Sea Booking → Sea Shipment (convert_to_shipment)

2.3 Transport

  • DocTypes: Transport Job, Transport Order, Transport Leg, Transport Consolidation, Run Sheet, Transport Vehicle, Transport Company, Transport Terminal
  • Unit tests: test_transport_job.py, test_transport_order.py, test_transport_leg.py, test_transport_consolidation.py, test_run_sheet.py, test_transport_vehicle.py, test_transport_terminal.py, etc.
  • Flows tested: Transport Order → Transport Job (action_create_transport_job), Air/Sea Shipment → Transport Order

2.4 Warehousing

  • DocTypes: Warehouse Job, Inbound Order, Release Order, Transfer Order, VAS Order, Stocktake Order, Warehouse Contract
  • Unit tests: test_inbound_order.py, test_warehouse_contract.py, test_gate_pass.py
  • Flows tested: Inbound Order → Warehouse Job (make_warehouse_job), Air/Sea Shipment → Inbound Order, Transport Job → Inbound Order

2.5 Customs

  • DocTypes: Declaration, Declaration Order, Declaration Commodity
  • Flows: Declaration Order → Declaration, Sales Quote → Declaration
  • Unit tests: None found in logistics app

2.6 Pricing Center

  • DocTypes: Sales Quote, One Off Quote, Sales Quote Air Freight, Sales Quote Sea Freight, Sales Quote Transport, Sales Quote Warehouse
  • Unit tests: test_sales_quote.py, test_one_off_quote.py, test_tariff.py, test_sales_quote_weight_break.py, test_sales_quote_qty_break.py
  • Flows tested: Sales Quote → Air/Sea Shipment, Transport Order, Air/Sea Booking, Warehouse Contract, Declaration

2.7 Special Projects

  • DocTypes: Special Project, Special Project Request, Special Project Resource, Special Project Activity, Special Project Job, Special Project Delivery, Special Project Billing
  • Unit tests: test_special_project.py

2.8 Job Management

  • DocTypes: Job Costing Number, Recognition Engine
  • Unit tests: test_recognition_engine.py, test_job_costing_number.py

3. Transactional Flow Test Results

Transactional flow tests were executed via logistics.tests.transactional_flows_test.run(). Results:

Flow Status Error / Notes
Air Booking → Air Shipment ⚠️ Validation Origin/destination must be valid UNLOCO codes (e.g. USLAX, USJFK), not IATA (LAX, JFK). Validation correctly rejects invalid links.
Sales Quote → Air Shipment ⚠️ Validation Same UNLOCO requirement for origin_port and destination_port in Sales Quote Air Freight child table.
Air Shipment → Transport Order ⚠️ Functional create_transport_order_from_air_shipment succeeds but Transport Order requires branch, cost_center, profit_center. When Air Shipment has none, order insert fails.
Transport Order → Transport Job ⚠️ Validation Transport Order requires branch, cost_center, profit_center. No defaults from company when missing.
Air Shipment → Inbound Order ⚠️ Validation Depends on Air Shipment creation (UNLOCO). Flow logic works when source is valid.
Inbound Order → Warehouse Job ⚠️ Validation Item in Inbound Order items must exist in Item master. Validation correctly rejects non-existent items.

4. Functional Errors

4.1 Transport Order from Air/Sea Shipment – Missing Defaults

Location: logistics.utils.module_integration.create_transport_order_from_air_shipment, create_transport_order_from_sea_shipment

Issue: When the source Air/Sea Shipment has no branch, cost_center, or profit_center, the created Transport Order leaves these fields empty. Transport Order validation requires them, causing insert to fail.

Recommendation: Propagate company defaults when source fields are empty:

defaults = frappe.defaults.get_defaults()
order.branch = getattr(shipment, "branch", None) or defaults.get("branch")
order.cost_center = getattr(shipment, "cost_center", None) or defaults.get("cost_center")
order.profit_center = getattr(shipment, "profit_center", None) or defaults.get("profit_center")

4.2 Transport Order – action_create_transport_job

Location: logistics.transport.doctype.transport_order.transport_order.action_create_transport_job

Issue: Transport Order must be submitted before creating Transport Job. Return format may vary (single job vs list). Callers should handle both transport_job and transport_jobs keys.

Recommendation: Document expected return structure and ensure consistent format.

4.3 Inbound Order – make_warehouse_job

Location: logistics.warehousing.doctype.inbound_order.inbound_order.make_warehouse_job

Issue: Uses get_mapped_doc; requires valid Item master records for all items. Contract validation (cancelled contract) is correctly enforced.

Recommendation: Add pre-check for Item existence before mapping, with clear error message.


5. Validation Errors and Controls

5.1 Air/Sea – Port Fields

  • Field: origin_port, destination_port (Link to UNLOCO)
  • Behavior: Correctly validates that values exist in UNLOCO. IATA codes (LAX, JFK) are rejected; UNLOCO codes (USLAX, USJFK) are required.
  • Recommendation: Consider adding a fetch/autocomplete from IATA to UNLOCO for better UX, or document UNLOCO requirement in field description.

5.2 Transport Order – branch, cost_center, profit_center

  • Behavior: Required fields; no automatic defaults when creating from Shipment.
  • Recommendation: Add company-level defaults in create_transport_order_from_* when source has none.

5.3 Inbound Order – Item

  • Behavior: Item in child table must exist in Item master.
  • Recommendation: Add validate check with user-friendly message: "Item {item} does not exist. Please create it in Item master first."

5.4 Air Booking – ETD/ETA

  • Behavior: ETD must not be after ETA. Correctly enforced.
  • Status: ✅ Working as designed.

5.5 One-Off Quote – Double Conversion

  • Behavior: Status set to "Converted" and converted_to_doc populated. Prevents multiple conversions.
  • Status: ✅ Working as designed.

5.6 Air/Sea Booking – 1:1 Shipment

  • Behavior: One Air/Sea Booking can have only one Shipment. Correctly enforced in convert_to_shipment.
  • Status: ✅ Working as designed.

6. Missing Controls and Recommendations

6.1 Pre-Conversion Validation

DocType Recommendation
Sales Quote → Air Shipment Add validate_before_conversion-style check for required UNLOCO, shipper, consignee before conversion.
Transport Order → Transport Job Ensure Transport Order is submitted before job creation; add explicit status check.
Inbound Order → Warehouse Job Add check for cancelled contract before mapping. (Already present ✅)

6.2 Data Propagation

Source → Target Missing Propagation
Air Shipment → Transport Order branch, cost_center, profit_center when empty
Sea Shipment → Transport Order Same as above
Transport Job → Inbound Order planned_date/due_date from scheduled_date (present in propagate_from_transport_job)

6.3 Test Coverage Gaps

Area Recommendation
Customs Add unit tests for Declaration, Declaration Order, and create_declaration_from_* flows.
Sales Quote conversions Add integration tests for Sales Quote → Air/Sea Shipment, Transport Order, Declaration.
Document management Add tests for populate_documents_from_template, get_document_alerts.
Job closure / Recognition Engine Expand tests for job status transitions (Closed, Completed, Cancelled).

6.4 Empty Test Classes

Several doctype test files contain only pass:

  • TestTransportOrder
  • TestSalesQuote
  • TestAirBooking (doctype-level; module-level has real tests)

Recommendation: Either add meaningful tests or remove empty classes to avoid false coverage.


7. Transactional Flow Summary

Quote → Shipment/Order:
  Sales Quote ─┬→ Air Shipment (create_air_shipment_from_sales_quote)
               ├→ Sea Shipment (create_sea_shipment_from_sales_quote)
               ├→ Transport Order (create_transport_order_from_sales_quote)
               ├→ Air Booking (create_air_booking_from_sales_quote)
               ├→ Sea Booking (create_sea_booking_from_sales_quote)
               ├→ Warehouse Contract (create_warehouse_contract_from_sales_quote)
               └→ Declaration (create_declaration_from_sales_quote)

Booking → Shipment:
  Air Booking → Air Shipment (convert_to_shipment)
  Sea Booking → Sea Shipment (convert_to_shipment)

Shipment → Order:
  Air Shipment ─┬→ Transport Order (create_transport_order_from_air_shipment)
                └→ Inbound Order (create_inbound_order_from_air_shipment)
  Sea Shipment ─┬→ Transport Order (create_transport_order_from_sea_shipment)
                └→ Inbound Order (create_inbound_order_from_sea_shipment)
  Transport Job → Inbound Order (create_inbound_order_from_transport_job)

Order → Job:
  Transport Order → Transport Job (action_create_transport_job)
  Inbound Order → Warehouse Job (make_warehouse_job)
  Release Order → Warehouse Job (make_warehouse_job)
  Transfer Order → Warehouse Job (make_warehouse_job)
  VAS Order → Warehouse Job (make_warehouse_job)
  Stocktake Order → Warehouse Job (make_warehouse_job)
  Declaration Order → Declaration (create_declaration_from_declaration_order)

8. Run Instructions

Unit tests (by module)

bench --site all run-tests --app logistics --module logistics.air_freight
bench --site all run-tests --app logistics --module logistics.sea_freight
bench --site all run-tests --app logistics --module logistics.transport
bench --site all run-tests --app logistics --module logistics.warehousing
bench --site all run-tests --app logistics --module logistics.pricing_center
bench --site all run-tests --app logistics --module logistics.special_projects
bench --site all run-tests --app logistics --module logistics.job_management

Transactional flow tests

bench --site all execute logistics.tests.transactional_flows_test.run

Note: Transactional tests require master data (Company, Customer, Shipper, Consignee, UNLOCO USLAX/USJFK, Item). Ensure site has these or tests will fail with validation errors.


9. Appendix – Test Script Location

Transactional flow test script: logistics/tests/transactional_flows_test.py

Flows covered:

  1. Air Booking → Air Shipment
  2. Sales Quote → Air Shipment
  3. Air Shipment → Transport Order
  4. Transport Order → Transport Job
  5. Air Shipment → Inbound Order
  6. Inbound Order → Warehouse Job

Getting Started

Setup and Settings

Sea Freight

Air Freight

Transport

Customs

Warehousing

Pricing Center

Job Management

Sustainability

Intercompany

Special Projects

Pages

Features

Reports

Glossary

Clone this wiki locally