Skip to content

feat(invoices): delete unused proformas - #526

Merged
Panelica merged 1 commit into
Panelica:mainfrom
hedon77:feat/admin-delete-proforma
Nov 30, 2026
Merged

Panelica merged 1 commit into
Panelica:mainfrom
hedon77:feat/admin-delete-proforma

Conversation

@hedon77

@hedon77 hedon77 commented Nov 30, 2026

Copy link
Copy Markdown
Contributor

Summary

  • add a Delete proforma action next to Cancel on the admin invoice page
  • hard-delete only proformas that have no money trail or legal replacement
  • detach linked orders from the deleted proforma, keep their status, and report the detached order numbers in the confirmation and result message
  • log the deletion and each detached order

Deletion guards

Allowed statuses: draft, unpaid, overdue, cancelled.

Blocked when the proforma has:

  • a replacement VAT invoice,
  • transactions, payment notifications or applied credit,
  • a card charge attempt,
  • a KSeF submission,
  • a linked billable_item,
  • a status other than the four above.

Non-proforma invoices cannot be deleted. The numbering gap is accepted.

Order behaviour

Orders linked to a deletable proforma have invoice_id set to null in the same transaction. Their status is not changed. The confirmation and success message list the order numbers and warn that they need a new invoice.

Verification

  • ProformaDeletionTest: 10 passed / 38 assertions
  • related invoice tests: 38 passed / 94 assertions
  • Pint: pass
  • deployed and checked on DEV

No migrations or configuration changes.

@Panelica
Panelica merged commit 32a5763 into Panelica:main Nov 30, 2026
1 check passed
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.

2 participants