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¶
- Invoices → Download Management → Review & send accounting email.
- Template shows
{{inventur_date}}etc.; rendered preview shows e.g.30.09.2026and inventur net. - Change inventur net / Datev → rendered preview updates without wiping prose.
- Save template → reopen / other user → same template; numbers still refresh.
- Reset to template restores the default tokenized text.
- As superuser with missing files → Review opens; Download attachments / Send stay disabled.
- As non-admin with missing files → Review stays locked.
- Copy body / Ionos / server send use the rendered text.
📁 Files¶
backend/service_invoice/app/services/buchhaltung.py—render_email_body, tokenized default, encrypted template storebackend/service_invoice/app/services/invoice_archive.py— exclude.encfrom download ZIPbackend/service_invoice/app/api/v1/endpoints/download.pybackend/service_invoice/app/models/download.pybackend/service_invoice/requirements.txt—cryptographyfrontend/src/pages/Invoices/Tabs/SubTabs/DownloadSubTab.jsxfrontend/src/services/api/invoice/download.jsdocs/docs/services/service_invoice/services/buchhaltung.mddocs/docs/services/service_invoice/endpoints/download.mddocs/docs/patchnotes/1.11/1.11.18.md— this file