Skip to content

Device Lifecycle

Who this is for

Anyone who needs to answer "where is this device in the flow?" — warehouse, sales, support, or a developer debugging a stuck record.

This page is a reference map. Every state, every transition, every condition for moving from one to the next. Use it when something looks stuck and you need to know what has to happen to unblock it.


What each device tracks

A single device (stock.lot) carries three independent status fields. They describe different things and change independently.

Field Purpose Values
device_status Where in the sales flow is this device? Available, Reserved, Sold, Returned
qc_status Has it been tested? Pending QC, In QC, QC Complete, QC Failed
settlement_status Has Axis been paid? Not Applicable, Pending, Settled

A device can have — for example — device_status='sold', qc_status='qc_complete', settlement_status='settled'. That's a fully finished, paid-out consignment sale. Another might be device_status='reserved', qc_status='pending_qc', settlement_status='not_applicable' — allocated to an SO but not yet QC'd and not a consignment device.


Device status — the sales flow

              Received
           +-----------+
           │ Available │  ← Default when a device arrives
           +-----+-----+
       ┌───────────────┬──────────────────┐
       ↓               ↓
 SO allocation    Retail reservation
       ↓               ↓
  +----------+    +----------+
  │ Reserved │    │ Reserved │
  +-----+----+    +-----+----+
        │               │
        │ (ship)        │ (retail sale confirm)
        ↓               ↓
     +------+        +------+
     │ Sold │        │ Sold │
     +--+---+        +------+
        │  (customer return)
   +----------+
   │ Returned │  → rework → Available
   +----------+

Transitions:

From To What triggers it
Available Reserved Allocation to a sales-order line, or activation of a retail reservation
Reserved Sold Delivery manifest complete, or retail sale confirmed
Sold Returned Customer-return processing
Returned Available Re-processed / re-QC'd — back into saleable stock

Device form status bar


QC status — the testing flow

QC is a sales gate. Allocation, delivery, and retail sale confirmation require QC Complete by default. A Sales Manager or Inventory Manager can approve an exception with a required reason; the override is logged on the device and source document.

  +-------------+
  │ Pending QC  │  ← Default when received
  +-----+-------+
        │ QC Handoff wizard
  +-------------+
  │    In QC    │  ← Being tested / graded
  +-----+-------+
    ┌───┴───┐
    ↓       ↓
+-----------+   +-----------+
│QC Complete│   │ QC Failed │
+-----------+   +-----+-----+
                      │  Reset to QC
                +-------------+
                │ Pending QC  │
                +-------------+

Transitions:

From To What triggers it
Pending QC In QC QC Handoff wizard
In QC QC Complete action_mark_qc_complete() on the device form
In QC QC Failed action_mark_qc_failed()
QC Failed Pending QC action_reset_to_qc() — for re-testing

Settlement status — the money flow

  +-----------------+
  │ Not Applicable  │  ← Reyder-owned devices; no consignment payout due
  +-----------------+

  +-----------------+
  │    Pending      │  ← Consignment device was sold; waiting for Axis to be paid
  +--------+--------+
           │ Mark Paid on the settlement report
  +-----------------+
  │    Settled      │  ← Vendor bill cleared; Axis has been paid
  +-----------------+
  • Not Applicable when the device's owner_company_id equals the selling company (Reyder sold a Reyder device — no commission is owed).
  • Pending is set by stock.lot.action_mark_sold() when a consignment device ships or sells retail.
  • Settled is set when the paired consignment settlement report is marked Paid.

Manifest state

 Draft → Awaiting Upload → Uploaded → In Progress → Done
 Cancelled (at any point before Done)
State Meaning
Draft Just created, not yet associated with a confirmed PO
Awaiting Upload PO confirmed, waiting for IMEI CSV (optional)
Uploaded CSV uploaded and parsed, lines created
In Progress At least one device scanned
Done All devices received/picked, marked complete
Cancelled Manifest voided — devices not processed

Applies to both receiving and delivery manifests.


Consignment agreement state

 Draft  →  Active  ⇄  Suspended  →  Terminated
State Sales allowed under this agreement?
Draft No
Active Yes
Suspended No (temporarily halted; can be reactivated)
Terminated No (permanent end)

Settlement report state

 Draft  →  Confirmed  →  Paid
State What's happened
Draft Rarely seen — auto-confirmed at creation
Confirmed Report exists, vendor bill posted, waiting for payment
Paid You marked it paid after the vendor bill cleared

Sale-order-line device allocation state

 Draft → Reserved → Confirmed → Delivered → Cancelled
State What it means
Draft Allocation exists but SO isn't confirmed
Reserved SO confirmed — device is reserved on its stock.lot
Confirmed Delivery manifest created, picking in progress
Delivered Manifest complete — device is Sold
Cancelled Allocation cancelled — device back to Available

Packing box state

 Draft → Packing → Ready to Ship → Shipped
                                  → Cancelled
State What it means
Draft Box created, no devices packed yet
Packing Actively scanning in
Ready to Ship All expected devices scanned and ready-confirmed, waiting for Mark Shipped
Shipped Gone — triggers COGS / invoice / settlement
Cancelled Box voided, devices returned to inventory

Retail reservation state

 Draft → Active → Released → Cancelled
              └──  (auto-close on last retail sale)
State What it means
Draft Not activated yet
Active Device flagged to the retail partner
Released All reserved devices sold, or returned to Reyder
Cancelled Manually cancelled

Auto-close runs when the last reserved device gets recorded as a retail sale, or when the expiry date passes (scheduled action).


Quick reference — where each status lives

Status field Model Who changes it
device_status stock.lot Allocation, delivery manifest, retail sale
qc_status stock.lot QC handoff wizard, QC action buttons
settlement_status stock.lot Settlement report action_mark_paid()
Manifest state device.manifest Upload, scan, mark complete
Agreement state device.consignment.agreement Manual activate/suspend/terminate
Report state consignment.settlement.report Auto-confirm at creation, manual Mark Paid
Allocation state sale.order.line.device SO confirmation, manifest complete
Box state packing.box Scan, Mark Ready to Ship, Mark Shipped
Reservation state device.retail.reservation Activate, auto-close on sale