1.8.13
⚙️ Patch 1.8.13 — Invoice Buchhaltung, ZIP archives & n8n HTML→PDF¶
🚀 Summary¶
- Buchhaltung abschicken — new flow in Invoice Download Management: preview German accounting email, attach report CSVs + inventur, trigger n8n to open Ionos with a pre-filled draft.
- Invoice ZIP archives — shopping-table vs platform invoices per month, optional filters, structured
Reports/+Invoices/layout. - n8n omni utils —
POST /api/v1/omni/n8n/html-to-pdffor workflow PDF generation (WeasyPrint + Playwright fallback). - service-invoice startup fix —
entrypoint.shCRLF line endings broke container start on Linux.
✨ Improvements¶
Invoice — Buchhaltung (monthly accounting email)¶
| Area | Change |
|---|---|
| Frontend | Button „Buchhaltung abschicken“ in Download Management; dialog with Datev link, inventur netto, attachment checklist, email preview |
| Preview | GET /download/buchhaltung/preview — subject Buchhaltung {MONAT} {JAHR}, German body template, scans invoices/reports/{year}/{month}/ |
| Send | POST /download/buchhaltung/send — validates required CSVs, POSTs to N8N_BUCHHALTUNG_WEBHOOK_URL |
| Reports | Expected: otto_umsatz.csv, plenty_umsatz.csv, kontoauszuege.csv, inventur/eval CSV for last day of month |
| Inventur value | Parsed from Combined Stock Value column when present; manual override in UI |
n8n payload: compose_ionos_email action with to, subject, body, attachment paths on shared invoices volume.
Invoice — ZIP download & archive layout¶
| Before | After |
|---|---|
Single folder invoices/{year}/{month} only |
Shopping-Table: invoices/{year}/{month}/ · Platforms: invoices/{vendor}/{year}/{month}/ |
GET /available_zips — file count only |
Per-month breakdown: shopping_table, platforms (Hetzner, Sellerlogic, …), total_file_count |
| ZIP flat file list | Reports/ (reserved) + Invoices/Shopping-Table/ + Invoices/Platforms/{vendor}/ |
| No download filters | include_shopping_table / include_platforms query params + frontend checkboxes |
service-omni — n8n utility router¶
| Route | Purpose |
|---|---|
GET /api/v1/omni/n8n/health |
Connectivity check for n8n |
POST /api/v1/omni/n8n/html-to-pdf |
Render HTML string → PDF (binary or base64 JSON) |
Auth: X-API-KEY via N8N_OMNI_API_TOKEN or fallback INTERNAL_API_SECRET (no JWT).
Rendering: WeasyPrint first; Playwright/Chromium fallback for complex HTML/CSS.
Infrastructure & sync¶
| Area | Change |
|---|---|
| service-invoice entrypoint | Fixed Windows CRLF in docker/invoice/entrypoint.sh (exec /entrypoint.sh: no such file or directory) |
| Invoices volume permissions | Entrypoint sets /app/invoices to root:1000 mode 2775 for n8n node access |
| DB sync | invoices table preset in scripts/db-sync/tables.json; schema patch for local sync |
| Env | N8N_BUCHHALTUNG_WEBHOOK_URL, N8N_BUCHHALTUNG_WEBHOOK_TOKEN, N8N_OMNI_API_TOKEN |
🔧 Deploy¶
- Rebuild / restart
service-invoice(entrypoint + Buchhaltung + ZIP archive). - Rebuild / restart
service-omni(WeasyPrint system libs + Playwright Chromium for HTML→PDF). - Set env vars:
N8N_BUCHHALTUNG_WEBHOOK_URL/N8N_BUCHHALTUNG_WEBHOOK_TOKEN(Buchhaltung Ionos workflow)N8N_OMNI_API_TOKEN(optional; falls back toINTERNAL_API_SECRET)- Place monthly report CSVs under
invoices/reports/{year}/{month}/before sending Buchhaltung. - Rebuild docs if you publish patchnotes from the repo.
- No database migration required for Buchhaltung/n8n utils (optional
invoicestable via db-sync only).
✅ Verify¶
- service-invoice starts: container healthy; no
exec /entrypoint.sherrors in logs. - ZIP:
GET /api/v1/invoice/download/available_zips→ platform breakdown per month; download with filters returns structured ZIP. - Buchhaltung preview: select month in UI → dialog shows subject, body, attachment status (
readywhen all CSVs present). - Buchhaltung send: with reports in place + n8n webhook configured →
200 triggered; Ionos draft opens via n8n workflow. - HTML→PDF:
POST http://service-omni:8007/api/v1/omni/n8n/html-to-pdfwithX-API-KEY→ valid PDF bytes. - Tests:
pytest backend/service_invoice/app/tests -k buchhaltung
pytest backend/service_omni/app/tests/test_n8n_utils.py
⚠️ Notes¶
- Buchhaltung n8n workflow (Ionos Selenium compose) is not in this repo — only the webhook trigger from
service-invoice. - Reports folder must be populated (Otto/Plenty Umsatz, Kontoauszüge, inventur CSV) before send; inventur can be exported from Plenty eval.
- n8n routes skip JWT but require
X-API-KEY— do not expose publicly without token. - Rebuild
service-omniimage after pull; Playwright Chromium is installed at build time.
Files touched¶
service-invoice
app/services/buchhaltung.py— preview, attachment discovery, n8n webhook triggerapp/services/invoice_archive.py— ZIP scan/package (shopping + platforms)app/api/v1/endpoints/download.py— Buchhaltung routes, ZIP filters,available_zipsbreakdownapp/models/download.py—BuchhaltungSendRequestapp/tests/services/test_buchhaltung.py,app/tests/api/v1/test_download.py— Buchhaltung testsdocker/invoice/entrypoint.sh— LF line endings + invoices volume permissions
service-omni
app/api/v1/endpoints/n8n_utils.py— n8n router (health,html-to-pdf)app/services/n8n/auth.py,app/services/n8n/html_to_pdf.pyapp/schemas/n8n_utils.py,app/api/deps.py—require_n8n_api_keyapp/main.py— public prefix/api/v1/omni/n8n/app/tests/test_n8n_utils.pyrequirements.txt—weasyprint,playwrightdocker/service_omni/Dockerfile— WeasyPrint libs + Playwright Chromium
frontend
src/pages/Invoices/Tabs/SubTabs/DownloadSubTab.jsx— ZIP filters, Buchhaltung button + dialogsrc/services/api/invoice/download.js— Buchhaltung + ZIP API helpers
infrastructure / sync
docker-compose-portainer.yml—N8N_BUCHHALTUNG_*,N8N_OMNI_API_TOKENon servicesscripts/db-sync/tables.json,schema-patches.sql—invoicestable sync
docs
docs/docs/services/service_invoice/services/buchhaltung.mddocs/docs/services/service_invoice/endpoints/download.mddocs/docs/services/service_omni/endpoints/n8n_utils.mddocs/docs/patchnotes/1.8/1.8.13.md— this file