feat: create validated ZUGFeRD invoices in one console command

This commit is contained in:
admin committed 2026-10-16 09:29:08 +02:00
1 parent e0c15fc7f2
commit a643cf5227
30 files changed
+1509 -207

No files matched your search

+16
View File
@@ -26,3 +26,19 @@ def suggest_next_invoice_number(invoices_root: Path, year: int | None = None, pa
if yr == y and seq > max_seq:
max_seq = seq
return f"{y}-{max_seq+1:04d}"
from contextlib import contextmanager
@contextmanager
def invoice_root_lock(root: Path):
"""Serialize local number allocation and folder creation on Linux."""
import fcntl
root = root.expanduser().resolve()
root.mkdir(parents=True, exist_ok=True)
with (root / '.jr-einvoice.lock').open('a') as lock:
fcntl.flock(lock, fcntl.LOCK_EX)
try:
yield
finally:
fcntl.flock(lock, fcntl.LOCK_UN)