Skip to content

Add invoice duplication flow (list/detail → new invoice prefill)#57

Merged
capaj merged 1 commit into
mainfrom
codex/implement-issue-16-for-duplicating-items
May 28, 2026
Merged

Add invoice duplication flow (list/detail → new invoice prefill)#57
capaj merged 1 commit into
mainfrom
codex/implement-issue-16-for-duplicating-items

Conversation

@capaj

@capaj capaj commented May 28, 2026

Copy link
Copy Markdown
Owner

Motivation

  • Provide a quick way to duplicate an existing invoice from the invoice list or detail view and open a pre-filled new invoice form.
  • Ensure duplicated invoices use the next invoice number and shift date fields into the current month to avoid stale dates.

Description

  • Added a "Duplikovat" menu item to IssuedInvoiceTable that links to /new-invoice?duplicateFrom=<id> and imported the Copy icon.
  • Added a "Duplikovat" button to InvoiceDetailPage that navigates to the same duplicate URL and imported the Copy icon.
  • In NewInvoicePage, read the duplicateFrom query parameter with useSearchParams, fetch the source invoice via trpcClient.invoices.getById (enabled only when the id is present), and reset the form when the invoice is available to pre-fill fields and items while keeping number set to the computed next invoice number.
  • Implemented date-shifting logic using djs so issued_on and taxable_fulfillment_due are moved to the current month while keeping a valid day-of-month, and mapped invoice items into the new form schema.

Testing

  • Ran TypeScript type-check (tsc --noEmit) which passed, and no new automated unit tests were added for this change.

Codex Task

@capaj capaj merged commit e8288b8 into main May 28, 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.

1 participant