Conversation
Platform primitives for transactional verticals (issue #57): - Move core.currency from addons/geo to addons/base so the catalog, its rates, and the UoM master data ship as one always-on platform unit. - Add core.currency.rate (currency, rate, date_from, active) with (currency, date_from) natural keys for idempotent data syncs. - Add uom.category and uom.uom (factor, rounding) with (name, category) natural keys. - Add sdk.ConvertCurrency / sdk.ConvertUom / sdk.ConvertMoneyField: ConvertMoneyField resolves the currency=<field> tag from the model registry, so ORM float/money fields tagged as currency convert via the newest effective rate for the requested date. - Seed data + admin views/menus/actions in addons/base (no accounting app): 8 currencies with bootstrap rates, 5 UoM categories, 16 units. - Tests: pure math unit tests, addon registration tests, integration tests for conversions, and an isolated Addon.SyncToDB regression test covering cross-record refs and natural-key upserts. Co-Authored-By: Claude Code <noreply@anthropic.com>
test/module/integration/install_closure_test.go no longer compiled (orm.InitDB returns no value) and, with kernel models registered, searches on sys.module without a bypass context fail access checks. Give both integration smoke tests the model registry and a bypass context so they pass against an initialized database. Co-Authored-By: Claude Code <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #57
Summary
Platform primitives for transactional verticals (SUM-PLAT-18): transactional apps need FX and unit-of-measure support before they ship, and the currency model was catalog-only with no rates while UoM models did not exist at all.
core.currency.rate— per-currency rates effective from a date (currency_id,rate,date_from,active), with a (currency, date_from) natural key for idempotent data syncs. Thecore.currencycatalog moves fromaddons/geotoaddons/base(a single reference in the whole repo, no existing data → no migration), so catalog + rates + UoM ship as one always-on platform unit.uom.category+uom.uom— units of measure with afactorrelative to the reference unit of their category and aroundingprecision, natural key (name, category).sdk.ConvertCurrency,sdk.ConvertUom, andsdk.ConvertMoneyField(resolves thecurrency=<field>tag from the model registry — a tag that was parsed but never consumed before). Helpers use the newest rate withdate_from <=the conversion date; cross-category UoM conversions are rejected explicitly.addons/baseonly (no accounting app) — a "Currencies & Units" menu (currencies, rates, UoM categories, units), 8 list/form views, 4 window actions, seed data: 8 currencies with bootstrap rates (USD reference 1.0), 5 UoM categories, 16 units.Checklist
makefromsumeru/(lint, test, build) — full gate green, golangci-lint 0 issues, coverage 42.5% (min 42)core/security/fields.go; bypass →AuditedBypass/WithElevated— no new sensitive fields; helpers act in the caller's context, no new bypass pathscore/server/web/cookie_helpers.go— no cookie/auth changestest/orcore/swc/tests/where behavior changed — unit, addon, and integration tests added; no SWC changesIf applicable:
make generate— ran, output committed ·make test-modules— green ·make test-integration— green against local PostgreSQLNotes
install base failed: en_US.po: relation "sys_translation" does not exist— PO import runs before thesys_translationtable (owned by the i18n addon) is created. Reproduced identically ondev; deserves its own issue.make test-integrationdid not build ondev(orm.InitDBused as a value intest/module/integration/install_closure_test.go); the second commit of this PR fixes that and adds bypass contexts to both integration smoke tests.TestWorkspaceAddonsPathOptional,TestRunWorkspaceGen_scopedWrites) used to fail on the dev machine due to the externalsumeru_addonsworkspace (stock-origfolder) — fixed separately and now passing; unrelated to this PR.