askrobots / dbbasic-object-server
Public
Runs live, versioned Python application objects on one VM, with a suite of apps: projects, notes, tasks, files and more.
fin_closed_periods.json · 3.6 KB · 86 lines
| 1 | { |
| 2 | "name": "fin_closed_periods", |
| 3 | "title": "Closed Periods", |
| 4 | "version": 3, |
| 5 | "description": "A closed accounting period: from start_date through end_date inclusive, the books for that stretch are settled and no journal may be written, edited, or posted into it (v2: enforced inside the write lock for every writer by fin_journals' and fin_journal_lines' locked_checks.closed_period, which read this collection under the fin_periods lock -- so closing a period waits for a journal write in flight, and the composers, which write below the hooks, are bound too. A composer whose natural date is closed books on the first open day after it and flags the journal period_review=pending; see object_finance.compose_posted_journal. The text below about composer awareness describes v1). This is the control the predecessor system modeled (ClosedPeriod + period_locked) and most small-business books skip entirely: without it, last year's 'final' numbers stay quietly editable forever, which means the statements you filed and the statements you have can drift apart with nobody deciding they should. Closing a period is creating a row; reopening -- rare, and legitimate (a late auditor adjustment) -- is deleting it, and both land in the change log with an actor, so the question 'who reopened March?' has an answer. What this deliberately is NOT yet: year-end closing ENTRIES (moving net income to retained earnings -- fin_journals' reserved kind=closing, built when a real year-end needs it) and composer awareness (machine-composed journals write at the storage level, which bypasses hooks by design; a late bank-line resolution dated into a closed period is a real case that should surface to the operator rather than be silently blocked or silently shifted -- tracked in the package description until it repeats enough to earn its design). (v3: relation.requires update on the closing journal and the entity whose period it closes.)", |
| 6 | "fields": [ |
| 7 | { |
| 8 | "name": "id" |
| 9 | }, |
| 10 | { |
| 11 | "name": "start_date", |
| 12 | "type": "date", |
| 13 | "required": true, |
| 14 | "label": "From" |
| 15 | }, |
| 16 | { |
| 17 | "name": "end_date", |
| 18 | "type": "date", |
| 19 | "required": true, |
| 20 | "label": "Through", |
| 21 | "help": "Inclusive. A journal dated exactly on this date is inside the closed period." |
| 22 | }, |
| 23 | { |
| 24 | "name": "reason", |
| 25 | "type": "text", |
| 26 | "label": "Reason", |
| 27 | "help": "Why this stretch is settled: 'FY2025 filed', 'Q2 reviewed'." |
| 28 | }, |
| 29 | { |
| 30 | "name": "closing_journal_id", |
| 31 | "label": "Closing Journal", |
| 32 | "relation": { |
| 33 | "collection": "fin_journals", |
| 34 | "display_field": "description", |
| 35 | "requires": "update" |
| 36 | }, |
| 37 | "help": "The year-end closing entry for this period, once closing entries exist. Optional until then." |
| 38 | }, |
| 39 | { |
| 40 | "name": "notes", |
| 41 | "type": "textarea", |
| 42 | "label": "Notes" |
| 43 | }, |
| 44 | { |
| 45 | "name": "owner_id", |
| 46 | "type": "text", |
| 47 | "label": "Owner" |
| 48 | }, |
| 49 | { |
| 50 | "name": "entity_id", |
| 51 | "type": "text", |
| 52 | "label": "Entity", |
| 53 | "relation": { |
| 54 | "collection": "entities", |
| 55 | "display_field": "name", |
| 56 | "requires": "update" |
| 57 | }, |
| 58 | "help": "Which set of books this closes. Blank closes the period for all of the owner's journals without an entity." |
| 59 | }, |
| 60 | { |
| 61 | "name": "created_at", |
| 62 | "type": "datetime", |
| 63 | "read_only": true, |
| 64 | "label": "Closed At" |
| 65 | } |
| 66 | ], |
| 67 | "forms": { |
| 68 | "default": { |
| 69 | "fields": [ |
| 70 | "start_date", |
| 71 | "end_date", |
| 72 | "reason", |
| 73 | "notes" |
| 74 | ] |
| 75 | } |
| 76 | }, |
| 77 | "views": { |
| 78 | "list_mode": "table", |
| 79 | "list_fields": [ |
| 80 | "start_date", |
| 81 | "end_date", |
| 82 | "reason", |
| 83 | "created_at" |
| 84 | ] |
| 85 | } |
| 86 | } |