Skip to content

1.11.18

⚙️ Patch 1.11.18 — Editable Buchhaltung email (placeholders + admin preview)

🚀 Summary

Review accounting email lets you edit a German email template with live merge placeholders. The template is stored as a Fernet-encrypted file on the shared reports volume (persists across sessions/users). Superusers can open the review dialog without all prerequisite files to test substitutions locally.

✨ Details

Area Behavior
Template tokens {{datev_link}}, {{inventur_date}}, {{inventur_net_eur}} in the editable template
UI Edit template + insert-token buttons; live Rendered preview; Save template / blur persist; Reset to template clears the override
Storage reports/{year}/{month}/buchhaltung_email_body.enc (Fernet via SECRET_KEY) — excluded from email attachment ZIPs and month download ZIPs
Preview Returns body_template + rendered body + body_is_custom
Persist Saved .enc stores the template; values render at preview / copy / send
API PUT / DELETE /download/buchhaltung/email-body; send accepts optional body (template) and persists it
Admin is_superuser can open Review without all files; ZIP download / server send still require ready
Server send Uses the rendered body in the n8n payload

📌 Notes

  • Redeploy service-invoice and frontend.
  • Keep placeholders in custom templates so month / Datev / inventur changes refresh numbers.
  • Older saved bodies without tokens still send as-is (frozen values); use Reset to template to migrate.
  • Encryption key is derived from SECRET_KEY — keep that env stable or saved templates become unreadable.

✅ Verify

  1. Invoices → Download Management → Review & send accounting email.
  2. Template shows {{inventur_date}} etc.; rendered preview shows e.g. 30.09.2026 and inventur net.
  3. Change inventur net / Datev → rendered preview updates without wiping prose.
  4. Save template → reopen / other user → same template; numbers still refresh.
  5. Reset to template restores the default tokenized text.
  6. As superuser with missing files → Review opens; Download attachments / Send stay disabled.
  7. As non-admin with missing files → Review stays locked.
  8. Copy body / Ionos / server send use the rendered text.

📁 Files

  • backend/service_invoice/app/services/buchhaltung.py — render_email_body, tokenized default, encrypted template store
  • backend/service_invoice/app/services/invoice_archive.py — exclude .enc from download ZIP
  • backend/service_invoice/app/api/v1/endpoints/download.py
  • backend/service_invoice/app/models/download.py
  • backend/service_invoice/requirements.txt — cryptography
  • frontend/src/pages/Invoices/Tabs/SubTabs/DownloadSubTab.jsx
  • frontend/src/services/api/invoice/download.js
  • docs/docs/services/service_invoice/services/buchhaltung.md
  • docs/docs/services/service_invoice/endpoints/download.md
  • docs/docs/patchnotes/1.11/1.11.18.md — this file