Workflow: Fleet Management — A Vehicle's Lifecycle
Modules involved: Fleet (Vehicles · Bookings · Logbooks · Work Orders · Fuel · Maintenance · Inspections · Parts · Insurance) · HR Profile · Purchase · Expenses · Invoices
Who uses it: Fleet Manager · Drivers (Driver role) · Finance · Maintenance
Typical duration: Continuous (daily bookings) + monthly cycle (costs) + annual cycle (inspections, insurance)
Overview
The Fleet module manages the complete lifecycle of a company vehicle: registration, driver assignment, bookings, travel logbook, maintenance, spare parts, fuel, inspections, and insurance. Maintenance costs are financially tracked through Expenses (from_fleet=1), and invoiced bookings go through Invoices (from_fleet=1).
Mandatory dependencies: The
hr_profileandpurchasemodules must be active. Fleet checks at every load — if one is missing, it redirects with an error. Without these modules, Fleet does not function.
Note on Assets: There is no functional link between the Fleet module and the Assets module (
tblassets). Integration stubs exist in the code but the referenced methods are not implemented.
Flow diagram
[INITIAL CONFIGURATION — admin]
│
├── Vehicle Groups + Vehicle Types
├── Garages (+ Maintenance Teams)
├── Insurance Categories / Types / Status / Companies
├── Part Groups + Part Types
├── Inspection Forms (with questions and failure criteria)
├── Criteria (for driver benefits/penalties)
└── Assign 'Fleet: Driver' role to employees who drive
│
↓
[VEHICLE REGISTRATION]
│
├── New vehicle: type, group, license plate, VIN, technical data
├── Insurance added: category, type, company, validity, amount
└── Parts inventoried and assigned to vehicle
│
↓
[BOOKING]
│
├── Client or internal user submits booking (Fleet_client controller)
├── Initial status: new
├── Fleet Manager manually approves: new → approved
│ (or: rejected / processing)
└── Booking confirmed → Amount set for future invoicing
│
↓
[LOGBOOK — TRIP EXECUTION]
│
├── Logbook created for confirmed booking: vehicle + driver + date
├── Time Cards added: start_time / end_time per work session
├── Logbook status: new → processing → complete
└── Fuel entry: odometer, liters, price, type, vendor
│
↓
[MAINTENANCE / WORK ORDER (if malfunction or scheduled service)]
│
├── Work Order created: vehicle, vendor, odometer in/out
├── Status: open → in_progress → parts_ordered → complete
├── Consumed parts added as Work Order Details (part_id, qty, price)
├── Upon completion: Create Expense → Expense created with category 'Fleet: Work Order'
│ from_fleet=1 · vendor = vendor from Work Order
└── (Simple maintenance alternative: Maintenance record without Work Order)
│
↓
[INSPECTION (periodic or post-incident)]
│
├── Inspection created based on a configured Inspection Form
├── Results filled in per question (answer, boxdescriptionid)
├── Answers with is_fail=1 → inspection marked as failed
└── Inspections can be recurring (recurring_type, cycles)
│
↓
[BOOKING INVOICING]
│
├── From completed booking: Create Invoice button
├── Invoice automatically created with amount from booking + from_fleet=1
└── Invoice tracked and paid like any standard invoice
│
↓
[REPORTS & COSTS]
│
├── Fleet → Transactions: all invoice + expense with from_fleet=1
├── Fleet → Reports: Profit & Loss · Sales Chart per vehicle
└── Driver benefits/penalties: recorded with criterion + amount
[VEHICLE DECOMMISSIONED → out_of_service_date + final odometer]
Step by step
1. Initial configuration (admin)
Where: /admin/fleet → Settings
Configuration order matters — some entities depend on others:
1a. Vehicle lookups
Where: Settings → Vehicle Groups + Vehicle Types
Create at least one group (e.g., "Passenger cars", "Vans") and one type (e.g., "Sedan", "SUV", "Truck"). These are required when creating a vehicle.
1b. Garages
Where: Settings → Garages → Add Garage
Fields: name, country, city, address. After creation, you can add a Maintenance Team: employees (staff) assigned to that garage for maintenance.
1c. Insurance setup (4 separate tables)
Where: Settings → Insurance Categories / Insurance Types / Insurance Status / Insurance Company
All 4 are required before adding an insurance policy to a vehicle.
1d. Part Groups + Part Types
Where: Settings → Part Groups + Part Types
Required before creating inventory parts.
1e. Inspection Forms
Where: Settings → Inspection Forms → New Form
Each form has:
- Questions with response types (checkbox, text, etc.)
is_failset on answers that mark the inspection as failed
Forms can be configured as recurring (recurring=1, recurring_type, cycles).
1f. Criteria (for benefits/penalties)
Where: Settings → Criteria → Add Criteria
Used in Fleet → Benefits & Penalties for formal recording of driver rewards or penalties.
1g. Assigning driver role
Where: /admin/staff → edit staff → Roles → check "Fleet: Driver"
The Fleet: Driver role is created automatically upon module installation. Only staff with this role appear in driver dropdowns throughout Fleet (Assignments, Logbooks, Work Orders, etc.).
2. Vehicle registration
Where: /admin/fleet → Vehicles → Add Vehicle
Required fields:
| Field | Description |
|---|---|
name |
Vehicle name/identifier |
vehicle_type_id |
FK → fleet_vehicle_types |
vehicle_group_id |
FK → fleet_vehicle_groups |
license_plate |
License plate number |
Recommended fields:
| Field | Description |
|---|---|
vin |
VIN (chassis number) |
make / model / year |
Identification data |
fuel_type |
Fuel type |
in_service_date |
Date the vehicle entered the fleet |
odometer |
Current mileage |
estimated_service_life_in_months |
Estimated service life |
Vehicle insurance: Where: vehicle record → Insurance tab → Add Insurance
| Field | Description |
|---|---|
insurance_category_id |
FK → fleet_insurance_categories |
insurance_type_id |
FK → fleet_insurance_types |
insurance_company_id |
FK → fleet_insurance_company |
insurance_status_id |
FK → fleet_insurance_status |
start_date / end_date |
Validity period |
amount |
Insurance premium |
Parts assigned to vehicle:
Where: /admin/fleet → Parts → Add Part → assign vehicle
3. Assigning a driver to a vehicle
Where: /admin/fleet → Vehicle Assignments → Add Assignment
| Field | Description |
|---|---|
driver_id |
Staff with Fleet: Driver role |
vehicle_id |
FK → fleet_vehicles |
start_time / end_time |
Assignment interval |
starting_odometer / ending_odometer |
Mileage at pickup/return |
A vehicle can have multiple successive assignments. The full history is preserved.
4. Booking — vehicle reservation
Where: external client → portal /clients/fleet (Fleet_client controller) or admin → /admin/fleet/bookings
Booking statuses (fleet_bookings.status):
| Status | Color | Meaning |
|---|---|---|
new |
Blue | New request, unprocessed |
approved |
Teal-green | Approved by fleet manager |
rejected |
Green | Rejected |
processing |
Blue | Being processed |
complete |
Green | Completed |
cancelled |
Red | Cancelled |
Important: There is no automated approval workflow. The
approvedcolumn (INT) exists in the table but is not read or written by any active method in the code. Status transition is exclusively manual — the fleet manager changes the status explicitly.
Required permission to change status: service_management → edit OR is_admin().
Key booking fields:
| Field | Description |
|---|---|
subject |
Booking description |
contactid |
The contact making the booking |
delivery_date |
Delivery date |
receipt_address / delivery_address |
Addresses |
amount |
Amount to invoice (filled in by admin) |
5. Logbook — trip execution
Where: /admin/fleet → Work Performance (Logbooks) → Add
The Logbook documents the execution of a booking or an independent trip.
Logbook statuses (fleet_logbooks.status):
| Status | Meaning |
|---|---|
new |
Recorded, not started |
processing |
In progress |
complete |
Completed |
cancelled |
Cancelled |
Time Cards: per logbook, work sessions are added with start_time and end_time (fleet_time_cards). Allows calculation of total hours.
Fuel:
Where: /admin/fleet → Fuel History → Add
| Field | Description |
|---|---|
vehicle_id |
Vehicle refueled |
fuel_time |
Date/time of refueling |
odometer |
Km at refueling |
gallons |
Quantity (liters or gallons) |
price |
Total cost |
fuel_type |
Fuel type |
vendor_id |
Vendor (station) |
6. Work Order — maintenance with parts
Where: /admin/fleet → Work Orders → New Work Order
Work order statuses (fleet_work_orders.status):
| Status | Meaning |
|---|---|
open |
Open (default at creation) |
in_progress |
Work in progress |
parts_ordered |
Parts ordered, awaiting |
complete |
Completed |
Key fields:
| Field | Description |
|---|---|
vehicle_id |
Vehicle being repaired |
vendor_id |
Service vendor |
odometer_in / odometer_out |
Km at intake/delivery |
issue_date / start_date / complete_date |
Work dates |
work_requested |
Description of work requested |
total |
Total cost calculated from parts lines |
Consumed parts (Work Order Details):
Add lines with part_id (from Fleet inventory), qty, price → total is calculated automatically.
Generating an expense from Work Order (status=complete): The Create Expense button in Work Order → automatically creates:
tblexpenseswithfrom_fleet=1,amount=work_order.total,category='Fleet: Work Order',vendor_id=work_order.vendor_id- Work Order receives
expense_idin the linking field
7. Vehicle inspection
Where: /admin/fleet → Inspections → New Inspection
Select the vehicle + Inspection Form. Fill in answers per question. Answers marked is_fail=1 automatically mark the inspection as failed.
Inspections can be set as recurring (recurring=1): the system automatically generates future inspections based on recurring_type and cycles.
8. Booking invoicing
Where: /admin/fleet → Bookings → booking record → Create Invoice
The create_invoice_by_booking($id) method automatically generates:
- A standard invoice (
tblinvoices) withamountfrom booking andfrom_fleet=1 - The booking receives
invoice_idandinvoice_hashin the linking fields
The generated invoice also appears in /admin/invoices and can be managed like any standard invoice (sending, payment, reminder, eFactura).
9. Reports and costs
Where: /admin/fleet → Transactions / Reports
| Section | What it shows |
|---|---|
| Transactions | All tblinvoices and tblexpenses with from_fleet=1 |
| Profit & Loss Chart | Revenue (invoices from_fleet) vs. Expenses (expenses from_fleet) |
| Sales Chart | Revenue per period for fleet vehicles |
Required permissions
| Permission | Entity |
|---|---|
fleet_vehicle → view/create/edit/delete |
Vehicles |
fleet_driver → view/create/edit/delete |
Drivers |
fleet_vehicle_assignment → create/edit |
Vehicle-driver assignments |
fleet_maintenance → view/create/edit/delete |
Simple maintenance |
fleet_fuel → view/create/edit/delete |
Fuel |
fleet_inspection → view/create/edit/delete |
Inspections |
fleet_bookings → view/create/edit/delete |
Bookings |
fleet_work_orders → view/create/edit/delete |
Work Orders |
fleet_work_performance → view/create/edit/delete |
Logbooks + Time Cards |
fleet_event → view/create/edit/delete |
Events |
fleet_insurance → view/create/edit/delete |
Insurance |
fleet_benefit_and_penalty → view/create/edit/delete |
Benefits/Penalties |
fleet_part → view/create/edit/delete |
Parts |
fleet_garage → create/edit/delete |
Garages |
fleet_transaction → view |
Cost report |
fleet_setting → view/create/edit/delete |
Configuration |
service_management → edit OR is_admin() |
Change booking/logbook/work order status |
Gotchas
| Problem | Cause | Solution |
|---|---|---|
| Fleet module does not load, redirect error | hr_profile or purchase module inactive |
Activate both modules from /admin/modules |
| Driver does not appear in dropdown | Does not have Fleet: Driver role assigned |
Staff → Roles → check Fleet: Driver |
| Booking cannot be approved | Missing service_management → edit permissions |
Assign the permission or grant admin |
| Work Order does not generate Expense | Work Order is not at complete status |
Complete the Work Order (status=complete) before Create Expense |
| Vehicle does not appear in booking | No Vehicle Type or Vehicle Group set | Fill in both fields on the vehicle record |
| Invoice from booking does not appear in Invoices | from_fleet=1 filter — invoice exists but with fleet flag |
Invoice appears normally in /admin/invoices — the Fleet Transactions filter shows it separately |
Module references
- Fleet — module documentation
- Assets — asset management (separate from Fleet)
- Expenses — expenses generated from Work Orders
- Invoices — invoices generated from Bookings
- HR — Staff — assigning Fleet: Driver role