Factorizer/Cluster ERP WikiCluster ERP Türkçe
Home / Business modules

Reference

Fleet meters and fuel

Reference for the meters and fuel sub-modules of fleet, with the reading ledger, fuel entries, compliance obligations, penalties, and inspection periods.

This page describes two sub-modules of fleet. The meters sub-module in src/cluster_erp/modules/fleet/meters/ keeps counters and an immutable reading ledger. The fuel sub-module in src/cluster_erp/modules/fleet/fuel/ keeps fuel entries, compliance obligations, penalties, and the inspection period table. The module overview is on fleet module.

Scope and source

  • Defined in: src/cluster_erp/modules/fleet/models.py (FleetMeter, FleetMeterReading, FleetFuelEntry, FleetComplianceItem, FleetInspectionPeriod, FleetPenalty), meters/services.py, meters/routes.py, meters/metadata.py, fuel/services.py, fuel/routes.py, and fuel/metadata.py.
  • Count: 6 tables, 32 routes (9 in meters/routes.py, 23 in fuel/routes.py), 8 ActionMeta entries (3 in meters/metadata.py, 5 in fuel/metadata.py).

Meter and reading fields

Name Meaning Source
FleetMeter.asset_id, kind, label, unit One counter on one asset; one live meter per kind and asset src/cluster_erp/modules/fleet/models.py:240-263, src/cluster_erp/modules/fleet/meters/services.py:118-129
FleetMeter.rollover_max, initial_value Wrap point of the display and the value at birth src/cluster_erp/modules/fleet/models.py:264-267
FleetMeterReading.reading_at, entry_mode, value_entered When, how (absolute or delta), and the entered value src/cluster_erp/modules/fleet/models.py:271-298, src/cluster_erp/modules/fleet/models.py:63
value_absolute, delta, ltd_value Computed display value, usage since the previous reading, and life-to-date usage src/cluster_erp/modules/fleet/models.py:299-301
source Where the reading came from, default manual src/cluster_erp/modules/fleet/models.py:302, src/cluster_erp/modules/fleet/models.py:62
status valid, preliminary, or incorrect src/cluster_erp/modules/fleet/models.py:303, src/cluster_erp/modules/fleet/models.py:60
is_initial, meter_changed, rollover Baseline flag, counter replaced, display wrapped src/cluster_erp/modules/fleet/models.py:306-310

Two meter templates exist in code: odometer_km (unit km, wraps at 999999.9) and engine_hours (unit h). A meter of any other kind can be created directly (src/cluster_erp/modules/fleet/meters/services.py:46-60).

Reading ledger rules

  • A reading is created and never edited. A wrong reading is marked incorrect and the chain after it is recomputed (src/cluster_erp/modules/fleet/meters/services.py:9-12).
  • The meter row is locked for the duration of the post, so two posts cannot read the same predecessor (src/cluster_erp/modules/fleet/meters/services.py:244-254).
  • A reading is refused for a deactivated or disposed asset, for a date more than five minutes in the future, for a negative value, and for a date not after the latest counted reading (src/cluster_erp/modules/fleet/meters/services.py:255-286).
  • The first reading is the baseline. With an initial_value above zero, the first reading already counts usage from that value (src/cluster_erp/modules/fleet/meters/services.py:407-433).
  • A meter change re-baselines the display and keeps life-to-date unchanged (src/cluster_erp/modules/fleet/meters/services.py:434-442).
  • A lower absolute value is refused unless the reading is flagged as a rollover (src/cluster_erp/modules/fleet/meters/services.py:455-474).
  • A reading whose daily usage exceeds five times the recent daily rate, with a jump above 1000, is set to preliminary (src/cluster_erp/modules/fleet/meters/services.py:62-68, src/cluster_erp/modules/fleet/meters/services.py:476-497).
  • After a post, the asset's last_odometer_km is synchronised by reading date and the maintenance reminders are recomputed (src/cluster_erp/modules/fleet/meters/services.py:308-311).
Action Label Condition Endpoint Source
confirm Confirm status is preliminary POST /readings/{id}/actions/confirm src/cluster_erp/modules/fleet/meters/metadata.py:161-169
mark_incorrect Mark Incorrect status is valid POST /readings/{id}/actions/mark_incorrect src/cluster_erp/modules/fleet/meters/metadata.py:170-178
mark_incorrect_preliminary Mark Incorrect status is preliminary POST /readings/{id}/actions/mark_incorrect src/cluster_erp/modules/fleet/meters/metadata.py:179-187

The baseline reading cannot be marked incorrect while later readings exist (src/cluster_erp/modules/fleet/meters/services.py:332-345).

Fuel entry fields

Name Meaning Source
asset_id, plate The matched asset, and the plate given by an import src/cluster_erp/modules/fleet/models.py:596-628
filled_at, station, fuel_type When, where, and which of seven fuel types src/cluster_erp/modules/fleet/models.py:98-106, src/cluster_erp/modules/fleet/models.py:615-618
quantity, unit_price, total_cost, currency Litres Numeric(10, 2), price Numeric(18, 4), total Numeric(18, 2) src/cluster_erp/modules/fleet/models.py:619-622
odometer_km, is_full_tank Odometer at the fill and whether the tank was filled src/cluster_erp/modules/fleet/models.py:623-624
source, card_no, driver_party_id manual, tts_import, or card; fuel card; driver src/cluster_erp/modules/fleet/models.py:107, src/cluster_erp/modules/fleet/models.py:625-628
match_status, mismatch_reason verified or unverified, with the reason src/cluster_erp/modules/fleet/models.py:629-630
consumption_l_100km, consumption_alert, non_utts_risk Computed consumption and two flags src/cluster_erp/modules/fleet/models.py:631-633

Fuel rules

  • Quantity must be positive. A missing total is computed as quantity times unit price, quantized to two decimals (src/cluster_erp/modules/fleet/fuel/services.py:124-137).
  • An entry without an asset lands unverified. A quantity above the asset's fuel_tank_l tenant field also lands unverified with a reason (src/cluster_erp/modules/fleet/fuel/services.py:143-147, src/cluster_erp/modules/fleet/fuel/services.py:291-313).
  • A verified full-tank entry with an odometer computes litres per 100 km since the previous full tank. With at least three earlier values, the alert flag is set when the value exceeds 1.5 times their average (src/cluster_erp/modules/fleet/fuel/services.py:46-49, src/cluster_erp/modules/fleet/fuel/services.py:333-355).
  • A late entry, a verification, or a deactivation recomputes every later consumption value of the same asset and fuel type (src/cluster_erp/modules/fleet/fuel/services.py:357-383).
  • A verified entry with an odometer becomes a reading with source fuel; a refused reading does not block the fuel entry (src/cluster_erp/modules/fleet/fuel/services.py:385-414).
  • POST /fuel/import matches rows by plate. An unmatched row lands unverified; a malformed row is returned in rejected with its index and reason, and the rest of the batch is kept (src/cluster_erp/modules/fleet/fuel/services.py:158-224).
Action Label Condition Endpoint Source
assign_asset Assign Asset match_status is unverified POST /fuel/{id}/actions/assign_asset src/cluster_erp/modules/fleet/fuel/metadata.py:115-132
verify Verify match_status is unverified POST /fuel/{id}/actions/verify src/cluster_erp/modules/fleet/fuel/metadata.py:133-139, src/cluster_erp/modules/fleet/fuel/services.py:232-251

Compliance items, penalties, and inspection periods

Entity Key fields Statuses Source
FleetComplianceItem asset_id, kind, title, due_date, amount, currency, renew_months, vendor_party_id, reference_no, completed_at pending, overdue, completed src/cluster_erp/modules/fleet/models.py:109-120, src/cluster_erp/modules/fleet/models.py:636-671
FleetPenalty asset_id, kind, occurred_at, amount, currency, due_date, driver_party_id, reference_no pending, paid, objected src/cluster_erp/modules/fleet/models.py:121-122, src/cluster_erp/modules/fleet/models.py:687-703
FleetInspectionPeriod class_id, age_from_years, age_to_years, period_months none src/cluster_erp/modules/fleet/models.py:673-685
  • Listing compliance items first sets every pending item with a past due date to overdue (src/cluster_erp/modules/fleet/fuel/services.py:427, src/cluster_erp/modules/fleet/fuel/services.py:595-606).
  • Mark Completed locks the row, refuses a future date, and spawns the next item. For an inspection the interval comes from the inspection period that matches the asset class and age; otherwise from renew_months. No interval means no next item (src/cluster_erp/modules/fleet/fuel/metadata.py:381-397, src/cluster_erp/modules/fleet/fuel/services.py:479-593).
  • Asset age is read from first_registration_date, or from model_year when that is missing (src/cluster_erp/modules/fleet/fuel/services.py:572-582).
  • A new penalty without a driver takes the driver whose assignment covered the moment of the penalty (src/cluster_erp/modules/fleet/fuel/services.py:647-663).
  • Mark Paid moves pending or objected to paid; Object moves pending to objected (src/cluster_erp/modules/fleet/fuel/metadata.py:610-625, src/cluster_erp/modules/fleet/fuel/services.py:681-706).

Routes

Router Paths Source
meter_router GET /meters/, POST /meters/, GET /meters/kinds, GET /meters/{meter_id}, DELETE /meters/{meter_id} src/cluster_erp/modules/fleet/meters/routes.py:29-102
reading_router GET /readings/, POST /readings/, GET /readings/{reading_id}, POST /readings/{reading_id}/actions/{action} src/cluster_erp/modules/fleet/meters/routes.py:105-169
fuel_router list, create, POST /fuel/import, read, action, delete src/cluster_erp/modules/fleet/fuel/routes.py:46-126
compliance_router list, create, read, update, action, delete src/cluster_erp/modules/fleet/fuel/routes.py:129-216
penalty_router list, create, read, update, action, delete src/cluster_erp/modules/fleet/fuel/routes.py:219-301
period_router /inspection-periods list, create, read, update, delete src/cluster_erp/modules/fleet/fuel/routes.py:38-40, src/cluster_erp/modules/fleet/fuel/routes.py:304-361

GET /meters/kinds returns the template kinds and every live meter kind, for the maintenance plan form (src/cluster_erp/modules/fleet/meters/routes.py:61-78).

Terms introduced

Term Code identifier Definition Turkish term Source
meter reading FleetMeterReading An immutable counter document on one meter. Sayaç okuması src/cluster_erp/modules/fleet/models.py:271
life-to-date value ltd_value Accumulated usage of a meter that only grows. Ömür boyu değer src/cluster_erp/modules/fleet/models.py:301
preliminary reading preliminary A reading held back because its usage is implausible, until confirmed or marked incorrect. Ön okuma src/cluster_erp/modules/fleet/models.py:60
compliance item FleetComplianceItem A dated obligation of one asset that renews on completion. Uyum kalemi src/cluster_erp/modules/fleet/models.py:636

Verified against commit 92f8051 on 2026-11-13.

Verified against commit 92f8051 · 2026-11-13