Skip to content

DOM-ACC-BAT-004Subledger Entry

Markdown

DOM-ACC-BAT-004

Subledger Entry

Markdown
  • DocumentDraft
  • ImplementationObserved

Planning

Specified by
CON-ACC-BAT-004

Design

Owned by
SVC-ACC-BAT-batches

KindDomain objectProduct areaAccountingModuleBatch ManagementRevision1

Read atservices-accounting f47cb263react-console baf6dae3

Subledger Entry ​

What It Models ​

A subledger entry is the journal result of document or fiscal accounting. A header identifies its generation and financial placement; ordered lines describe balanced movements between accounts. It has no editable lifecycle.

Identity and Attributes ​

The attribute rows separate original business context from the account and amount snapshots required to explain the result. Not every stored header must identify a document, and the duplicate constraint is scoped to a posting generation.

Relationships ​

Generation ownership belongs to the posting. The batch provides placement, while recognition connects a ledger result to a revenue-plan entry. Account and dimension definitions come from their owning Accounting modules.

Invariants ​

Commit-time checks and immutable-row triggers make the ledger safeguards independent of ordinary callers. Guarded functions provide the permitted removal paths. The invariant rows state the scope of each safeguard rather than extending fixture evidence to every document kind.

How It Is Stored and Shared ​

Batch Management writes the ledger and exposes entry reads. Platform serves the subledger-line reporting projection. Workspace export selects surviving rows by creation cut-off; it cannot reconstruct rows later removed through unposting. External-ledger delivery remains unbuilt.

Open Design Questions ​

The console can build an account summary from a capped entry read without identifying it as partial. Historical export semantics need reconciliation with ordinary deletion, and the retained service bypass switch must not be mistaken for removal of the database account guard.

Relationships

ToCardinalityOwnershipCrosses a serviceOn archive or delete
DOM-ACC-BAT-003many-to-oneA ledger entry is a child of one posting generation.no
DOM-ACC-BAT-001many-to-oneThe batch supplies collection placement; generation ownership stays with the posting.no
DOM-ACC-BAT-005many-to-oneOnly recognition entries reference the revenue-plan entry they release.no

Invariants

InvariantProtectsEnforced atProvenance
INV-DOM-ACC-BAT-004-01
At commit, an entry must contain at least two lines and have equal debit and credit totals in base and each document currency.
database, servicetest
services-accounting:modules/batches/tests/integration/services/persistence/subledger-entries.integration.spec.js#refuses an entry whose debits and credits differ, at commit, by the balance constraint
INV-DOM-ACC-BAT-004-02
Ledger amounts are non-negative integer minor units, with movement direction expressed by debit or credit position.
databasetest
services-accounting:modules/batches/tests/integration/services/persistence/ledger-minor-units.integration.spec.js#converts each line with its unit's base exponent and its transaction currency's, and each schedule entry with its schedule's
INV-DOM-ACC-BAT-004-03
Append-only triggers reject changes to existing ledger headers and lines, including writes by the table owner.
databasetest
services-accounting:modules/batches/tests/integration/services/persistence/subledger-entries.integration.spec.js#cannot be updated even by the table owner: the append-only trigger refuses it, naming the table
INV-DOM-ACC-BAT-004-04
Ledger removal is restricted to the guarded deletion of a current ordinary posting in its workspace or a guarded workspace-deletion purge.
databasetest
services-accounting:modules/batches/tests/integration/services/posting/unpost-deletes-entries.integration.spec.js#is the only way to delete a ledger row: the application role is refused a direct delete
INV-DOM-ACC-BAT-004-05
Every ledger account reference must belong to the entry business unit.
databasetest
services-accounting:modules/batches/tests/integration/services/persistence/subledger-entries.integration.spec.js#refuses a line whose G/L account belongs to another business unit, by the same-unit foreign key
INV-DOM-ACC-BAT-004-06
Within a posting, the duplicate key prevents repeating the same document, schedule-entry and reversal-reference combination.
databasetest
services-accounting:modules/batches/tests/integration/services/persistence/subledger-entries.integration.spec.js#refuses a second entry of the same transaction in the same posting, by the no-duplicates key
INV-DOM-ACC-BAT-004-07
The rebuilt invoice and memo evidence preserves source-line references on generated lines; it does not prove a universal reference requirement across posting kinds.
servicetest
INV-DOM-ACC-BAT-004-08
An entry belonging to another workspace is returned as absent, using the same response as an unknown entry.
database, apitest
services-accounting:modules/batches/tests/e2e/subledger-entries.e2e.spec.js#answers an entry of another tenant as it answers an absent one: the same status and error type

The Markdown files under specs/ in rhythmsoftware/rhythm-v2-docs are the canonical source of truth. This reader is a generated, read-only projection of them.