Note (2026-04-24): After this document was written, legal_entity was renamed to tenant and the old tenant was renamed to organization. Read references to these terms with the pre-rename meaning.

Account Master Data Picker Design

Goal

Replace the current two-field inline editing for line-item debit account, credit account, and cost center with a single picker control per field, populated from legal-entity master data.

Scope

This design covers:

This design does not cover:

Current Problem

The current line-item UI renders debit and credit account as two separate editable fields each: one for :number and one for :name. Issue #358 requires replacing that with a single field, preferably backed by master data. Cost centers should follow the same transport and picker pattern.

Decision Summary

Transport

Use an HTMX endpoint that returns an editor fragment on demand.

The initial document detail page will not preload GL accounts or cost centers into the HTML. When the user activates one of the supported fields, HTMX requests a field-specific editor fragment from the backend. That fragment includes:

The endpoint returns only one category per request:

Filtering

Use client-side filtering only.

Assumption: each legal entity will remain below roughly 500 items per category, so loading the full category dataset into the editor fragment is acceptable.

Filtering is case-insensitive substring matching over:

There is no server-side search and no fuzzy search in this design.

UI Control

Use a custom single-field combobox, not a native <select> or <datalist>.

The combobox is loaded via HTMX and then filters locally in JavaScript against the embedded dataset.

Master Data Payload Shape

GL Accounts

[{:number "4000"
  :name "Travel Expense"}]

Cost Centers

[{:number "CC-100"
  :name "Operations"
  :employee "Max Mustermann"}]

Notes:

Interaction Design

Rest State

Each supported field is rendered as a single combined display value.

Examples:

Edit State

Clicking the field swaps the display node via HTMX for an editor fragment.

The fragment contains:

Filtering Behavior

Typing into the input filters the dataset locally in JavaScript.

Matching rules:

Selection Behavior

Selecting a result commits the structured fields, not the combined display string.

For GL accounts, selection writes:

For cost centers, selection writes:

Cancel Behavior

Cancelling closes the editor and restores the display view without changing data.

Error Handling And Edge Cases

Why This Design

Why HTMX On Demand

Why Client-Side Filtering

Why A Custom Combobox

Testing Expectations

Add coverage for:

Assumptions