Skip to content

ship_order never writes SalesOrderLine.shipped_quantity — per-line fulfillment tracking is dead data #726

@Blb3D

Description

@Blb3D

Found during LEGACY-1 (PR #725) review.

Evidence: the only writer of SalesOrderLine.shipped_quantity in backend/app/services/ is the new legacy close-out path (resolve_legacy_fulfillment). The normal ship_order flow never sets it.

Impact:

  • fulfillment_status.py computes per-line fulfillment from line.shipped_quantity (lines 53, 171) — a field nothing writes during organic shipping, so line-level fulfillment math is always zero.
  • Line-removal guard at sales_order_service.py:1646 ("units have already been shipped") can never trigger.
  • LEGACY-1's shipment-evidence check tolerates this (it also accepts shipped_at + order fulfillment_status, which the ship flow does write), but per-line partial-shipment tracking is effectively unimplemented.

Suggested fix: ship_order (and the fulfillment_shipping path if separate) should set line.shipped_quantity for shipped lines — full qty for full shipments, per-line amounts when partial shipment support lands.

Logged as Aeonyx observation #171 by agent session claude-legacy1-order-health-20260611.

🤖 Generated with Claude Code

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions