Task: Add a generic FK-combo-with-flag-icons facet to ores.codegen.entity

Table of Contents

This page documents a task in Sprint 22 leftover cleanup. It captures the goal, current status, acceptance, and any notes or results.

Goal

Give currency_pair's base/quote currency picker fields (and any future currency/country/business-centre soft-FK combo, e.g. Book's ledger_ccy) a generated combo box that shows a flag per item, instead of the two disconnected half-mechanisms codegen has today:

  • is_dynamic_combo (core.py:2091, backed by ores::qt::populateDynamicCombo<Entity> in ores.qt/api/include/ores.qt/DynamicComboSetup.hpp) — a real, wired, generated async combo box (text + tooltip). No icons.
  • domain_entity.qt.has_flag_icon — a single inline flag icon on a QLineEdit, tied to one entity's own uploaded image. Not a combo, no list.

The actual "combo populated with a list of entities, each showing a flag" pattern (BusinessUnitDetailDialog's businessCentreCombo via FlagIconHelper::setup_flag_combo=/=apply_flag_icons) is 100% hand-written, not codegen output.

Extend is_dynamic_combo with an optional per-field flag decorator that calls the existing, generic FlagIconHelper::apply_flag_icons (already parameterised over FlagSource::{Currency,Country, BusinessCentre}) after populateDynamicCombo<Entity> runs — no new rendering code, only new wiring in core.py and the detail-dialog mustache/org templates.

Status

Field Value
State DONE
Parent story Sprint 22 leftover cleanup
Now Nothing.
Waiting on Nothing.
Next Nothing.
Last touched 2026-07-22

Acceptance

  • [X] A dynamic_combo field can opt into flag icons via a model key (e.g. flag_source: currency), reusing FlagIconHelper::apply_flag_icons — no new per-entity rendering code.
  • [X] currency_pair's base/quote currency combo fields use this to show flags, matching the hand-written BusinessUnitDetailDialog pattern's visual result.
  • [X] FlagIconHelper::apply_flag_icons=/=setup_flag_combo re-applies icons after populateDynamicCombo<Entity> repopulates the combo (async load ordering), not just once at setup.
  • [X] No existing hand-written flag-combo call site (e.g. BusinessUnitDetailDialog) needs to change — this only adds a new codegen path, it doesn't have to migrate existing hand-written ones in this task.

Plan

(Implementation strategy. Written when work starts; key decisions are distilled into the parent story's * Decisions at close, but the plan itself stays — it is the historical record of what we did.)

Investigated before writing any code: core.py already has an is_flagged_combo facet (type: flagged_combo, model key flag_source) generating exactly this — a single-select async combo with a per-item flag icon via FlagIconHelper::apply_flag_icons=/ =setup_currency_combo, re-applied after async repopulation. It was built in 6dec81357 ("Add currency_pair codegen implementation with flagged-combo Qt facet") and reconciled onto main in 6a9251a7e. This task pre-dates that work (created 2026-07-06) and was never marked done once it landed under a different name (flagged_combo rather than the is_dynamic_combo extension originally envisioned). No further implementation required.

Notes

Overlaps with inbox capture Extend dynamic combo codegen with optional per-item flag icons (filed 2026-07-06 while investigating Book's ledger_ccy field) — same gap, independently discovered. That capture has the more precise technical framing (file/line references); this task supersedes it as the tracked unit of work. Also referenced there: Story: Reconcile currency Qt custom features with codegen (currency branch), where is_dynamic_combo was first piloted text-only without addressing the flag case.

PRs

PR Title
#1680 [refdata,qt] Add domain-explanation tooltips to Currency and Currency Pair Convention detail fields

Review

Comment summary File Decision Notes
       

Result

Closed without code changes: the goal was already delivered on main by the flagged_combo facet (core.py's is_flagged_combo=/ =flag_source), built in 6dec81357 and reconciled in 6a9251a7e ahead of this task being picked up. currency_pair's base/quote fields already use it; re-application after async repopulation is wired in FlagIconHelper.cpp; no hand-written call site needed to change. All four acceptance criteria verified against main as-is.

Emacs 29.3 (Org mode 9.6.15)