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

Reference

Fleet assets

Reference for the assets sub-module of fleet, with asset and asset class fields, lifecycle actions, runtime fields, and the routes.

This page describes the assets sub-module in src/cluster_erp/modules/fleet/assets/. A fleet asset (FleetAsset) is one vehicle, trailer, or machine. An asset class (FleetAssetClass) groups assets and decides whether they are powered and which meters they get at birth. The module overview is on fleet module.

Scope and source

  • Defined in: src/cluster_erp/modules/fleet/models.py (FleetAssetClass, FleetAsset), assets/services.py (FleetClassService, FleetAssetService), assets/routes.py, assets/schemas.py, and assets/metadata.py.
  • Count: 2 tables, 10 routes (@...router. decorators in assets/routes.py), 6 ActionMeta entries in assets/metadata.py.

Asset fields

Name Meaning Source
code Business key from the sequence fleet_asset src/cluster_erp/modules/fleet/models.py:189, src/cluster_erp/modules/fleet/assets/services.py:229
name, class_id Display name and asset class src/cluster_erp/modules/fleet/models.py:191-192
plate, vin, chassis_no, engine_no First-class identities; plate and vin unique among live rows src/cluster_erp/modules/fleet/models.py:168-198
product_id, product_model_id, product_version_id Optional catalogue reference src/cluster_erp/modules/fleet/models.py:201-205
make_name, model_name, model_year, color Free-text description src/cluster_erp/modules/fleet/models.py:206-209
status Lifecycle state, default draft src/cluster_erp/modules/fleet/models.py:212
acquisition_date, acquisition_value, acquisition_currency Acquisition; value is Numeric(18, 2) src/cluster_erp/modules/fleet/models.py:213-215
first_registration_date, disposal_date Registration date (basis for inspection age) and disposal date src/cluster_erp/modules/fleet/models.py:216-218
responsible_party_id The party responsible for the asset day to day src/cluster_erp/modules/fleet/models.py:220-227
telematics_device_id Device id used by the telematics feed src/cluster_erp/modules/fleet/models.py:227-229
last_odometer_km, last_odometer_at Latest odometer, written by the reading ledger src/cluster_erp/modules/fleet/models.py:231-235
extra Tenant field values as a JSON object src/cluster_erp/modules/fleet/models.py:163-166

Asset class fields

Name Meaning Source
code Class key, unique among live rows src/cluster_erp/modules/fleet/models.py:140-149
label Labels per language as a JSON object src/cluster_erp/modules/fleet/models.py:150
powered Whether the class has an engine; a trailer is unpowered src/cluster_erp/modules/fleet/models.py:151
icon, sort_order, is_active Display and activity src/cluster_erp/modules/fleet/models.py:152-156
default_meters Meter kind keys an asset of this class gets when it is created src/cluster_erp/modules/fleet/models.py:154-155

The form edits default_meters as one key per line (src/cluster_erp/modules/fleet/assets/services.py:112-116). A key without a meter template is skipped without error (src/cluster_erp/modules/fleet/meters/services.py:145-172).

Statuses and actions

An asset is draft, active, in_maintenance, inactive, or disposed (src/cluster_erp/modules/fleet/models.py:46-52). The service holds the allowed transitions in _TRANSITIONS and refuses others with FLEET_INVALID_STATUS (src/cluster_erp/modules/fleet/assets/services.py:41-48, src/cluster_erp/modules/fleet/assets/services.py:277-305).

Action Label Condition in metadata Service rule Source
activate Activate status is draft draft or inactive to active src/cluster_erp/modules/fleet/assets/metadata.py:90-96
reactivate_service Return to Fleet status is inactive calls activate src/cluster_erp/modules/fleet/assets/metadata.py:97-103
send_to_maintenance Send to Maintenance status is active active to in_maintenance; opens a released work order src/cluster_erp/modules/fleet/assets/metadata.py:104-136, src/cluster_erp/modules/fleet/assets/services.py:300-338
return_to_service Return to Service status is in_maintenance in_maintenance to active src/cluster_erp/modules/fleet/assets/metadata.py:137-143
deactivate_asset Take Out of Service status is active active or in_maintenance to inactive src/cluster_erp/modules/fleet/assets/metadata.py:144-150
dispose Dispose status is inactive active, inactive, or in_maintenance to disposed; sets disposal_date src/cluster_erp/modules/fleet/assets/metadata.py:151-157, src/cluster_erp/modules/fleet/assets/services.py:296-297

Send to Maintenance asks for the work to be done, the mechanic or service party, a planned date, and notes (src/cluster_erp/modules/fleet/assets/metadata.py:110-135). The service creates the work order and releases it at once (src/cluster_erp/modules/fleet/assets/services.py:307-338).

stateDiagram-v2
 [*] --> draft
 draft --> active: activate
 active --> in_maintenance: send_to_maintenance
 in_maintenance --> active: return_to_service or last work order completed
 active --> inactive: deactivate_asset
 in_maintenance --> inactive: deactivate_asset
 inactive --> active: activate
 active --> disposed: dispose
 inactive --> disposed: dispose
 in_maintenance --> disposed: dispose

In prose: an asset starts as a draft and becomes active through Activate. From active it can go to maintenance, out of service, or disposal. A work order completion returns an asset in maintenance to active when no other order is open (src/cluster_erp/modules/fleet/workorders/services.py:246-265). Disposal is final; no transition leaves disposed (src/cluster_erp/modules/fleet/assets/services.py:41-48).

Routes

Method and path Purpose Permission Source
GET /assets/ List with search, class_id, status, tenant field filters, paging fleet_asset.read src/cluster_erp/modules/fleet/assets/routes.py:54-86
POST /assets/ Create a draft asset fleet_asset.create src/cluster_erp/modules/fleet/assets/routes.py:89-95
GET /assets/{asset_id} Read one asset fleet_asset.read src/cluster_erp/modules/fleet/assets/routes.py:98-107
PUT /assets/{asset_id} Update fields fleet_asset.update src/cluster_erp/modules/fleet/assets/routes.py:110-117
POST /assets/{asset_id}/actions/{action} Run a lifecycle action fleet_asset.update src/cluster_erp/modules/fleet/assets/routes.py:120-131
DELETE /assets/{asset_id} Deactivate the record fleet_asset.delete src/cluster_erp/modules/fleet/assets/routes.py:134-141
GET, POST, PUT /classes/... List, read, create, and update classes fleet_asset_class.read, fleet_asset_class.update src/cluster_erp/modules/fleet/assets/routes.py:146-192

The list response hides tenant field values the caller may not see, through redact_extra_items (src/cluster_erp/modules/fleet/assets/routes.py:74-81). See field and row access.

Constraints and validation

  • Creating an asset checks that the class exists and that plate and vin are free among live rows (src/cluster_erp/modules/fleet/assets/services.py:199-233).
  • Tenant field values in extra are validated against their definitions, with the asset row as context for class-scoped fields (src/cluster_erp/modules/fleet/assets/services.py:233-235). See tenant fields.
  • A new asset gets the meters its class declares and the reminders of class-scoped maintenance plans at once (src/cluster_erp/modules/fleet/assets/services.py:238-249).
  • A class code is unique among live classes; a duplicate is refused with a conflict (src/cluster_erp/modules/fleet/assets/services.py:68-76).
  • DELETE sets deleted_at on the asset and on its live reminders. The code comment separates this record-level soft delete from the operational status inactive (src/cluster_erp/modules/fleet/assets/services.py:340-363).

Terms introduced

Term Code identifier Definition Turkish term Source
asset lifecycle FLEET_ASSET_STATUSES The five states of an asset from draft to disposed. Araç yaşam döngüsü src/cluster_erp/modules/fleet/models.py:46
default meters default_meters The meter kinds an asset of a class gets when it is created. Varsayılan sayaçlar src/cluster_erp/modules/fleet/models.py:155

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

Verified against commit 92f8051 · 2026-11-13