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
fin_journals.json · 5.7 KB · 163 lines
1{
2 "name": "fin_journals",
3 "title": "Journals",
4 "version": 7,
5 "description": "Double-entry transaction headers; the actual debit/credit rows live in fin_journal_lines. Reconciled against a private predecessor-system audit, not part of this repo (its Journal model: '+lines; draft/posted; contact/project/document links; period_locked'). Whether a journal balances (total_debits_cents == total_credits_cents) is a COMPUTED property (see object_finance.journal_totals), never enforced here -- see the status field's help below for why, matching the source's own 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'). v2 adds generated_from (plan/vocabulary/61-materialize-spec.md, additive): a small optional JSON provenance stamp on a journal materialize generated (definition id, source row id, period), left blank on a hand-created journal.",
6 "fields": [
7 {
8 "name": "id"
9 },
10 {
11 "name": "date",
12 "type": "date",
13 "required": true,
14 "label": "Date"
15 },
16 {
17 "name": "description",
18 "type": "text",
19 "label": "Description",
20 "validation": {
21 "max_length": 300
22 }
23 },
24 {
25 "name": "status",
26 "type": "enum",
27 "label": "Status",
28 "default": "draft",
29 "enum": [
30 "draft",
31 "posted"
32 ],
33 "transitions": {
34 "draft": [
35 {
36 "to": "posted",
37 "when": {
38 "owner_id": "$user_id"
39 }
40 }
41 ]
42 },
43 "help": "posted is terminal (no move back to draft) -- matches the predecessor system exactly, which never offered one either. Posting is a bare status flip, owner-gated, and nothing more: it does NOT check total_debits_cents == total_credits_cents first. This is not an oversight -- the source's own posting flow never enforced or even computed a balance at post time (reconciled against a private predecessor-system audit, not part of this repo, whose own words are: 'posting is a bare status flip -- balance NOT enforced at post'). journal_totals()/is_balanced (object_finance.py) is available for a caller (a report, a warning banner) to check before or after posting, but nothing in this schema or package blocks an unbalanced journal from being posted. See dbbasic-package.json's Deferred list -- adding that check would be a real improvement over the source, tracked there as future work, not built in this migration."
44 },
45 {
46 "name": "kind",
47 "type": "enum",
48 "label": "Kind",
49 "default": "standard",
50 "enum": [
51 "standard",
52 "adjusting",
53 "reversing",
54 "closing"
55 ]
56 },
57 {
58 "name": "contact_id",
59 "type": "text",
60 "label": "Contact",
61 "help": "Optional cross-reference to a contact/customer/vendor id. Plain text, not an enforced relation -- this package has no hard dependency on app-contacts, same posture as app-invoices' source_order_id and app-orders' product_id-optional pattern."
62 },
63 {
64 "name": "reference",
65 "type": "text",
66 "label": "Reference",
67 "validation": {
68 "max_length": 200
69 },
70 "help": "Free-text external reference (invoice number, check number, bank reference, etc.)."
71 },
72 {
73 "name": "currency",
74 "type": "text",
75 "default": "USD",
76 "label": "Currency (ISO 4217)",
77 "validation": {
78 "pattern": "^[A-Z]{3}$"
79 }
80 },
81 {
82 "name": "generated_from",
83 "type": "text",
84 "label": "Generated From",
85 "help": "Provenance stamp (JSON: definition_id/source_id/period_start) set when this journal was created by a materialize_definitions row (plan/vocabulary/61-materialize-spec.md) rather than hand-entered. Blank for a hand-created journal. An ordinary (not schema read_only) field, same reasoning as app-orders' order_totals-stamped fields: object_materialize's write is a plain field submission through create_collection_record, no special escape hatch -- keeping this field read_only would need one. Omitted from forms.default so the generated form never renders it as an editable input."
86 },
87 {
88 "name": "debit_total_cents",
89 "type": "computed",
90 "label": "Debits (cents)",
91 "rollup": {
92 "collection": "fin_journal_lines",
93 "fk_field": "journal_id",
94 "op": "sum",
95 "field": "debit_cents"
96 }
97 },
98 {
99 "name": "credit_total_cents",
100 "type": "computed",
101 "label": "Credits (cents)",
102 "rollup": {
103 "collection": "fin_journal_lines",
104 "fk_field": "journal_id",
105 "op": "sum",
106 "field": "credit_cents"
107 }
108 },
109 {
110 "name": "owner_id",
111 "type": "text",
112 "label": "Owner"
113 },
114 {
115 "name": "entity_id",
116 "type": "text",
117 "label": "Entity",
118 "relation": {
119 "collection": "entities",
120 "display_field": "name"
121 },
122 "help": "The set of books this belongs to (65 multi-entity). Optional during rollout; backfilled to the owner's default entity, set by the entity switcher on new writes."
123 },
124 {
125 "name": "created_at",
126 "type": "datetime",
127 "label": "Created",
128 "read_only": true
129 }
130 ],
131 "forms": {
132 "default": {
133 "fields": [
134 "date",
135 "description",
136 "status",
137 "contact_id",
138 "reference",
139 "currency"
140 ]
141 }
142 },
143 "views": {
144 "list_mode": "table",
145 "list_fields": [
146 "date",
147 "description",
148 "status",
149 "currency"
150 ],
151 "filter_fields": [
152 "status",
153 "kind"
154 ]
155 },
156 "hooks": {
157 "before_write": "hook_fin_journals"
158 },
159 "capabilities": {
160 "comments": true,
161 "attachments": true
162 }
163}