Skip to content

Add quotes - #195

Merged
kittendevv merged 2 commits into
kittendevv:mainfrom
Bouni:feat/quotes
Nov 28, 2026
Merged

kittendevv merged 2 commits into
kittendevv:mainfrom
Bouni:feat/quotes

Conversation

@Bouni

@Bouni Bouni commented Nov 20, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds quotes (Angebote): create a quote, send it, and turn it into an invoice.

Depends on #194 (credit notes). This branch builds on its document type column and label handling, so until #194 is merged this PR also shows the credit note commit. Only the last commit (Add quotes) belongs to this PR.

Quotes are stored as documents like invoices (document_type = 'quote'), so they reuse the editor, line items, taxes, PDF templates, public links and email, but they are kept out of invoice lists, revenue figures and e-invoicing.

Features

  • Quotes page in the navigation, with status filters; create/edit uses the invoice editor in quote mode; detail page with status history.
  • Statuses: draft → sent → accepted / declined. A sent quote past its valid until date (stored in due_date) is shown as expired (derived, like "overdue") and can still be accepted. Quotes can be revised until accepted or declined and can always be deleted; they can't be voided or credited.
  • Create invoice: turns a sent or accepted quote into a draft invoice with the same customer, lines, discount and tax settings, links quote and invoice both ways and marks the quote accepted. The invoice gets its number from the invoice sequence when it is published.
  • Numbering: quotes always use their own pattern (Quote Number Pattern, default QUO-{YYYY}-{SEQ}) and are numbered when created, so they never use up or leave gaps in invoice numbers. New quotes are valid for 30 days by default (Quotes are valid for (days)).
  • PDF/HTML: quote wording in all invoice languages (title, number, date, "Valid until", recipient heading; German: "Angebot", "Gültig bis", "Angebot für"). No bank details. No e-invoice XML is generated or embedded for quotes (the XML endpoints return 400). Files are named quote-<number>.
  • Public link and email work as for invoices; the public page says "Quote" and hides the XML menu.
  • Permissions: new quotes resource (read, create, update, delete, publish, export) in the permission matrix. Routes on a single document (/invoices/:id/...) now check the quotes or invoices permissions depending on the document type (requireDocumentPermission); listing, creating and the quote-only actions are under /api/v1/quotes.

Database

  • Status CHECK constraint now also allows accepted and declined. Existing databases are migrated by the existing table rebuild (migrateInvoicesForVoided), which now also triggers when accepted is missing and keeps all rows.
  • New column invoices.quote_id (invoice created from a quote).

Other change

Saving a document whose status is only derived (overdue, expired) now keeps the stored status. Previously saving an overdue invoice from the editor wrote overdue into the database.

Verification

  • New backend/src/controllers/quotes_test.ts (8 tests): numbering, separate lists, status flow and expiry, revising, delete/void/credit rules, creating an invoice from a quote, duplicating, PDF labels.
  • All backend and frontend tests pass, deno check and svelte-check have no errors.
  • Clicked through on a fresh instance: quote QUO-2026-001 (2,975.00) → sent → PDF and public link → Create invoice → invoice published as RE-001 → quote accepted and linked. Expired and declined quotes, redirects between /invoices/:id and /quotes/:id, and that quotes don't appear in the invoice list or dashboard data.
  • Ran the new version on a copy of an existing 2.5.0 database (198 invoices, 737 items): migration ran, all rows and items preserved.

Not included

  • Customers accepting or declining a quote online.
  • Partial invoicing of a quote.

🤖 Generated with Claude Code

Quotes (Angebote) can now be created, sent and turned into invoices.
They are stored as documents like invoices (document_type 'quote'), so
they reuse the editor, line items, taxes, PDF templates, public links and
email, but they are kept out of invoice lists, revenue and e-invoicing.

- Quotes page with filters, create/edit (the invoice editor in quote
  mode), detail page with status history.
- Statuses: draft -> sent -> accepted / declined. A sent quote past its
  "valid until" date (stored as the due date) shows as expired and can
  still be accepted. Quotes can be revised until accepted or declined and
  can always be deleted; they cannot be voided or credited.
- "Create invoice" turns a sent or accepted quote into a draft invoice
  with the same customer, lines, discount and tax settings, links both
  ways and marks the quote accepted. The invoice gets its number from the
  invoice sequence when it is published.
- Numbering: quotes always use their own pattern (setting "Quote Number
  Pattern", default QUO-{YYYY}-{SEQ}) and are numbered when created, so
  they never use up or leave gaps in invoice numbers. New quotes are
  valid for 30 days by default (setting "Quotes are valid for (days)").
- PDF/HTML: quote wording in all invoice languages (title, number, date,
  "Valid until", recipient heading); no bank details. No e-invoice XML is
  generated or embedded for quotes. Files are named quote-<number>.
- Permissions: new "quotes" resource (read, create, update, delete,
  publish, export). Routes on a single document check the quotes or
  invoices permissions depending on the document type.
- Database: status CHECK now allows 'accepted' and 'declined' (existing
  databases are migrated by the existing table rebuild, which keeps all
  rows), new column invoices.quote_id.
- Saving a document whose status is only derived ("overdue", "expired")
  keeps the stored status instead of writing the derived one.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@kittendevv

Copy link
Copy Markdown
Owner

Could you also fix these?

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Bouni

Bouni commented Nov 27, 2026

Copy link
Copy Markdown
Contributor Author

@kittendevv done

@kittendevv
kittendevv merged commit e5d8057 into kittendevv:main Nov 28, 2026
4 checks 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