Skip to content

[IP-160]: convert a quote to a draft invoice#573

Closed
nielsdrost7 wants to merge 2 commits into
developfrom
feature/160-convert-quote-to-invoice
Closed

[IP-160]: convert a quote to a draft invoice#573
nielsdrost7 wants to merge 2 commits into
developfrom
feature/160-convert-quote-to-invoice

Conversation

@nielsdrost7

Copy link
Copy Markdown
Collaborator

Addresses #160 (kept open per workflow — PRs stay draft).

What

  • QuoteService::convertQuoteToInvoice(Quote): Invoice — inside a transaction: copies prospect_id → customer_id, all quote items (name, qty, price, discounts, both tax rates, task link), the discount/tax/total summary, and summary/terms/footer onto a new draft invoice; then sets the quote to the new QuoteStatus::CONVERTED case.
  • The draft is created with a null invoice number — consistent with the duplicate-prevention observer (PR [IP-513]: duplicate-number prevention via Observers #540) that allows multiple nulls for drafts; numbering is assigned when the invoice leaves draft.
  • Converting twice throws and is surfaced as a danger notification; the convert_to_invoice table action (existing stub, now wired) hides for already-converted quotes and requires confirmation.

Deviation from the SMART plan: no redirect to EditInvoice — that page only exists on PR #544's branch. Trivial follow-up once #544 lands.

Tests

QuoteConversionTest — 3 tests: full conversion (items, totals, status), double-conversion rejection, action visibility.

Note: upstream CI fails at job startup on every branch — validated locally; Quotes+Invoices suites match the develop baseline exactly plus the new passing tests.

🤖 Generated with Claude Code

nielsdrost7 and others added 2 commits July 3, 2026 20:25
QuoteService::convertQuoteToInvoice() copies the client, items, totals,
and summary fields onto a new unnumbered draft invoice inside a
transaction, then marks the quote Converted (new QuoteStatus case).
The convert_to_invoice table action is wired to the service, requires
confirmation, and hides once a quote is converted.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 5c44b6db-1e86-4f9a-a2ca-6f49d4b8e09f

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/160-convert-quote-to-invoice

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@nielsdrost7 nielsdrost7 closed this Jul 3, 2026
@nielsdrost7 nielsdrost7 deleted the feature/160-convert-quote-to-invoice branch July 3, 2026 19:27
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.

1 participant