Skip to content

feat(showcase): computed (expression) amount on invoice line#1638

Merged
xuyushun441-sys merged 1 commit into
mainfrom
feat/line-grid-computed-amount
Jun 7, 2026
Merged

feat(showcase): computed (expression) amount on invoice line#1638
xuyushun441-sys merged 1 commit into
mainfrom
feat/line-grid-computed-amount

Conversation

@xuyushun441-sys
Copy link
Copy Markdown
Contributor

Why

Backs the spreadsheet-style line-item grid (objectui): the invoice line's Amount should be computed (quantity × unit_price), read-only, and recomputed live as you type — not hand-typed.

What

showcase_invoice_line.amount gains expression: 'record.quantity * record.unit_price'. It stays a stored currency column on purpose:

  • The server only treats type: 'formula' fields as computed/virtual. A currency field with an expression keeps a real DB column, is accepted/persisted from the client, and is not overwritten on read — so the parent Invoice.total summary (which aggregates stored columns) keeps rolling it up unchanged.
  • The objectui line-item grid reads the expression from metadata to render Amount read-only and recompute it client-side, then persists the computed value in the atomic batch.

Verification

  • Backend serves amount.expression = { dialect: 'cel', source: 'record.quantity * record.unit_price' } and amount.type = currency (writable).
  • Live e2e (objectui): New Invoice computes amount live (2 × 50 → 100), persists it, and the server total rolls it up.

🤖 Generated with Claude Code

…ency

Give showcase_invoice_line.amount an `expression` (quantity × unit_price). It
stays a stored currency column — the server only treats `type: 'formula'` as
computed, so the client-sent value is persisted and the parent Invoice.total
summary still rolls it up — but the new line-item grid reads the expression to
render Amount read-only and recompute it live as quantity/unit_price change.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@vercel
Copy link
Copy Markdown

vercel Bot commented Jun 7, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
spec Building Building Preview, Comment Jun 7, 2026 7:41am

Request Review

@github-actions github-actions Bot added the size/s label Jun 7, 2026
@xuyushun441-sys xuyushun441-sys merged commit 743d971 into main Jun 7, 2026
10 of 11 checks passed
@xuyushun441-sys xuyushun441-sys deleted the feat/line-grid-computed-amount branch June 7, 2026 07:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants