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.
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).
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).
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 sourcefuel; 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).
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).
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).