Kontrolle: Storno einer Anzahlung bei bestehendem Schluss-Entwurf der AB abgewiesen

409 'Erst den Entwurf der Schlussrechnung löschen.'; das Storno einer Anzahlung laeuft
unter der Kundensperre.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
ClaudeandClaude Sonnet 5.5 committed 2026-10-07 15:18:46 +00:00
1 parent e3ae152f12
commit 1bb172ad91
3 files changed
+38 -7

No files matched your search

+16
View File
@@ -104,3 +104,19 @@ test('Senden: ein gültiger Anzahlungs- oder Schluss-Entwurf geht wie bisher', a
assert.equal((await sendInvoiceNow(s.id)).status, 'offen')
assert.equal((await getAuftrag(ab.id)).status, 'abgerechnet')
})
test('Storno: eine Anzahlung wird nicht storniert, solange zur AB ein Schluss-Entwurf besteht (409); nach dem Löschen des Entwurfs geht es', async () => {
const ab = await legeAuftragAn()
const a = await anzahlung(ab, 50, { senden: true })
const s = await schluss(ab)
await assert.rejects(voidInvoice(a.id), (err) => err.status === 409 && err.message === 'Erst den Entwurf der Schlussrechnung löschen.')
assert.equal(st.invoices.get(a.id).status, 'open')
await deleteDraft(s.id)
assert.equal((await voidInvoice(a.id)).status, 'storniert')
})
test('Storno: eine Anzahlung ohne Schluss-Entwurf lässt sich stornieren', async () => {
const ab = await legeAuftragAn()
const a = await anzahlung(ab, 50, { senden: true })
assert.equal((await voidInvoice(a.id)).status, 'storniert')
})