Skip to content

sr_scheduling v1.0.0 — 2026-03-28

Author: Dan Branch: jan Conflicts with staging-2: None


What Changed

  1. Service window enforcement_check_service_window_fits() now actually enforces customer HOO windows (was always True before)
  2. Driver prep/unload time — Morning prep (default 30min) and evening unload (region-specific: Sunbright 30min, others 60min) deducted from available route time
  3. Early start warnings — Routes requiring departure before 7:00 AM flagged with explanation
  4. Scheduling explanations — System shows WHY a date/route was chosen (capacity, direction, service window fit)
  5. 12h AM/PM time display — All times show in 12-hour format with timezone labels (ET/CT)
  6. Timezone population cron — Batch job to populate customer timezones via Google Maps API
  7. Warehouse bearing & route sectors — Directional routing for optimal truck dispatch
  8. Best date suggestion — Pickup wizard suggests optimal dates based on capacity, hours, direction

Deploy Commands

# 1. Pull the code
git checkout ScottRecycling/jan -- sr_scheduling/

# 2. Upgrade sr_management FIRST (dependency), then sr_scheduling
/opt/odoo17/odoo17-venv/bin/python3 /opt/odoo17/odoo17/odoo-bin \
  -c /etc/odoo17.conf -d <DATABASE> -u sr_management,sr_scheduling --stop-after-init

# 3. Restart
sudo systemctl restart odoo17.service

# 4. Check logs
sudo journalctl -u odoo17.service --since "5 minutes ago" --no-pager | tail -50

Post-Deploy Configuration

System Parameter Value Notes
google_maps_api_key (get from Dan) Required for timezone cron
time_at_pickup_location 0.5 Hours spent at each pickup (default)
no_hours_per_day 10 Max route hours
trip_start_time 8.0 Default route start (8:00 AM)

Regions need unload times configured: - Sunbright: 30 minutes - All others: 60 minutes

Test Checklist

Test 1 (exp)

  • Module upgrades without errors
  • Scheduling menu loads
  • Create a pickup via Add Note wizard — system suggests a date
  • Service windows enforced (tight window < 6 hours shows warning)
  • Times display in 12h AM/PM format with timezone
  • Truck schedule calendar view works

Test 2 (1820)

  • Module upgrades without errors
  • All above tests pass
  • No breakage in sr_truck_schedule, sr_reports

Staging (1717)

  • Module upgrades without errors
  • All above tests pass
  • Timezone cron runs without errors (check Scheduled Actions)
  • Early start warnings display correctly

Programmer's Notes

  • _check_service_window_fits() is the critical method — it now REJECTS schedules that don't fit customer hours. Test with customers who have tight windows.
  • Windows under 6 hours are "tight" — system tries harder but may still reject.
  • Timezone cron calls Google Maps API at 200 requests/hour. Full DB population takes ~24 hours. Don't run during business hours on first deploy.
  • The Add Note wizard is in sr_scheduling, not sr_management. It's the primary way CSRs schedule pickups.

Rollback

git checkout ScottRecycling/staging-2 -- sr_scheduling/
/opt/odoo17/odoo17-venv/bin/python3 /opt/odoo17/odoo17/odoo-bin \
  -c /etc/odoo17.conf -d <DATABASE> -u sr_scheduling --stop-after-init
sudo systemctl restart odoo17.service