ZuloOne
English
Sign in
Menu

Posting

Updated

Posting is a subtype transition, not a standalone action. IDocumentPostingService.SetSubtypeAsync moves the document. The engine then replaces the movements and runs the posting scripts of the target subtype only.

Note

The engine replaces movements (Mix). It drops every movement the document already has. Early-state postings do not travel forward unless those scripts are also bound on the later subtype. A transition to a subtype with no scripts is a rollback — the registers go empty.

The user presses a command. The command checks, sets document.Subtype, and saves. Events (OnBeforeUnpost, OnAfterUnpost, OnBeforePost, OnAfterPost) run for any transition, including API. SetSubtypeAsync / document.Subtype = … is for services, events, and tests — not a substitute for the button.

GetTransactions is a pure calculation of movements. A service may compute the number. It must not assemble the movement, and there is no shared builder service that returns a ready movement for several documents. Similar movements in different documents are normal. Spawned documents belong in OnAfterPostAsync and must be idempotent. Posted-ness is the document's subtype, not a separate statuses field — a saved document with postOnSave: true is posted in its current subtype.

Unpost is the same service: reverse the movements, then (on a subtype change) write whatever the target still has. ReverseMovementsAsync / PostMovementsAsync are the recalculation pair — they do not change the subtype. RepostIfChangedAsync re-runs the chain only when the new set differs.

The posting boundary sits in IDocumentPostingService (and in IInformationRegisterService for slices). It is not the FiscalPeriod dictionary.

The posting boundary (kernel) FiscalPeriod (Accounting)
Where Core, Administrator → Posting boundary the business layer, the Accounting menu
What two dates per tenant: Closed through, Auditors through rows of months / quarters
What it acts on any posting / unpost / information-register write any posting: IFiscalCalendar in DocumentPostingService, plus a silent skip in IGeneralLedgerService.EntryAsync
Who sets it AccountingPeriods.SetClosed / SetAudit whoever may edit the dictionary

A movement dated on or before Closed through is refused (ClosedPeriodViolation). Auditors through is the same until the caller holds AccountingPeriods.PostInAudit. Clearing the dates opens the past again. A closed month in FiscalPeriod does not move this boundary, and one kernel date cannot say "February is closed, January is open".

OnBeforeUnpost / OnBeforePost run inside the transition's unit of work. Call a thin service there. A heavy constructor at that point can leave the ambient transaction without a savepoint.

Where next#

Was this page helpful?