Package runtime migrations and branding assets
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
.venv/
|
.venv/
|
||||||
.pytest_cache/
|
.pytest_cache/
|
||||||
|
build/
|
||||||
__pycache__/
|
__pycache__/
|
||||||
*.py[cod]
|
*.py[cod]
|
||||||
accounts.db
|
accounts.db
|
||||||
|
|||||||
+1
-1
@@ -1,5 +1,5 @@
|
|||||||
[alembic]
|
[alembic]
|
||||||
script_location = %(here)s/alembic
|
script_location = %(here)s/src/roborto_accounting/migrations
|
||||||
prepend_sys_path = .
|
prepend_sys_path = .
|
||||||
path_separator = os
|
path_separator = os
|
||||||
sqlalchemy.url = sqlite:///accounts.db
|
sqlalchemy.url = sqlite:///accounts.db
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
# Current State
|
# Current State
|
||||||
|
|
||||||
- Development stage: approved v1 and business-letter workflow implemented; no active task.
|
- Development stage: approved v1, business-letter workflow, and deployable wheel
|
||||||
|
packaging implemented; no active task.
|
||||||
- Implemented: persistence/migrations, exact money, chart/settings, balanced journals,
|
- Implemented: persistence/migrations, exact money, chart/settings, balanced journals,
|
||||||
audit, all core records and sales/payables workflows, recurring definitions, bank
|
audit, all core records and sales/payables workflows, recurring definitions, bank
|
||||||
import/reconciliation, currency/VAT/tax records, assets, period locks/backups,
|
import/reconciliation, currency/VAT/tax records, assets, period locks/backups,
|
||||||
@@ -21,7 +22,10 @@
|
|||||||
and P&L were generated and visually inspected against `docs/design/references/`;
|
and P&L were generated and visually inspected against `docs/design/references/`;
|
||||||
multi-page invoice and ledger/report pagination was checked.
|
multi-page invoice and ledger/report pagination was checked.
|
||||||
- Missing approved functionality: none identified by the completed requirements audit.
|
- Missing approved functionality: none identified by the completed requirements audit.
|
||||||
- Known problems: no known failing test or migration.
|
- Packaging: migrations and branding resources are included in the wheel. A wheel
|
||||||
|
installed into an isolated target outside the checkout initialized revision 0028
|
||||||
|
and generated all five branded sample PDFs.
|
||||||
|
- Known problems: no known failing test, migration, or packaging defect.
|
||||||
- Repository baseline: the completed implementation is captured in the initial Git
|
- Repository baseline: the completed implementation is captured in the initial Git
|
||||||
commit; generated runtime/test artifacts remain ignored.
|
commit; generated runtime/test artifacts remain ignored.
|
||||||
- Current active task: none.
|
- Current active task: none.
|
||||||
|
|||||||
+14
-7
@@ -7,9 +7,9 @@ a pre-trading sole-trader software business. SQLite is authoritative.
|
|||||||
|
|
||||||
## 2. Repository state
|
## 2. Repository state
|
||||||
|
|
||||||
The accounting/service layers and full backlog are implemented and captured in the
|
The accounting/service layers and full approved backlog are implemented. The initial
|
||||||
initial Git baseline. `.venv`, caches, generated databases, bytecode, and package
|
Git baseline exists; a follow-up packaging change makes wheels self-contained. `.venv`,
|
||||||
metadata are ignored.
|
caches, generated databases, bytecode, build output, and package metadata are ignored.
|
||||||
|
|
||||||
## 3. Current application state
|
## 3. Current application state
|
||||||
|
|
||||||
@@ -34,15 +34,18 @@ approval, XDG runtime locations, and ReportLab/svglib shared A4 rendering.
|
|||||||
Completed the full backlog, including migrations 0014–0028, all controls
|
Completed the full backlog, including migrations 0014–0028, all controls
|
||||||
and reports, CLI/runtime paths, PDF renderers, managed generated-document metadata,
|
and reports, CLI/runtime paths, PDF renderers, managed generated-document metadata,
|
||||||
and deterministic visual samples. Corrected migration 0017 to use SQLite batch mode.
|
and deterministic visual samples. Corrected migration 0017 to use SQLite batch mode.
|
||||||
|
PKG-001 moved migrations and branding resources into the installable package and
|
||||||
|
validated initialization/document generation from a wheel outside the checkout.
|
||||||
|
|
||||||
## 7. Current task
|
## 7. Current task
|
||||||
|
|
||||||
No active approved task. The final audit tasks and `DOC-FUTURE-001` business-letter
|
No active approved task. The final audit tasks, business-letter workflow, operator
|
||||||
draft/finalize/archive workflow are complete. `DOC-006` added the root operator guide.
|
guide, and self-contained wheel deployment task are complete.
|
||||||
|
|
||||||
## 8. Important code locations
|
## 8. Important code locations
|
||||||
|
|
||||||
- Models/migrations: `src/roborto_accounting/persistence/`, `alembic/versions/`
|
- Models/migrations: `src/roborto_accounting/persistence/`,
|
||||||
|
`src/roborto_accounting/migrations/versions/`
|
||||||
- Services: `src/roborto_accounting/services/`
|
- Services: `src/roborto_accounting/services/`
|
||||||
- Reports/documents: `src/roborto_accounting/reporting/`
|
- Reports/documents: `src/roborto_accounting/reporting/`
|
||||||
- CLI/runtime paths: `src/roborto_accounting/cli/`, `src/roborto_accounting/config.py`
|
- CLI/runtime paths: `src/roborto_accounting/cli/`, `src/roborto_accounting/config.py`
|
||||||
@@ -55,6 +58,9 @@ draft/finalize/archive workflow are complete. `DOC-006` added the root operator
|
|||||||
- `.venv/bin/alembic -c <temporary-config> upgrade head` — fresh SQLite through 0028
|
- `.venv/bin/alembic -c <temporary-config> upgrade head` — fresh SQLite through 0028
|
||||||
- `.venv/bin/accounts --help`
|
- `.venv/bin/accounts --help`
|
||||||
- `.venv/bin/accounts document-samples --output <directory>`
|
- `.venv/bin/accounts document-samples --output <directory>`
|
||||||
|
- `.venv/bin/pip wheel . --no-deps --no-build-isolation --wheel-dir <directory>`
|
||||||
|
- wheel installed to an isolated target outside the checkout: initialization through
|
||||||
|
0028 and five sample PDFs succeeded
|
||||||
- `git diff --check`
|
- `git diff --check`
|
||||||
|
|
||||||
## 10. Environment variables by NAME ONLY
|
## 10. Environment variables by NAME ONLY
|
||||||
@@ -64,7 +70,8 @@ draft/finalize/archive workflow are complete. `DOC-006` added the root operator
|
|||||||
## 11. Testing/quality status
|
## 11. Testing/quality status
|
||||||
|
|
||||||
60 isolated tests pass. Fresh migration through 0028 has no SQLite foreign-key
|
60 isolated tests pass. Fresh migration through 0028 has no SQLite foreign-key
|
||||||
violations. Representative A4 invoice, quotation, Cash Flow, and P&L PDFs were
|
violations. The built wheel contains migrations and both brand SVGs and works outside
|
||||||
|
the checkout. Representative A4 invoice, quotation, Cash Flow, and P&L PDFs were
|
||||||
visually inspected; multi-page headers, wrapping, totals, footers, and page numbering
|
visually inspected; multi-page headers, wrapping, totals, footers, and page numbering
|
||||||
were checked.
|
were checked.
|
||||||
|
|
||||||
|
|||||||
@@ -73,7 +73,8 @@ documents, and backups in `~/.local/share/roborto-accounting`, and state in
|
|||||||
|
|
||||||
- `src/roborto_accounting/`: package and separated layers
|
- `src/roborto_accounting/`: package and separated layers
|
||||||
- `tests/`: isolated automated tests
|
- `tests/`: isolated automated tests
|
||||||
- `alembic/`: migrations
|
- `src/roborto_accounting/migrations/`: packaged Alembic migrations
|
||||||
|
- `src/roborto_accounting/assets/branding/`: packaged document-branding resources
|
||||||
- `docs/`: maintained context
|
- `docs/`: maintained context
|
||||||
- `AGENTS.md`: working instructions
|
- `AGENTS.md`: working instructions
|
||||||
|
|
||||||
|
|||||||
+17
-2
@@ -31,7 +31,7 @@ major task is `IN PROGRESS`.
|
|||||||
- Objective: Establish migrations and exact `Decimal` storage policy.
|
- Objective: Establish migrations and exact `Decimal` storage policy.
|
||||||
- Scope: Alembic environment, initial migration workflow, SQLite encoding/scale/rounding.
|
- Scope: Alembic environment, initial migration workflow, SQLite encoding/scale/rounding.
|
||||||
- Acceptance criteria: upgrade/downgrade works; monetary round-trip proves no floats.
|
- Acceptance criteria: upgrade/downgrade works; monetary round-trip proves no floats.
|
||||||
- Relevant code: `alembic/`, persistence money type, tests.
|
- Relevant code: `src/roborto_accounting/migrations/`, persistence money type, tests.
|
||||||
- Validation: migration and arithmetic tests.
|
- Validation: migration and arithmetic tests.
|
||||||
- Dependencies: FND-002. Non-goals: business tables. Open questions: exact encoding is proposed.
|
- Dependencies: FND-002. Non-goals: business tables. Open questions: exact encoding is proposed.
|
||||||
|
|
||||||
@@ -468,7 +468,7 @@ major task is `IN PROGRESS`.
|
|||||||
- Objective: Implement the approved reusable light-mode Roborto document identity.
|
- Objective: Implement the approved reusable light-mode Roborto document identity.
|
||||||
- Scope: rendering-library selection, deterministic A4 output, margins, typography, `logo-light.svg`, colour tokens, headings, tables, totals, footer/page numbering, wrapping and page breaks.
|
- Scope: rendering-library selection, deterministic A4 output, margins, typography, `logo-light.svg`, colour tokens, headings, tables, totals, footer/page numbering, wrapping and page breaks.
|
||||||
- Acceptance criteria: one UI-independent theme serves every renderer; output is print-safe, greyscale-legible, deterministic, and contains no accounting logic.
|
- Acceptance criteria: one UI-independent theme serves every renderer; output is print-safe, greyscale-legible, deterministic, and contains no accounting logic.
|
||||||
- Relevant code: future `reporting/documents/`, `assets/branding/`, `docs/design/`.
|
- Relevant code: `reporting/documents/`, packaged branding assets, `docs/design/`.
|
||||||
- Validation: unit/layout tests plus generated representative multi-page PDF inspection.
|
- Validation: unit/layout tests plus generated representative multi-page PDF inspection.
|
||||||
- Dependencies: DOC-001. Non-goals: per-document themes, dashboards, gradients, shadows, proprietary fonts, Flask/React. Open questions: rendering library.
|
- Dependencies: DOC-001. Non-goals: per-document themes, dashboards, gradients, shadows, proprietary fonts, Flask/React. Open questions: rendering library.
|
||||||
|
|
||||||
@@ -523,6 +523,21 @@ major task is `IN PROGRESS`.
|
|||||||
- Dependencies: CLI-006, DOC-FUTURE-001. Non-goals: deployment automation or invented
|
- Dependencies: CLI-006, DOC-FUTURE-001. Non-goals: deployment automation or invented
|
||||||
workflows. Open questions: none.
|
workflows. Open questions: none.
|
||||||
|
|
||||||
|
### PKG-001 — Self-contained wheel deployment
|
||||||
|
- Priority: P0; Status: COMPLETE
|
||||||
|
- Objective: Make a normal wheel installation independent of the source checkout.
|
||||||
|
- Scope: package Alembic migrations and brand SVG resources, resolve them from the
|
||||||
|
installed package, and retain the repository Alembic developer workflow.
|
||||||
|
- Acceptance criteria: a built wheel contains every migration and branding asset;
|
||||||
|
code installed from that wheel can initialize a new database and generate branded
|
||||||
|
document samples while running outside the repository.
|
||||||
|
- Relevant code: `pyproject.toml`, packaged migrations/assets, runtime configuration,
|
||||||
|
CLI initialization, deployment tests.
|
||||||
|
- Validation: full tests, clean wheel inspection, external-location database
|
||||||
|
initialization and PDF sample generation.
|
||||||
|
- Dependencies: FND-002, DOC-005. Non-goals: system-wide installation automation,
|
||||||
|
cloud deployment, or changing the XDG runtime-storage policy. Open questions: none.
|
||||||
|
|
||||||
## Backlog review
|
## Backlog review
|
||||||
|
|
||||||
The approved specification is represented by tasks, acceptance criteria, decisions, or
|
The approved specification is represented by tasks, acceptance criteria, decisions, or
|
||||||
|
|||||||
@@ -14,7 +14,8 @@ Profit & Loss statements, transaction/accounting/year-end reports, and other
|
|||||||
professional A4 output. Do not independently style each renderer.
|
professional A4 output. Do not independently style each renderer.
|
||||||
|
|
||||||
- A4 portrait by default, white/light background, generous margins and whitespace.
|
- A4 portrait by default, white/light background, generous margins and whitespace.
|
||||||
- Use `assets/branding/logo-light.svg`; never put the dark logo panel on light pages.
|
- Use the packaged `src/roborto_accounting/assets/branding/logo-light.svg`; never put
|
||||||
|
the dark logo panel on light pages.
|
||||||
- Roborto green `#7ee787`; Roborto dark `#0b0f14`; dark body text and light rules.
|
- Roborto green `#7ee787`; Roborto dark `#0b0f14`; dark body text and light rules.
|
||||||
- Clean, non-proprietary sans-serif typography; monospace only sparingly.
|
- Clean, non-proprietary sans-serif typography; monospace only sparingly.
|
||||||
- Strong dark titles with a short thin green accent, not full-width colour banners.
|
- Strong dark titles with a short thin green accent, not full-width colour banners.
|
||||||
|
|||||||
@@ -19,8 +19,9 @@ Never infer business data or reproduce text errors from it.
|
|||||||
|
|
||||||
## Assets and references
|
## Assets and references
|
||||||
|
|
||||||
- `assets/branding/logo-light.svg`: required light-document logo.
|
- `src/roborto_accounting/assets/branding/logo-light.svg`: required light-document logo.
|
||||||
- `assets/branding/logo-dark.svg`: retained dark-mode asset, not for white A4 pages.
|
- `src/roborto_accounting/assets/branding/logo-dark.svg`: retained dark-mode asset,
|
||||||
|
not for white A4 pages.
|
||||||
- `docs/design/references/invoice-reference.png`: canonical visual direction.
|
- `docs/design/references/invoice-reference.png`: canonical visual direction.
|
||||||
- Other PNGs: quotation, letter, Cash Flow, and Profit & Loss adaptations.
|
- Other PNGs: quotation, letter, Cash Flow, and Profit & Loss adaptations.
|
||||||
|
|
||||||
|
|||||||
@@ -23,6 +23,14 @@ accounts = "roborto_accounting.cli.main:main"
|
|||||||
[tool.setuptools.packages.find]
|
[tool.setuptools.packages.find]
|
||||||
where = ["src"]
|
where = ["src"]
|
||||||
|
|
||||||
|
[tool.setuptools.package-data]
|
||||||
|
roborto_accounting = [
|
||||||
|
"assets/branding/*.svg",
|
||||||
|
"migrations/*.py",
|
||||||
|
"migrations/*.mako",
|
||||||
|
"migrations/versions/*.py",
|
||||||
|
]
|
||||||
|
|
||||||
[tool.pytest.ini_options]
|
[tool.pytest.ini_options]
|
||||||
testpaths = ["tests"]
|
testpaths = ["tests"]
|
||||||
addopts = "-ra"
|
addopts = "-ra"
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 476 B After Width: | Height: | Size: 476 B |
|
Before Width: | Height: | Size: 377 B After Width: | Height: | Size: 377 B |
@@ -3,6 +3,7 @@ import argparse
|
|||||||
import json
|
import json
|
||||||
from datetime import date
|
from datetime import date
|
||||||
from decimal import Decimal,InvalidOperation
|
from decimal import Decimal,InvalidOperation
|
||||||
|
from importlib.resources import files
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from alembic import command
|
from alembic import command
|
||||||
from alembic.config import Config
|
from alembic.config import Config
|
||||||
@@ -100,8 +101,8 @@ def build_parser()->argparse.ArgumentParser:
|
|||||||
|
|
||||||
def _upgrade_database(path:Path)->None:
|
def _upgrade_database(path:Path)->None:
|
||||||
path.parent.mkdir(parents=True,exist_ok=True)
|
path.parent.mkdir(parents=True,exist_ok=True)
|
||||||
project_root=Path(__file__).resolve().parents[3]
|
migration_path=files("roborto_accounting").joinpath("migrations")
|
||||||
config=Config(str(project_root/"alembic.ini"));config.set_main_option("script_location",str(project_root/"alembic"))
|
config=Config();config.set_main_option("script_location",str(migration_path))
|
||||||
config.set_main_option("sqlalchemy.url",sqlite_url(path));command.upgrade(config,"head")
|
config.set_main_option("sqlalchemy.url",sqlite_url(path));command.upgrade(config,"head")
|
||||||
|
|
||||||
def _account_id(session,code:str)->int:
|
def _account_id(session,code:str)->int:
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
"""Location-independent runtime paths following XDG conventions."""
|
"""Location-independent runtime paths following XDG conventions."""
|
||||||
import os
|
import os
|
||||||
from dataclasses import dataclass
|
from dataclasses import dataclass
|
||||||
|
from importlib.resources import files
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
@dataclass(frozen=True)
|
@dataclass(frozen=True)
|
||||||
@@ -24,5 +25,5 @@ def runtime_paths(environ:dict[str,str]|None=None)->RuntimePaths:
|
|||||||
return RuntimePaths(config,data,state)
|
return RuntimePaths(config,data,state)
|
||||||
|
|
||||||
def default_logo_path()->Path:
|
def default_logo_path()->Path:
|
||||||
"""Resolve the checked-in brand asset independently of the current directory."""
|
"""Resolve the packaged brand asset independently of the current directory."""
|
||||||
return Path(__file__).resolve().parents[2]/"assets"/"branding"/"logo-light.svg"
|
return Path(str(files("roborto_accounting").joinpath("assets/branding/logo-light.svg")))
|
||||||
|
|||||||
@@ -0,0 +1 @@
|
|||||||
|
"""Packaged Alembic migration resources."""
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
"""Roborto accounting schema revisions."""
|
||||||
@@ -32,5 +32,5 @@ def test_controls_reports_and_exports_cli(tmp_path,capsys):
|
|||||||
assert "account_code=1000" in _run(prefix,["report","ledger",*period],capsys)
|
assert "account_code=1000" in _run(prefix,["report","ledger",*period],capsys)
|
||||||
csv_out=tmp_path/"trial.csv";_run(prefix,["report","trial-balance",*period,"--format","csv","--output",str(csv_out)],capsys);assert csv_out.is_file()
|
csv_out=tmp_path/"trial.csv";_run(prefix,["report","trial-balance",*period,"--format","csv","--output",str(csv_out)],capsys);assert csv_out.is_file()
|
||||||
ods_out=tmp_path/"pl.ods";_run(prefix,["report","profit-loss",*period,"--format","ods","--output",str(ods_out)],capsys);assert ods_out.is_file()
|
ods_out=tmp_path/"pl.ods";_run(prefix,["report","profit-loss",*period,"--format","ods","--output",str(ods_out)],capsys);assert ods_out.is_file()
|
||||||
pdf_out=tmp_path/"cash.pdf";_run(prefix,["report","cash-flow",*period,"--format","pdf","--output",str(pdf_out),"--logo","assets/branding/logo-light.svg"],capsys);assert pdf_out.stat().st_size>1000
|
pdf_out=tmp_path/"cash.pdf";_run(prefix,["report","cash-flow",*period,"--format","pdf","--output",str(pdf_out)],capsys);assert pdf_out.stat().st_size>1000
|
||||||
assert "tax_classification=REVIEW" in _run(prefix,["report","tax-review"],capsys)
|
assert "tax_classification=REVIEW" in _run(prefix,["report","tax-review"],capsys)
|
||||||
|
|||||||
@@ -1,8 +1,9 @@
|
|||||||
|
from roborto_accounting.config import default_logo_path
|
||||||
from roborto_accounting.reporting.documents.theme import DocumentTheme
|
from roborto_accounting.reporting.documents.theme import DocumentTheme
|
||||||
from reportlab.platypus import Paragraph
|
from reportlab.platypus import Paragraph
|
||||||
|
|
||||||
def test_shared_theme_generates_deterministic_a4_pdf(tmp_path):
|
def test_shared_theme_generates_deterministic_a4_pdf(tmp_path):
|
||||||
logo=__import__("pathlib").Path("assets/branding/logo-light.svg")
|
logo=default_logo_path()
|
||||||
theme=DocumentTheme(logo);story=theme.header(["accounts@roborto.net"])+theme.heading("INVOICE")
|
theme=DocumentTheme(logo);story=theme.header(["accounts@roborto.net"])+theme.heading("INVOICE")
|
||||||
story.append(Paragraph("Correct accounting content",theme.body))
|
story.append(Paragraph("Correct accounting content",theme.body))
|
||||||
first=theme.build(tmp_path/"first.pdf",story)
|
first=theme.build(tmp_path/"first.pdf",story)
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
from datetime import date
|
from datetime import date
|
||||||
from decimal import Decimal
|
from decimal import Decimal
|
||||||
from pathlib import Path
|
from roborto_accounting.config import default_logo_path
|
||||||
|
|
||||||
from roborto_accounting.persistence.models import BusinessSettings
|
from roborto_accounting.persistence.models import BusinessSettings
|
||||||
from roborto_accounting.reporting.documents.financial import render_cash_flow_pdf, render_profit_and_loss_pdf,render_transaction_ledger_pdf,render_trial_balance_pdf
|
from roborto_accounting.reporting.documents.financial import render_cash_flow_pdf, render_profit_and_loss_pdf,render_transaction_ledger_pdf,render_trial_balance_pdf
|
||||||
@@ -11,7 +11,7 @@ from roborto_accounting.reporting.ledgers import LedgerRow,TrialBalanceRow,Trial
|
|||||||
|
|
||||||
def test_financial_report_pdfs_render_supplied_values_and_paginate(tmp_path):
|
def test_financial_report_pdfs_render_supplied_values_and_paginate(tmp_path):
|
||||||
settings = BusinessSettings(trading_name="roborto", general_email="hello@roborto.net")
|
settings = BusinessSettings(trading_name="roborto", general_email="hello@roborto.net")
|
||||||
theme = DocumentTheme(Path("assets/branding/logo-light.svg"))
|
theme = DocumentTheme(default_logo_path())
|
||||||
rows = [
|
rows = [
|
||||||
ProfitLossRow(str(index), f"Account {index} with a deliberately long descriptive name", "INCOME" if index % 2 else "EXPENSE", Decimal(index))
|
ProfitLossRow(str(index), f"Account {index} with a deliberately long descriptive name", "INCOME" if index % 2 else "EXPENSE", Decimal(index))
|
||||||
for index in range(1, 90)
|
for index in range(1, 90)
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
from datetime import date
|
from datetime import date
|
||||||
from pathlib import Path
|
from roborto_accounting.config import default_logo_path
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
@@ -16,7 +16,7 @@ def test_letter_render_is_deterministic_and_finalization_is_stable(tmp_path):
|
|||||||
engine=make_engine("sqlite://");Base.metadata.create_all(engine);session=make_session_factory(engine)()
|
engine=make_engine("sqlite://");Base.metadata.create_all(engine);session=make_session_factory(engine)()
|
||||||
settings=BusinessSettings(trading_name="roborto",business_descriptor="Software Development",general_email="hello@roborto.net")
|
settings=BusinessSettings(trading_name="roborto",business_descriptor="Software Development",general_email="hello@roborto.net")
|
||||||
letter=create_letter(session,letter_date=date(2026,8,29),recipient_name="Client",recipient_address="Address\nDublin",recipient_email="client@example.invalid",reference="REF-1",subject="Project follow-up",body_text="Hello,\n\n"+("A long representative paragraph for wrapping and pagination. "*180))
|
letter=create_letter(session,letter_date=date(2026,8,29),recipient_name="Client",recipient_address="Address\nDublin",recipient_email="client@example.invalid",reference="REF-1",subject="Project follow-up",body_text="Hello,\n\n"+("A long representative paragraph for wrapping and pagination. "*180))
|
||||||
theme=DocumentTheme(Path("assets/branding/logo-light.svg"));first=render_letter_pdf(tmp_path/"first.pdf",letter=letter,settings=settings,theme=theme);second=render_letter_pdf(tmp_path/"second.pdf",letter=letter,settings=settings,theme=theme)
|
theme=DocumentTheme(default_logo_path());first=render_letter_pdf(tmp_path/"first.pdf",letter=letter,settings=settings,theme=theme);second=render_letter_pdf(tmp_path/"second.pdf",letter=letter,settings=settings,theme=theme)
|
||||||
assert first.read_bytes()==second.read_bytes() and first.stat().st_size>2000
|
assert first.read_bytes()==second.read_bytes() and first.stat().st_size>2000
|
||||||
attachment=finalize_letter(session,letter=letter,settings=settings,archive_root=tmp_path/"archive",theme=theme)
|
attachment=finalize_letter(session,letter=letter,settings=settings,archive_root=tmp_path/"archive",theme=theme)
|
||||||
assert letter.status=="FINALIZED" and (tmp_path/"archive"/attachment.stored_relative_path).is_file()
|
assert letter.status=="FINALIZED" and (tmp_path/"archive"/attachment.stored_relative_path).is_file()
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ def test_sales_and_payables_cli_workflow(tmp_path,capsys):
|
|||||||
payment=int(_run(prefix,["invoice-payment",str(invoice),"--date","2026-08-10","--amount","125","--financial-account","1000"],capsys))
|
payment=int(_run(prefix,["invoice-payment",str(invoice),"--date","2026-08-10","--amount","125","--financial-account","1000"],capsys))
|
||||||
assert payment>0 and "PAID" in _run(prefix,["invoice-list"],capsys)
|
assert payment>0 and "PAID" in _run(prefix,["invoice-list"],capsys)
|
||||||
archive=tmp_path/"archive"
|
archive=tmp_path/"archive"
|
||||||
generated=int(_run(prefix,["sales-document-generate","invoice",str(invoice),"--archive",str(archive),"--logo","assets/branding/logo-light.svg"],capsys))
|
generated=int(_run(prefix,["sales-document-generate","invoice",str(invoice),"--archive",str(archive)],capsys))
|
||||||
assert generated>0 and len(list(archive.rglob("*.pdf")))==1
|
assert generated>0 and len(list(archive.rglob("*.pdf")))==1
|
||||||
|
|
||||||
bill=int(_run(prefix,["supplier-bill-add","--supplier-id",str(supplier),"--date","2026-08-03","--description","Subscription","--amount","60","--expense-account","5020"],capsys))
|
bill=int(_run(prefix,["supplier-bill-add","--supplier-id",str(supplier),"--date","2026-08-03","--description","Subscription","--amount","60","--expense-account","5020"],capsys))
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
from datetime import date
|
from datetime import date
|
||||||
from decimal import Decimal
|
from decimal import Decimal
|
||||||
from pathlib import Path
|
from roborto_accounting.config import default_logo_path
|
||||||
from roborto_accounting.persistence.base import Base
|
from roborto_accounting.persistence.base import Base
|
||||||
from roborto_accounting.persistence.db import make_engine,make_session_factory
|
from roborto_accounting.persistence.db import make_engine,make_session_factory
|
||||||
from roborto_accounting.persistence.models import Account,AccountClass,BusinessSettings,Client
|
from roborto_accounting.persistence.models import Account,AccountClass,BusinessSettings,Client
|
||||||
@@ -17,7 +17,7 @@ def test_issued_sales_documents_render_from_snapshots(tmp_path):
|
|||||||
line={"description":"Development","quantity":Decimal("2"),"unit":"hours","unit_price":Decimal("50"),"vat_amount":Decimal("0"),"income_account_id":income.id}
|
line={"description":"Development","quantity":Decimal("2"),"unit":"hours","unit_price":Decimal("50"),"vat_amount":Decimal("0"),"income_account_id":income.id}
|
||||||
invoice=create_invoice(s,settings=settings,client=client,invoice_date=date(2026,1,1),lines=[line]);issue_invoice(s,invoice,client,receivables_account_id=ar.id)
|
invoice=create_invoice(s,settings=settings,client=client,invoice_date=date(2026,1,1),lines=[line]);issue_invoice(s,invoice,client,receivables_account_id=ar.id)
|
||||||
quote=create_quotation(s,client=client,quotation_date=date(2026,1,1),lines=[line]);issue_quotation(s,quote,client)
|
quote=create_quotation(s,client=client,quotation_date=date(2026,1,1),lines=[line]);issue_quotation(s,quote,client)
|
||||||
theme=DocumentTheme(Path("assets/branding/logo-light.svg"))
|
theme=DocumentTheme(default_logo_path())
|
||||||
assert render_invoice_pdf(tmp_path/"invoice.pdf",invoice=invoice,settings=settings,theme=theme).stat().st_size>1000
|
assert render_invoice_pdf(tmp_path/"invoice.pdf",invoice=invoice,settings=settings,theme=theme).stat().st_size>1000
|
||||||
assert render_quotation_pdf(tmp_path/"quote.pdf",quotation=quote,settings=settings,theme=theme).stat().st_size>1000
|
assert render_quotation_pdf(tmp_path/"quote.pdf",quotation=quote,settings=settings,theme=theme).stat().st_size>1000
|
||||||
invoice_attachment=generate_invoice_document(s,invoice=invoice,settings=settings,archive_root=tmp_path/"archive",theme=theme)
|
invoice_attachment=generate_invoice_document(s,invoice=invoice,settings=settings,archive_root=tmp_path/"archive",theme=theme)
|
||||||
|
|||||||
Reference in New Issue
Block a user