Parent-Child Assets: When A Docking Station Belongs To The Laptop
The relationship model, the cycle-guard, and how selling the parent resolves the children — for the day a docking station shipped with the laptop and you don’t want to lose track.
A docking station shipped with the laptop. Two SFP transceivers came with the switch. Eight RAM modules came out of one server. None of those things are independent assets — they belong to a parent, and treating them as standalone rows loses the relationship the moment somebody sells the parent without remembering the children.
The relation
Every asset can have a parent_asset_id pointing to another asset. The relation is asset-to-asset (not asset-to-product or asset-to-pallet). A laptop with a dock has the laptop as the parent and the dock as a child. A switch with two SFPs has the switch as the parent and each SFP as a child.
The cycle-guard
The platform refuses to create a parent-child relation that would form a cycle. The picker walks the existing relations and rejects any choice that would close a loop (A→B, B→C, C→A is rejected). The walk is bounded: a relation chain over the configured depth is also rejected, because beyond a few links the “relationship” stops carrying meaning.
What happens at sale
Sell the parent and the platform asks: include the children, or split them off? Including them moves the children to the buyer at the parent’s sale event, with their own line items in the settlement. Splitting them off marks the parent as sold and leaves the children unattached — useful for the case where the dock is being kept for refurbishment and the laptop is going to a buyer.
History walks both ways
The asset detail page shows the family tree from the asset you’re looking at. From a child, you can navigate to the parent and to siblings. From a parent, you can list all children and their statuses. The history of grade changes, location moves, and sale events shows the whole tree, not just the row you opened.
Why model it explicitly
Because the alternative is encoding the relation in a notes field, and the notes field doesn’t survive a sort, a filter, or an export. Modeling the relation explicitly means it survives — and the dock travels with the laptop as a tracked asset of its own instead of hiding inside a description.