User Manual: Vehicle Fine Record Management
1. Overview
This module enables automated retrieval, recording, and management of traffic fines for vehicles using data from the Tanzania Police Force's TMS system.
2. Key Features
- Auto-fetch of fines using number plate or reference.
- Scheduled fine checks every 2 hours.
- Enqueues background tasks for efficient processing.
- Automatic fine status updates (e.g., marking as PAID).
- Centralized log for all fine records.
3. Pre-Requisites
- Frappe/ERPNext environment.
- Internet access to https://tms.tpf.go.tz.
- Vehicle records with valid
number_plate. - User with “System Manager” role for full access.
4. Step-by-Step Usage
A. Manual Fine Check:
- Go to Vehicle Fine Record.
- Click New, input
referenceorvehicle. - Save to auto-validate and fetch details.
B. Automated Fine Check:
- Runs every 2 hours (scheduled).
- Background tasks fetch and update fines.
- View logs via Vehicle Fine Record list.
5. Script Customizations
- Hook (Scheduler):
"0 */2 * * *"→ Runs every 2 hours. - Main Function:
check_fine_all_vehicles(batch_size=20) - Fetch Logic:
Uses CSRF token from TMS portal and POSTs vehicle/reference for fine data. - Error Logging:
Handled viafrappe.log_error()andprint_out().
6. Troubleshooting (Common Errors and Resolutions)
| Error | Cause | Resolution |
|---|---|---|
| “Please provide a valid number plate” | Invalid plate input | Ensure input has 7+ characters. |
| “CSRF token not found” | TMS page structure changed | Update token parsing logic. |
| “Timeout” | Network issue / TMS downtime | Retry later or increase timeout. |
| Fine not updating | Reference mismatch | Verify reference or number_plate. |
7. User Roles and Permissions
| Role | Permissions |
|---|---|
| System Manager | Full access: Create, Read, Write, Delete, Submit, Export, Share, Email. |
8. Key Notes
- Fines are automatically updated and created based on TMS data.
- System sleeps between batches to avoid TMS server overload (optional).
- Only vehicles with valid plates are processed.
- Ensure proper network connectivity for seamless operation.
Last updated 4 days ago