2026-07-17 00:45:14 +02:00
|
|
|
# Worklog
|
|
|
|
|
|
2026-07-17 01:58:34 +02:00
|
|
|
## T06: Verkaufsmodul + Rechtsdokumente + DATEV-Export + Sales UI
|
|
|
|
|
|
|
|
|
|
**Date:** 2026-07-17
|
|
|
|
|
**Status:** COMPLETED
|
2026-07-17 00:45:14 +02:00
|
|
|
|
2026-07-17 01:38:48 +02:00
|
|
|
### Files Created
|
2026-07-17 00:45:14 +02:00
|
|
|
|
2026-07-17 01:58:34 +02:00
|
|
|
#### Backend
|
|
|
|
|
- backend/app/models/sale.py - Sale model with UUID PK, vehicle/buyer/seller FKs, sale_price, status, is_gwg, contract_pdf_path
|
|
|
|
|
- backend/app/models/datev_export.py - DATEVExport model with start_date, end_date, file_path, total_amount
|
|
|
|
|
- backend/app/schemas/sale.py - SaleCreate, SaleUpdate, SaleResponse, SaleListResponse, ContractResponse, UstIdVerifyResponse
|
|
|
|
|
- backend/app/schemas/datev.py - DATEVExportCreate, DATEVExportResponse, DATEVExportListResponse
|
|
|
|
|
- backend/app/services/sale_service.py - Full CRUD + contract PDF + GwG logic + USt-IdNr. verification
|
|
|
|
|
- backend/app/services/datev_service.py - Export creation, listing, CSV download
|
|
|
|
|
- backend/app/utils/contract_pdf.py - HTML template with WeasyPrint, GwG-Klausel §6 Abs. 2 EStG, USt-IdNr. field
|
|
|
|
|
- backend/app/utils/datev.py - DATEV CSV Buchungsstapel format helper
|
|
|
|
|
- backend/app/routers/sales.py - Sales CRUD + contract + USt-IdNr. endpoints
|
|
|
|
|
- backend/app/routers/datev.py - DATEV export + list + download endpoints
|
|
|
|
|
- backend/tests/test_sales.py - 20 tests covering CRUD, contract PDF, GwG, vehicle status, USt-IdNr.
|
|
|
|
|
- backend/tests/test_datev.py - 14 tests covering export API, CSV format, validation
|
|
|
|
|
|
|
|
|
|
#### Frontend
|
|
|
|
|
- frontend/lib/sales.ts - Sales API client functions and types
|
|
|
|
|
- frontend/lib/datev.ts - DATEV API client functions and types
|
|
|
|
|
- frontend/components/sales/SaleList.tsx - Sales table with filters and pagination
|
|
|
|
|
- frontend/components/sales/SaleForm.tsx - Sale create form with GwG toggle
|
|
|
|
|
- frontend/components/sales/ContractPreview.tsx - PDF preview with regenerate/download
|
|
|
|
|
- frontend/components/sales/DatevExport.tsx - DATEV export page with date range picker
|
|
|
|
|
- frontend/app/[locale]/verkauf/page.tsx - Sales list page
|
|
|
|
|
- frontend/app/[locale]/verkauf/[id]/page.tsx - Sale detail with contract preview
|
|
|
|
|
- frontend/app/[locale]/verkauf/neu/page.tsx - Sale create page
|
|
|
|
|
- frontend/tests/sales.test.tsx - 11 frontend tests
|
|
|
|
|
- frontend/tests/datev.test.tsx - 5 frontend tests
|
2026-07-17 00:45:14 +02:00
|
|
|
|
|
|
|
|
### Files Modified
|
2026-07-17 01:58:34 +02:00
|
|
|
- backend/app/config.py - Added BZST_API_ENABLED=False, WEASYPRINT_OUTPUT_DIR
|
|
|
|
|
- backend/app/main.py - Registered sales + datev routers
|
|
|
|
|
- backend/app/models/__init__.py - Added sale + datev_export imports for Base.metadata registration
|
|
|
|
|
- backend/requirements.txt - Added weasyprint>=62.0
|
2026-07-14 20:16:15 +02:00
|
|
|
|
|
|
|
|
### Test Results
|
2026-07-17 01:58:34 +02:00
|
|
|
- Backend: 34/34 passed (11.42s)
|
|
|
|
|
- Frontend: 16/16 passed (1.85s)
|
|
|
|
|
- Total: 50/50 passed
|
2026-07-17 00:45:14 +02:00
|
|
|
|
2026-07-17 01:38:48 +02:00
|
|
|
### Smoke Test
|
2026-07-17 01:58:34 +02:00
|
|
|
- Backend: All endpoints respond correctly (200/201/404/422)
|
|
|
|
|
- GwG logic: Clause appears when is_gwg=true AND price <= 800 EUR (§6 Abs. 2 EStG)
|
|
|
|
|
- Vehicle status: Sale creation → 'sold', sale cancel → 'available'
|
|
|
|
|
- DATEV CSV: Correct headers, comma decimal separator, DD.MM.YYYY date format
|
|
|
|
|
- USt-IdNr. verify: Returns 'BZSt API not available' when feature flag disabled
|
|
|
|
|
- WeasyPrint: Installed, async PDF generation via asyncio.to_thread
|
|
|
|
|
- Frontend: All components render with mocked API, test IDs present
|