Logistics Settings Configuration

Overview

The Logistics Settings DocType manages the global configuration for the Logistics Tracking system. It controls system-wide parameters such as alert notifications, geofence settings, tracking link expiry, and email alert configuration.

This document ensures that critical settings are properly validated before the logistics tracking features are enabled.


Primary Responsibilities

  • Manage alert configuration
  • Validate required logistics parameters
  • Ensure email alerts are properly configured
  • Disable alerts when the main alert system is turned off

Document Events

1. Validate Event

def validate(self)

Purpose

Ensures mandatory configuration fields are set before enabling logistics alerts.

Validation Rules

Field Condition Validation
tracking_link_expiry_threshold When alerts are enabled Must be set
set_geofence_radius When alerts are enabled Must be set
tracking_link_expiry_threshold Value check Must be ≥ 4 hours

Error Messages

  • "Please set 'Tracking Link Expiry Threshold' before enabling alerts."
  • "Please set 'Geofence Radius' before enabling alerts."
  • "Tracking link expiry threshold must be at least 4 hours."

2. Update Event

def on_update(self)

Purpose

Handles alert configuration whenever Logistics Settings are updated.

Execution Flow

  1. If alerts are disabled → disable all related alert options
  2. Validate alert dependencies
  3. If email alerts are enabled → validate email configuration

Alert Control

Disable All Alerts

def disable_all_alerts(self)

Purpose

Automatically disables all alert-related settings when the main alert toggle is turned off.

Fields Disabled

  • enable_email_alerts
  • enable_system_notification
  • enable_trip_delay_alert
  • route_deviation_alert
  • stoppage_alert

Alert Dependency Validation

def validate_alert_dependencies(self)

Purpose

Ensures that at least one alert delivery method is enabled.

Condition

At least one of the following must be enabled:

  • Email Alerts
  • System Notifications

Error Message

"You must enable 'Alerts' before enabling Email or System Notifications."

Email Alert Validation

Function

validate_email_settings()

Purpose

Validates configuration required for sending alert emails.

Required Fields

Field Description
sender_email_account Email account used to send alerts
internal_email_to Recipients who receive logistics alerts

Email Validation Process

Each email address is validated using the Frappe email validation utility.

validate_email_address(email_id, throw=True)

Supported Input

Multiple email addresses can be provided using new lines.

Example

fleetmanager@company.com
logistics@company.com
operations@company.com

Alert Configuration Workflow

User updates Logistics Settings
        ↓
validate() checks mandatory configuration
        ↓
on_update() executes
        ↓
If alerts disabled → disable all alerts
        ↓
If alerts enabled → validate dependencies
        ↓
If email alerts enabled → validate email configuration

Key Fields in Logistics Settings

Field Purpose
enable_alerts Master toggle for logistics alert system
enable_email_alerts Enable alert emails
enable_system_notification Enable in-app notifications
tracking_link_expiry_threshold Expiry time for tracking links
set_geofence_radius Default radius for geofence detection
sender_email_account Email account used for alerts
internal_email_to Alert recipient email list

Benefits

  • Ensures valid logistics configuration before enabling alerts
  • Prevents incomplete email configuration
  • Automates alert system control
  • Provides centralized configuration for logistics tracking
  • Improves reliability of fleet monitoring alerts

Conclusion

The Logistics Settings document acts as the central configuration hub for the logistics tracking system. It ensures that alert mechanisms, email notifications, and geofence settings are properly configured before the system becomes operational.

Discard
Save
This page has been updated since your last edit. Your draft may contain outdated content. Load Latest Version

On this page

Review Changes ← Back to Content
Message Status Space Raised By Last update on