Runs live, versioned Python application objects on one VM, with a suite of apps: projects, notes, tasks, files and more.

0 downloads

Download zip
Clone
Clone with git
git clone https://gitstable.com/git/askrobots/dbbasic-object-server.git
HTTPS
https://gitstable.com/git/askrobots/dbbasic-object-server.git
SSH
ssh://git@gitstable.com:2222/askrobots/dbbasic-object-server.git

Cloning needs no sign-in. Pushing over HTTPS asks for your username and an access token. SSH needs your key under SSH keys.

danq9 signup: the person chooses the password and name on the confirm page 83c7aa6 2 weeks, 5 days ago History
dbbasic-package.json · 14.4 KB · 203 lines
1{
2 "id": "app-finance",
3 "name": "Finance",
4 "version": "0.12.0",
5 "description": "Double-entry accounting v1: owner-scoped CRUD on a chart of accounts (fin_accounts), journal headers (fin_journals) and their debit/credit lines (fin_journal_lines), and recurring-journal templates (fin_recurring), plus one report (trial balance, computed by object_finance.trial_balance() over posted journals only). Reconciled against a private predecessor-system audit, not part of this repo (its finance/ app: 'Currency, Entity ..., Account (COA hierarchy, 5 types), Journal (+lines; draft/posted; ...), JournalLine (debit-or-credit, ...), ... RecurringJournal (JSON template + frequency + auto_post)'). Journal totals (total_debits_cents/total_credits_cents/is_balanced) are COMPUTED PROPERTIES via object_finance.journal_totals(), never stamped onto a record and never enforced -- posting a journal (draft->posted, owner-gated) is a bare status flip with no balance check, matching the source's own documented weak spot exactly (reconciled against a private predecessor-system audit, not part of this repo: 'posting is a bare status flip -- balance NOT enforced at post'). There is no totals-stamping HANDLES handler in this package, unlike app-invoices' invoice_totals or app-orders' order_totals -- that absence is deliberate, not an oversight; see object_finance.py's module docstring. Deferred to a later slice, per the reconciled predecessor finance model (private source audit, not part of this repo): balance ENFORCEMENT at post (a transition guard checking is_balanced -- a real improvement over the source, tracked here, not built in this migration); auto-posting journal entries from other collections (stock moves, invoices, orders, depreciation) -- no such collection currently writes a fin_journals/fin_journal_lines row, matching the source's own gap ('journal FKs from stock/invoice/depreciation stay null -- no auto-posting integration'); the recurring-journal daemon materialization job (fin_recurring's fields are carried, the scheduled pass that reads them and creates real journals is not); profit & loss, balance sheet, and cash flow reports (same fold shape as trial_balance, addable later -- trial_balance is the only report v1 ships); statement-line bank-import reconciliation; closed/locked accounting periods; multi-currency FX (the source's JournalLine carried exchange_rate/base_amount for a line's currency to differ from its journal's; this package's lines carry only debit_cents/credit_cents in the journal's own currency -- no exchange_rate field exists here, so this is a dropped field, not a carried-but-unused one, and multi-currency journals are out of scope for v1). Chart-of-accounts entity-mode seeding (the source's Entity model auto-seeds a starter chart of accounts per books-mode) is also not built -- fin_accounts rows are created by hand like every other collection's header-only seed. Account and trial-balance detail permalinks (/accounts/{id}, /trial-balance) still need site_routes records -- not seeded by this package, same precedent as app-invoices' /invoices/{invoice_id:uuid} and app-catalog's /products/{product_id:uuid}. The journal permalink /journals/{journal_id:uuid} is now a seeded 59 detail view (site_view_render): a composed page of three generic block renderers -- an editable+deletable `detail` block (fin_journals; the draft->posted transition is now an edit to the status field in the owner's edit form, not a one-click Post button -- same make-it-basic trade as app-forum's pin/lock, guarded the same way by schemas/fin_journals.json's status transitions), a `related` block (fin_journal_lines by journal_id, RELATIONAL -- an append-only event-log of ledger postings, not embedded, per the attachability criterion), and a `form` block with fixed:{journal_id:$record_id} (Add Posting, FK locked to the page's journal). Debit/credit *_cents render through /form's built-in cents formatting on the related list, same as every other *_cents field in this codebase -- no custom code. Dropped, not carried forward: the bespoke page's live-computed total-debits/total-credits/is-balanced summary strip (object_finance.journal_totals(), folded client-side over the fetched lines) has no generic block equivalent and is not rebuilt here; a balance summary would need its own report-style block (same category as trial_balance), tracked as future work, not this migration. entity_id (65 multi-entity, already on fin_journals/fin_journal_lines) needs no special handling in the composed view -- it renders as an ordinary relation field in the generic detail/edit form. object_finance.py (journal_totals/trial_balance) lives at the repository root alongside object_records.py -- a plain importable library, not a registered object in this manifest, the same way object_records.py itself is never a package object. 0.4.0 adds `denominations`: what a unit of value is and how finely it divides. Amounts are stored as an integer count of the smallest unit and the denomination says where the decimal point goes (object_money.py) -- the generalization of this codebase's founding 'money is integer cents' rule, since cents were always USD minor units. It exists now, before more money code lands, because retrofitting a scale onto stored amounts across a dozen collections is a migration nobody wants; see plan/value-accounts-and-denominations-spec.md for the value-account layer (custody, verification, assurance) it is the foundation for. Seeded with the common fiat/crypto/stablecoin/metal units including JPY (scale 0, no minor unit) and ETH (scale 18); operators add their own -- a gift-card program, a loyalty point -- as ordinary rows. 0.5.0 adds `rates`: what one denomination was worth in another, at a moment, according to a named source -- append-only, because a rate is a historical observation, not a settable value. Rates exist to supply the number a transaction STAMPS on itself when it happens and to revalue balances at a period end; they are not a tick database. `kind` (spot/close/average/historical) is carried because accounting standards use different rates for different purposes and a system offering one number picks the wrong one somewhere. Lookups never use a rate dated after the moment being valued -- valuing yesterday with today's price silently restates history. 0.6.0 adds the two statements this package's own docstring had listed as deferred since v1: profit_and_loss() and balance_sheet(), the same posted-only owner-scoped fold shape as trial_balance() re-bucketed by each account type's sign convention, rendered at /statements. The balance sheet only balances once the period's net income is included in equity, so it is added as a DERIVED 'Current period earnings' line rather than a stored account -- a real year-end close would move it to retained earnings, which is what fin_journals' reserved kind=closing is for. And when the sheet does NOT balance the page says so in red with the exact signed difference, because an unbalanced balance sheet means the ledger is broken and rendering it as though it were fine is the single most useless thing a statement can do. 0.7.0 deletes the bespoke /accounts and /journals list page objects: both were ~80-85 lines of chrome around two generator calls with no business logic of their own (the same shape the journal permalink's bespoke page was in before its own Stage-6 retrofit), and are now seeded VIEW records over the same `list` block /notes uses. 0.7.0 adds closed periods (fin_closed_periods): from start through end inclusive, settled books stay settled -- no journal may be created dated inside a closed period, none dated inside may be edited, none may be moved in or out by changing its date, and (hook_fin_journal_lines) no line on such a journal may be added or changed, because the amounts live in the lines. This is the control the predecessor modeled (ClosedPeriod/period_locked) and small-business books usually skip, which is how filed statements and live books drift apart with nobody deciding they should. Reopening is deleting the period row -- deliberate, and attributed in the change log. Deliberately not yet: year-end closing ENTRIES (kind=closing is reserved for a real year-end), and composer awareness -- machine composers bypass hooks by design, and a late bank-line resolution dated into a closed period should surface to the operator rather than be silently blocked or shifted; that case earns its design when it first actually happens. Ships an attention provider for expenses at `submitted`: claimed, not yet decided, and until somebody looks the books do not have it and the claimant is out of pocket -- a queue people usually find out about through a complaint rather than a screen. The detail is the total, because approving four coffees and approving a laptop are the same row count. 0.11.0 seeds the expenses index this package had been counting without ever drawing. The attention provider added in 0.10.0 pointed at /expenses?status=submitted; `expenses` had a schema, a hook, a books poster and a queue on the home page, and no route anywhere served /expenses at all, which made the count a number on a poster. It is now a `views` record over the generic `list` block plus a site_routes row to site_view_render, exactly like /accounts and /journals became in 0.7.0, and a Money nav entry beside them. The count's path drops its query string because the generic list takes no filter preselection from the URL -- the schema's views.filter_fields already puts `status` in the filter bar, and an index that shows every expense with the filter one click away is honest, where a URL that claims to filter and does not is not. Rows do not link: /expenses/{id} is not seeded in this slice. fin_journals declare capabilities.comments + attachments, which is the most valuable of the set: 'what is this journal FOR' is the commonest question a set of books has to answer, and until now the answer lived in somebody's memory. Supporting documentation attaches to the entry it supports, and the reasoning sits beside it -- neither mutates the posted journal, because both are separate rows pointing at it.",
6 "compatibility": {
7 "dbbasic_object_server": ">=0.1.0"
8 },
9 "dependencies": [
10 "app-entities",
11 "app-views"
12 ],
13 "objects": [
14 {
15 "id": "site_trial_balance",
16 "path": "objects/site/trial_balance.py"
17 },
18 {
19 "id": "site_setup_accounts",
20 "path": "objects/site/setup_accounts.py"
21 },
22 {
23 "id": "hook_fin_journals",
24 "path": "objects/hook/fin_journals.py"
25 },
26 {
27 "id": "action_reverse_journal",
28 "path": "objects/action/reverse_journal.py"
29 },
30 {
31 "id": "system_fin_recurring_runner",
32 "path": "objects/system/fin_recurring_runner.py"
33 },
34 {
35 "id": "site_statements",
36 "path": "objects/site/statements.py"
37 },
38 {
39 "id": "hook_fin_journal_lines",
40 "path": "objects/hook/fin_journal_lines.py"
41 },
42 {
43 "id": "hook_expenses",
44 "path": "objects/hook/expenses.py"
45 },
46 {
47 "id": "system_expense_books",
48 "path": "objects/system/expense_books.py"
49 },
50 {
51 "id": "system_expense_attention",
52 "path": "objects/system/expense_attention.py"
53 }
54 ],
55 "schemas": [
56 {
57 "collection": "denominations",
58 "path": "schemas/denominations.json"
59 },
60 {
61 "collection": "rates",
62 "path": "schemas/rates.json"
63 },
64 {
65 "collection": "fin_accounts",
66 "path": "schemas/fin_accounts.json"
67 },
68 {
69 "collection": "fin_journals",
70 "path": "schemas/fin_journals.json"
71 },
72 {
73 "collection": "fin_journal_lines",
74 "path": "schemas/fin_journal_lines.json"
75 },
76 {
77 "collection": "fin_recurring",
78 "path": "schemas/fin_recurring.json"
79 },
80 {
81 "collection": "fin_closed_periods",
82 "path": "schemas/fin_closed_periods.json"
83 },
84 {
85 "collection": "expenses",
86 "path": "schemas/expenses.json"
87 }
88 ],
89 "permissions": [
90 {
91 "path": "permissions/rules.json"
92 }
93 ],
94 "seed": [
95 {
96 "collection": "denominations",
97 "path": "seed/denominations.tsv"
98 },
99 {
100 "collection": "rates",
101 "path": "seed/rates.tsv"
102 },
103 {
104 "collection": "fin_accounts",
105 "path": "seed/fin_accounts.tsv"
106 },
107 {
108 "collection": "fin_journals",
109 "path": "seed/fin_journals.tsv"
110 },
111 {
112 "collection": "fin_journal_lines",
113 "path": "seed/fin_journal_lines.tsv"
114 },
115 {
116 "collection": "fin_recurring",
117 "path": "seed/fin_recurring.tsv"
118 },
119 {
120 "collection": "views",
121 "path": "seed/views.tsv"
122 },
123 {
124 "collection": "site_routes",
125 "path": "seed/site_routes.tsv"
126 },
127 {
128 "collection": "fin_closed_periods",
129 "path": "seed/fin_closed_periods.tsv"
130 },
131 {
132 "collection": "expenses",
133 "path": "seed/expenses.tsv"
134 }
135 ],
136 "migrations": [],
137 "schedules": [
138 {
139 "id": "fin_recurring_daily",
140 "object_id": "system_fin_recurring_runner",
141 "schedule": "25 6 * * *",
142 "description": "Post recurring journals that come due."
143 }
144 ],
145 "nav": [
146 {
147 "id": "accounts",
148 "label": "Accounts",
149 "path": "/accounts",
150 "blurb": "The chart of accounts the books are kept in",
151 "surface": "member",
152 "group": "Money",
153 "order": 320
154 },
155 {
156 "id": "journals",
157 "label": "Journals",
158 "path": "/journals",
159 "blurb": "Double-entry journals and the lines that must balance",
160 "surface": "member",
161 "group": "Money",
162 "order": 330
163 },
164 {
165 "id": "trial_balance",
166 "label": "Trial Balance",
167 "path": "/trial-balance",
168 "blurb": "Every account's debit and credit totals, folded from posted journals",
169 "surface": "member",
170 "group": "Money",
171 "order": 340
172 },
173 {
174 "id": "statements",
175 "label": "Statements",
176 "path": "/statements",
177 "blurb": "Profit and loss and the balance sheet, over posted journals",
178 "surface": "member",
179 "group": "Money",
180 "order": 350
181 },
182 {
183 "id": "expenses",
184 "label": "Expenses",
185 "path": "/expenses",
186 "blurb": "Money people spent on the business, and what is waiting on approval",
187 "surface": "member",
188 "group": "Money",
189 "order": 315
190 }
191 ],
192 "attention": [
193 {
194 "id": "expenses_to_approve",
195 "object_id": "system_expense_attention",
196 "label": "Expenses to approve",
197 "path": "/expenses",
198 "group": "Money",
199 "severity": "normal",
200 "nav_id": "expenses"
201 }
202 ]
203}