feat(L4-L5): KI-Steuerung + XRechnung-Format-Layer (EN16931/CII)
Check Cross-Plugin Imports / check (push) Has been cancelled
Check Cross-Plugin Imports / check (push) Has been cancelled
L5 Format-Layer (User-Klaerung: Verkaufsmodul spaeter, Format JETZT): - einvoice.py: EN16931/XRechnung CII-XML-Generator (ElementTree, XML-Escaping gratis), Pflichtfeld-Validierung mit BT/BG-Codes, Decimal-kommerzielles Rounding, Header-Tax-Breakdown pro VAT-Satz, Profile en16931|xrechnung (XRechnung 3.0) - POST /einvoice/render (inline->XML), /einvoice/validate (422 mit BT-Fehlliste), /einvoice/render-for (Contract-Resolver einvoice_data() — Andockpunkt Verkaufsmodul, 404 no_data_source ohne Beitrag) L4 KI-Steuerung: - POST /documents/suggest: Natuerliche Sprache -> Block-Komposition via zentralem llm_complete (Cost-Tracking, Tenant-Budget), Registry-Sanitizing (ungueltige KI-Bloecke gefiltert, IDs serverseitig), Code-Fence-Stripping, 502 ai_unavailable/invalid_ai_response - Frontend: KI-Vorschlag-Panel im PrintTemplateEditor (Sparkles-Icon, Prompt-Textarea, Bloecke werden angehaengt), i18n de/en TDD: Rot 25 failed -> Gruen 25/25 (Validierung, XML-Struktur/Escaping/Summen, Contract-Mocks, API 200/422/403/404, Suggest Mock-LLM/Fence/502). tsc exit 0, Build OK, ruff clean. Doku: api-documentation.md, plugin-development-guide.md (einvoice_data-Contract), PROGRESS.md
This commit is contained in:
@@ -2690,3 +2690,23 @@ class MyContract:
|
||||
- `document_placeholders`-Beispiele dienen als Preview-Fallbacks (StrictUndefined-vermeidend)
|
||||
- Built-in-Bloecke duerfen nicht ueberschrieben werden (Contributions mit existierendem Typ werden ignoriert)
|
||||
- Bilder laufen ausschliesslich als DocumentAsset/data:-URI (WeasyPrint-URL-Fetcher blockt extern)
|
||||
|
||||
## E-Invoice-Beitrag (Phase L5 Format-Layer)
|
||||
|
||||
Das Verkaufsmodul (spaeter) dockt an den fertigen XRechnung-Format-Layer an:
|
||||
|
||||
```python
|
||||
class SalesContract:
|
||||
@staticmethod
|
||||
async def einvoice_data(db, tenant_id, entity_id, entity_type) -> dict:
|
||||
invoice = await db.get(Invoice, entity_id)
|
||||
if invoice is None or invoice.tenant_id != tenant_id:
|
||||
return {}
|
||||
return invoice.to_einvoice_dict() # invoice_number, issue_date, type_code,
|
||||
# currency, buyer_name, seller_name, seller_vat_id,
|
||||
# line_items[{name, quantity, unit, unit_net_price, vat_rate}], profile
|
||||
```
|
||||
|
||||
Validierung + CII-XML-Generierung uebernimmt report_generator (`einvoice.py`,
|
||||
EN16931 BT/BG-Pflichtfelder, kommerzielles Rounding, XRechnung-3.0-Guideline).
|
||||
Kein Beitrag -> `POST /einvoice/render-for` antwortet 404 `no_data_source`.
|
||||
|
||||
Reference in New Issue
Block a user