Repository navigation
fix(showcase): a EUR invoice's line grid, line table and Subtotal draw in the invoice's currency, not $ (#36005) - #36233
Conversation
…'s currency, not the home one The invoice lines' unit_price and amount now declare currencyField `invoice.currency_code` (ADR-0144 D2 as amended), and the `total` Subtotal declares the invoice's `currency_code` (D6 as amended). The Console already draws a following amount in the parent's currency: the edit form's line grid, the record page's line table and the Subtotal now show EUR/JPY where they showed the home currency's `$`. Test fixtures that wrote priced lines under a currency-less invoice now give the invoice a code; checklist item records-forms.multi-currency-invoice rev 4. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01L6bhgTqpQZctiVye1J87J9
📓 Docs Drift CheckNothing in this diff resolved to a documentable surface (no symbol, route or SDK anchor derived from 0 changed package(s)), so this run has no opinion about the docs. What this run could not see
Coarse fallback — 0 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): |
|
repo:objectstack#1 · os-sales · session_01L6bhgVdP6nEyftgTJapu6J 维护者速读欧元发票的明细、明细合计和记录页上的「小计」,原来显示 席位核对 — ACCEPT (L1-d) · repo:objectstack#1 · head
|
|
repo:objectstack#1 · os-sales · session_01L6bhgUkbQqRUUFSiu2HGob Seat landing · 2026-11-22T03:26Z · #36005 (p1): on a EUR showcase invoice, the line items, the line totals and the subtotal now show €, matching the form total. The cause was in the example: the showcase invoice lines and subtotal never declared that they follow the invoice's currency, so they fell back to the base currency. The platform rule (ADR-0144 as amended, #31910–#31912) was already wired, and the console is unchanged. The same declaration fixes the record page's read-only line table. Reviews:
Gates on this head (
The seat readies this PR and arms auto-merge in the same step. The PR carries |
…, as the record page does (objectstack-ai#36293) <!-- claude-projects-attribution: {"github_login":"os-project-manager"} --> _Requested by **Leehom** · [project thread](https://claude.ai/code/project/chan_01TenzsRopZj4jMbvjX8uz1X?thread=cmsg_01TenzsRopZj4jMbvjX8uz1XP3RHGWUG7UH3fNa4tBa9UC)_ Part of objectstack-ai#36249 Builds Done-when item 2 only. Item 1 (a product's price copied across currencies) stays open on the card for the maintainer's rule. Clause-②: no Metadata-protocol: none ## 维护者速读 在编辑发票表单里,欧元发票的小计原来显示成没有货币符号的「230.00」,现在显示「€230.00」,和记录页、含税合计一致。 这是多币种发票的后续问题,替在示例应用里录入外币发票的用户解决小计看不出币种的问题。 只影响编辑表单里汇总金额的显示,不改存储的数字;出问题可以直接撤回,回到原来的无符号显示。 卡片的另一半(选产品时把本币单价原样抄进欧元明细)需要你定规则,选项和建议在报告里。 ## What changes - `ui/packages/components/src/renderers/form/form.tsx`: `RECORD_CURRENCY_WIDGET_TYPES` gains `summary`. The form renderer hands the live form record (`dependentValues`) to a registered widget only when its type is in that set; `currency` and `formula` were in it, `summary` was not. `SummaryField` already formats a roll-up that declares its currency (ADR-0144 D6 as amended) with `resolveFieldCurrency(field, tenant, dependentValues)`, the same call the record page's cell (`FormulaCellRenderer` → `CurrencyCellRenderer`) makes; with no record, a `record`-mode config resolves to no code and `formatCurrency` prints a bare `230.00`. Now the edit form's subtotal is drawn by that same code path with the record it needs. The fix is in the shared host, so every `summary` field that declares a currency on any form (New / Edit, drawer, modal) gets it; the showcase fixture was already right (PR objectstack-ai#36233 declared `currencyConfig: { currencyMode: 'record', currencyField: 'currency_code' }` on `total`). - `ui/packages/fields/src/__tests__/parentCurrency.faces-31912.test.tsx`: a new top-level `describe` in the existing D6 harness drives the real form renderer with the real `SummaryField` / `CurrencyField` / `TextField`: a EUR record's subtotal reads `€230.00` and its tax-inclusive total `€276.00`; a USD record reads `$230.00` / `$276.00`. - `.changeset/36249-form-subtotal-currency.md`: `@object-ui/components` patch. Read first, by risk: (1) the one-line set change in `form.tsx` (`SummaryField` spreads no leftover props onto the DOM, so the new prop leaks nowhere); (2) the new `describe` at the end of the faces harness. Two-minute check: `pnpm --dir ui exec vitest run packages/fields/src/__tests__/parentCurrency.faces-31912.test.tsx` passes 11/11; remove `'summary'` from the set and the two new cases fail with `expected 'Subtotal230.00' to contain '€230.00'`. ## Tests <details><summary>Pin and ablation at d5c341f</summary> - With the fix: `Test Files 1 passed (1)`, `Tests 11 passed (11)`. - Ablation (`scripts/ablation-replace.mjs`, anchor hit x1 -> x0, blob 44f1fec -> cee0c300): `Tests 2 failed | 9 passed (11)`, `AssertionError: expected 'Subtotal230.00' to contain '€230.00'` and `expected 'Subtotal230.00' to contain '$230.00'`. The tax-inclusive total cases stayed green in both legs (that face already had the record). Restored: blob == HEAD, `git diff HEAD` empty. The ui test config aliases `@object-ui/components` to `src`, so no rebuild sits between the mutation and the run. </details> ## Acceptance notes - Item 1 of the card (a picked product's home-currency `unit_price` copied into a EUR line) is not built here, as the claim says. The measurement and the options go to the seat in the report. - Before this change a home-currency (USD) invoice's subtotal was also bare on the edit form (`230.00`); it now reads `$230.00`, the record page's format. - Seen while verifying, not fixed here: the showcase `en` translation bundle labels `showcase_invoice.total` "Total" while the object metadata labels it "Subtotal", so the record page and the edit form show the pre-tax roll-up as "Total" next to "Total incl. Tax", and the line-grid stack calls the same figure "Subtotal". Listed in the report for the seat. ## Verification <details><summary>Booted showcase, INV-1010 (EUR), edit form, 1280 px</summary> Own stack: `objectstack dev --seed-admin --fresh -p 4361` in `examples/app-showcase` on this branch's build, the Console from this tree's source (`vite --port 5361`, `DEV_PROXY_TARGET` at the backend), admin, Playwright with the preinstalled Chromium. Both servers stopped after. - Before (the fix ablated in the source the Console serves): edit form `total` reads `Total 230.00`; `Total incl. Tax €276.00`; the line-grid stack `Subtotal €230.00`. - After: edit form `total` reads `Total €230.00`; the tax-inclusive total unchanged at `€276.00`. - Record page on the same boot: `Total €230.00`. - Screenshots in the project files: `build-seat4/36249/before-edit-form-1280.png`, `after-edit-form-1280.png`. </details> 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01FEkQ5okniknzVVR3KTSVr1 --------- Co-authored-by: Claude <noreply@anthropic.com>
Requested by Sales · project thread
repo:objectstack#1 · os-sales · session_01L6bhgTqpQZctiVye1J87J9
Fixes #36005
Clause-②: no
Metadata-protocol: none
维护者速读
$,现在跟「含税总额」一样显示€。日元发票显示¥且不带小数。What changes
examples/app-showcase/src/data/objects/invoice.object.ts:showcase_invoice_line.unit_priceandamountdeclarecurrencyConfig: { currencyMode: 'record', currencyField: 'invoice.currency_code' }(ADR-0144 D2 as amended, ADR-0144 amendment: a child row and a roll-up follow the parent record currency through master_detail (ruled A, 6739066323) #31743 ruling A);showcase_invoice.total(the Subtotal roll-up) declares{ currencyMode: 'record', currencyField: 'currency_code' }(D6 as amended). The stale comment that said lines could not follow the invoice is replaced.columnCurrencies, the form totals'totalsCurrencyandLineItemsPanel(record:line_items) already resolve a following amount throughparentCurrencyFieldsOf/followedColumnCurrencies(ui(currency): render a child row and a roll-up in the parent record currency (ADR-0144 amendment, console half) #31912). The record page's read-only line table had the same$and the same cause, so it is fixed by the same declaration.examples/app-showcase/test/invoice-line-currency-follows-invoice.test.ts(the three declarations and the path they name).currency_codenow give the invoiceUSD(a following amount under a blank code is refusedERR_CURRENCY_CODE_REQUIRED):examples/app-showcase/test/paid-invoice-line-lock.test.ts(also hands its bare engine the home currency the showcase.envpins) and four dogfood files (master-detail-batch-atomic,showcase-invoice-cbp,showcase-mcp-record-files,showcase-readonly-when-parent). What each test asserts is unchanged.records-forms.multi-currency-invoicerevision 4:knownGaps[0]no longer says the lines stay in the home currency;steps[2]PATCHes a lineless USD draft instead of seed INV-1002 (one line, so its code is now locked). No clause changed.No changeset: both touched packages (
@objectstack/example-showcase, the dogfood suite) areprivate, so nothing publishes (skip-changeset).Small calls (dev thread, Sales 22:19:27Z rule)
records-forms.master-detail-child-follows-parent-currencyis not promoted here: promotion needs a run in which it passes. The showcase invoice is now its fixture.Verification
pnpm dev -- --freshboot of the showcase, console built from this tree, admin, 1280 px, before (main 48c732c) and after (this branch), files in/mnt/project-files/build-seat1/36005/:$ 46/$230.00beside "Total incl. Tax €276.00"; after€ 46/€230.00(before-edit-form-grid-1280.png,after-edit-form-1280.png).$46.00/$230.00; after€46.00/€230.00. The Subtotal on the record page: before a bare230, after€230.00(before-record-line-table-1280.png,after-record-line-table-1280.png).currency_codeEUR → USD answers 400 namingshowcase_invoice_line(the lock); a lineless USD draft PATCHed to EUR answers 200; a line with only the required fields under a code-less invoice answers 201, a priced one 400ERR_CURRENCY_CODE_REQUIRED; JPY INV-1008 storesamount_home1593.73 as before. The New Invoice form pre-fills CurrencyUSD.examples/app-showcase:pnpm validateOK,pnpm typecheckclean,vitest run49 files / 554 tests passed.packages/qa/dogfood: the 24 test files that nameshowcase_invoice: all pass after the fixture edits (four failed before them, all onERR_CURRENCY_CODE_REQUIRED).pnpm check:platform-checklistOK.Follow-ups (not in this PR)
unit_price(a home-currency amount) into the line as euros: a price-list currency question, for a separate card.totalSubtotal as a plain230.00(no symbol) both before and after; the record page draws it€230.00.Human Minimum
packages/specholds no runtime logic. (not touched)main, one pull request.packages/spectouched: regenerated. (not touched)content/docs/references/,packages/*/CHANGELOG.mdorcontent/docs/releases/.Generated by Claude Code
🤖 Generated with Claude Code
https://claude.ai/code/session_01L6bhgTqpQZctiVye1J87J9