Initial roborto accounting implementation

This commit is contained in:
rob
2026-08-30 07:16:21 +01:00
commit 97a75d0243
145 changed files with 5525 additions and 0 deletions
+168
View File
@@ -0,0 +1,168 @@
# Decisions
## ADR-001: Local Python CLI and single-user v1
- Status: Accepted
- Date: 2026-08-29
- Decision: Begin as a local Python CLI for one user; no identity, login, roles, or
multi-tenancy.
- Context: Explicit v1 scope.
- Consequences: CLI is an interface over reusable services; no web functionality in v1.
- Evidence / related task: Specification; `FND-001`, `CLI-001`.
## ADR-002: SQLite authority and migrations
- Status: Accepted
- Date: 2026-08-29
- Decision: SQLite is authoritative, accessed via SQLAlchemy and evolved with Alembic.
- Context: Local application must preserve data through schema changes.
- Consequences: CSV/ODS/PDF are outputs, not databases; no recreate-on-change workflow.
- Evidence / related task: Specification; `FND-002`, `FND-003`.
## ADR-003: Reusable accounting architecture
- Status: Accepted
- Date: 2026-08-29
- Decision: Separate domain, persistence, application services, CLI, reporting/exports,
and document storage; future Flask/React reuses the core.
- Context: Interfaces must not own accounting rules.
- Consequences: No Flask/React/routes/auth in v1.
- Evidence / related task: Specification; `FND-004`.
## ADR-004: Double-entry and exact historical values
- Status: Accepted
- Date: 2026-08-29
- Decision: Posted journals balance; use `Decimal` only; preserve applied currency rates,
issue-time document snapshots, and never-reused annual numbers.
- Context: Accounting correctness and stable history.
- Consequences: Monetary conversions use the centralized micro-unit persistence type.
- Evidence / related task: Specification; `ACC-001`, `FND-003`, `SALE-002`.
## ADR-009: Store money as integer micro-units in SQLite
- Status: Accepted
- Date: 2026-08-29
- Decision: Persist monetary values as signed integer micro-units (10^-6 of the
currency unit), expose `Decimal` values in Python, quantize with half-up rounding,
and reject binary floats.
- Context: SQLite must represent accounting amounts exactly and historical values
must be stable.
- Consequences: Values are limited to six fractional decimal places; the conversion
policy is centralized in the persistence money type.
- Evidence / related task: `src/roborto_accounting/persistence/money.py`; `FND-003`.
## ADR-005: EUR/VAT, commencement, and tax separation
- Status: Accepted
- Date: 2026-08-29
- Decision: EUR is base currency; VAT-ready fields/configuration exist; commencement
date is nullable; pre-trading remains identifiable; accounting classification and
tax treatment are separate, with uncertain treatment `REVIEW`.
- Context: Business has not traded and tax conclusions must not be invented.
- Consequences: v1 supports preparation, not filing or tax advice.
- Evidence / related task: Specification; `FND-005`, `CORE-005`, `CTRL-004`.
## ADR-006: Non-destructive history, audit, periods, and attachments
- Status: Accepted
- Date: 2026-08-29
- Decision: Correct/void/credit/write off rather than casually delete; audit meaningful
changes; closed periods reject ordinary edits; managed filesystem attachments use
SQLite references and collision-safe names.
- Context: Accounting history must remain recoverable and inspectable.
- Consequences: Backups and integrity checks are first-class controls.
- Evidence / related task: Specification; `AUD-001`, `CTRL-006`, `CORE-006`.
## ADR-007: Human approval for automation and reconciliation
- Status: Accepted
- Date: 2026-08-29
- Decision: Recurring invoices prepare drafts only; recurring expenses detect expected
items only; ambiguous bank matches require approval; no online banking.
- Context: Automation must not silently create financial history.
- Consequences: User approval is explicit in services/CLI.
- Evidence / related task: Specification; `SALE-009`, `SALE-010`, `CTRL-002`.
## ADR-008: Explicit v1 exclusions
- Status: Accepted
- Date: 2026-08-29
- Decision: Exclude ODS migration, purchase orders, estimates, email, cloud backup,
Revenue filing, online bank connections, payroll, inventory, project management,
automatic tax advice, Flask, React, and authentication.
- Context: Explicit scope boundaries.
- Consequences: These are non-goals, not backlog tasks.
- Evidence / related task: Specification.
## ADR-010: Approved light-mode A4 document family
- Status: Accepted
- Date: 2026-08-29
- Decision: Generated professional documents use the shared minimalist light-mode
Roborto A4 identity in `docs/design/DOCUMENT_DESIGN.md`; the invoice reference is
canonical, using `logo-light.svg`, green `#7ee787`, dark `#0b0f14`, restrained
accents, thin rules, structured tables, and the standard footer.
- Context: The supplied document-design handoff establishes the approved visual direction.
- Consequences: Styling is a reusable UI-independent theme; identity/payment data is
configured; accounting values remain outside templates; visual parity requires
actual generated-output inspection.
- Evidence / related task: `docs/design/`; `DOC-001` through `DOC-005`.
## ADR-011: Preserve overpayments as unapplied client credit
- Status: Accepted
- Date: 2026-08-29
- Decision: Record the full client payment, allocate no more than the invoice balance,
and retain excess as a client-credit liability available for later allocation or refund.
- Context: Actual cash receipts must be preserved without overstating invoice settlement.
- Consequences: Applying credit later is a separate allocation and balanced journal;
the original payment is never rewritten.
- Evidence / related task: User approval of recommended next step; `SALE-004`.
## ADR-012: Annual credit-note prefix
- Status: Accepted
- Date: 2026-08-29
- Decision: Credit notes use annual sequential numbers in the form `CN-YYYY-NNN`;
assigned numbers are never reused.
- Context: Credit notes require an analogous documented annual numbering scheme.
- Consequences: Corrections reduce invoice balances through linked events rather than
rewriting issued invoices.
- Evidence / related task: Continued implementation approval; `SALE-005`.
## ADR-013: XDG user runtime locations
- Status: Accepted
- Date: 2026-08-29
- Decision: Runtime configuration, data, and state follow XDG user directories. The
optional env file is `~/.config/roborto-accounting/env`; SQLite, documents, and
backups default below `~/.local/share/roborto-accounting`.
- Context: The installed application must run independently of the projects checkout,
without requiring system-wide `/opt` permissions or storing secrets in source.
- Consequences: Standard XDG environment variables can relocate data; the repository
contains no operational `.env` values.
- Evidence / related task: User deployment-path request; `CLI-001`.
## ADR-014: ReportLab document rendering
- Status: Accepted
- Date: 2026-08-29
- Decision: Use ReportLab with svglib for deterministic A4 PDFs and the repository SVG
logo through one UI-independent shared theme.
- Context: Approved reference designs require print-safe PDF output, pagination,
wrapping, and reusable styling.
- Consequences: Templates only present values supplied by services; ReportLab and
svglib are runtime dependencies; visual samples are generated for review.
- Evidence / related task: `DOC-002` through `DOC-005`.
## ADR-015: Invoice revenue-account mapping
- Status: Accepted
- Date: 2026-08-29
- Decision: Store a revenue account on each quotation/invoice line, optionally
defaulted by the application from a configured business default during draft entry.
- Context: Current invoice issue snapshots the document but does not post accounts
receivable, income, or VAT. The chart distinguishes software-development, hosting/
maintenance, and other income, so a single hard-coded income account loses approved
reporting classification.
- Consequences: The selected mapping must be persisted and immutable after issue;
quotation conversion carries it to invoice lines; issue debits receivables for gross
and credits the selected income account(s) for net plus VAT liability for VAT.
- Evidence / related task: User approval; completion audit during `CLI-004`; `ACC-003`.
## ADR-016: Narrow business-letter workflow
- Status: Accepted
- Date: 2026-08-29
- Decision: Persist business-letter drafts containing recipient and content snapshots,
then explicitly finalize them to the shared branded PDF theme and managed archive.
- Context: The user approved proceeding after the letter design had previously been
deferred for lack of workflow scope.
- Consequences: Finalized letters are stable and auditable; no email, mail merge,
campaigns, delivery tracking, or correspondence automation is introduced.
- Evidence / related task: User approval; `DOC-FUTURE-001`.