Skip to content

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 utilsPOST /api/v1/omni/n8n/html-to-pdf for workflow PDF generation (WeasyPrint + Playwright fallback).
  • service-invoice startup fixentrypoint.sh CRLF 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

  1. Rebuild / restart service-invoice (entrypoint + Buchhaltung + ZIP archive).
  2. Rebuild / restart service-omni (WeasyPrint system libs + Playwright Chromium for HTML→PDF).
  3. Set env vars:
  4. N8N_BUCHHALTUNG_WEBHOOK_URL / N8N_BUCHHALTUNG_WEBHOOK_TOKEN (Buchhaltung Ionos workflow)
  5. N8N_OMNI_API_TOKEN (optional; falls back to INTERNAL_API_SECRET)
  6. Place monthly report CSVs under invoices/reports/{year}/{month}/ before sending Buchhaltung.
  7. Rebuild docs if you publish patchnotes from the repo.
  8. No database migration required for Buchhaltung/n8n utils (optional invoices table via db-sync only).

✅ Verify

  1. service-invoice starts: container healthy; no exec /entrypoint.sh errors in logs.
  2. ZIP: GET /api/v1/invoice/download/available_zips → platform breakdown per month; download with filters returns structured ZIP.
  3. Buchhaltung preview: select month in UI → dialog shows subject, body, attachment status (ready when all CSVs present).
  4. Buchhaltung send: with reports in place + n8n webhook configured → 200 triggered; Ionos draft opens via n8n workflow.
  5. HTML→PDF:
    POST http://service-omni:8007/api/v1/omni/n8n/html-to-pdf with X-API-KEY → valid PDF bytes.
  6. 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-omni image after pull; Playwright Chromium is installed at build time.

Files touched

service-invoice

  • app/services/buchhaltung.py — preview, attachment discovery, n8n webhook trigger
  • app/services/invoice_archive.py — ZIP scan/package (shopping + platforms)
  • app/api/v1/endpoints/download.py — Buchhaltung routes, ZIP filters, available_zips breakdown
  • app/models/download.pyBuchhaltungSendRequest
  • app/tests/services/test_buchhaltung.py, app/tests/api/v1/test_download.py — Buchhaltung tests
  • docker/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.py
  • app/schemas/n8n_utils.py, app/api/deps.pyrequire_n8n_api_key
  • app/main.py — public prefix /api/v1/omni/n8n/
  • app/tests/test_n8n_utils.py
  • requirements.txtweasyprint, playwright
  • docker/service_omni/Dockerfile — WeasyPrint libs + Playwright Chromium

frontend

  • src/pages/Invoices/Tabs/SubTabs/DownloadSubTab.jsx — ZIP filters, Buchhaltung button + dialog
  • src/services/api/invoice/download.js — Buchhaltung + ZIP API helpers

infrastructure / sync

  • docker-compose-portainer.ymlN8N_BUCHHALTUNG_*, N8N_OMNI_API_TOKEN on services
  • scripts/db-sync/tables.json, schema-patches.sqlinvoices table sync

docs

  • docs/docs/services/service_invoice/services/buchhaltung.md
  • docs/docs/services/service_invoice/endpoints/download.md
  • docs/docs/services/service_omni/endpoints/n8n_utils.md
  • docs/docs/patchnotes/1.8/1.8.13.md — this file