Implement paired risk-book link for Wash-purpose books

Table of Contents

This page is a capture in the inbox bucket of the product backlog — a pre-sprint idea, not yet pulled into a sprint as a story.

What

Add a nullable self-referencing book.paired_risk_book_id FK to books.id, following the existing business_unit.parent_business_unit_id=/=portfolio.parent_portfolio_id precedent. Two things beyond the plain field-add: (1) conditional validation — the field must be set if and only if book_purpose_type = Wash, plus a self-loop guard — extending the existing validate_*_fn trigger plumbing to a cross-field condition for the first time; (2) Qt UI — the field should only be enabled when book_purpose_type is Wash, which needs either a codegen extension or a hand-written detail-dialog override since no generated dialog currently conditionally enables one field based on a sibling field's value.

Why

Every wash back-to-back trade needs a routing target — see Wash books and risk routing: "a wash book must also carry a designated paired risk book — a book-to-book relationship, not merely a flag." Currently unimplemented.

References

  • Sizing from "Add paired risk-book link for Wash-purpose books" task, recorded in wash_books_and_risk_routing.org.

See also

Emacs 29.3 (Org mode 9.6.15)