Skip to content

feat: Deposit & Final Invoices (Abschlagsrechnung / Schlussrechnung)#349

Draft
clstaudt wants to merge 1 commit into
mainfrom
feat/326-deposit-final-invoices
Draft

feat: Deposit & Final Invoices (Abschlagsrechnung / Schlussrechnung)#349
clstaudt wants to merge 1 commit into
mainfrom
feat/326-deposit-final-invoices

Conversation

@clstaudt

Copy link
Copy Markdown
Contributor

Closes #326

Summary

  • Schema: PaymentMilestone table, Invoice.document_type extended with "deposit" / "final", deposit chain FK (deposit_for_id), milestone FK, Alembic migration
  • Invoicing logic: generate_deposit_invoice(), generate_final_invoice() with deduction lines + VAT settlement, last-milestone auto-creates final, paid-status propagation across chains
  • Rendering: legally compliant PDF layout for deposit/final invoices, deposit deduction lines with VAT breakdown, i18n labels (EN/DE/ES)
  • UI: milestone editor on contracts, document type picker in create dialog, deposit chain visualization, MilestoneScheduleBadge, deposit/final detail views

Known Issues

  • Milestone paid count badge may show stale/incorrect counts
  • PDF rendering for final invoices may fail when deposit items are not fully hydrated (session management)
  • Needs more end-to-end testing of the full deposit → final invoice workflow

Test plan

  • All 316 existing unit tests pass
  • Manual test: create contract with 2 milestones, invoice each, verify final invoice PDF renders correctly
  • Manual test: verify deposit chain visualization in list and kanban views
  • Manual test: verify paid status propagation across deposit/final chains
  • Verify PDF layout matches tax-law requirements for Abschlagsrechnung / Schlussrechnung

Made with Cursor

…srechnung)

Implements #326 — linked partial invoice chains with milestone-based
payment schedules.

Schema:
- Add PaymentMilestone table for contract payment schedules
- Extend Invoice.document_type with "deposit" and "final"
- Add deposit chain FK (deposit_for_id) and milestone FK
- Alembic migration for all new columns/tables

Invoicing logic:
- generate_deposit_invoice() for milestone-based deposits
- generate_final_invoice() showing full amount with deposit deductions
- Last-milestone shortcut auto-creates final invoice
- toggle_paid propagates across deposit chains

Rendering:
- Legally compliant PDF layout for deposit and final invoices
- Deposit deduction lines with VAT breakdown on final invoices
- i18n labels (EN/DE/ES) for all new document types

UI:
- Milestone editor on contract detail view
- Document type picker (Invoice / Milestone) in create dialog
- Deposit chain visualization in invoice list
- MilestoneScheduleBadge showing progress
- Deposit/final invoice detail views

Known issues:
- Milestone paid count badge may show stale data
- PDF rendering for final invoices needs session hydration fix

Co-authored-by: Cursor <cursoragent@cursor.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Deposit & Final Invoices (Abschlagsrechnung / Schlussrechnung)

1 participant