VAVANG INVOICE / DOCS / EN

Regenerate an invoice

“Regenerate” in Invoice means idempotently replay or recover the compliance artefact from frozen fiscal data. It does not mean replacing an issued invoice.

When to use it

Use this procedure when:

  • generation was interrupted and an artefact is missing;
  • you want to replay generation after resolving a technical failure;
  • you want to confirm that the existing compliance document is still reusable.

Do not use regeneration to change customer data, amounts, taxes, invoice number or other fiscal values after issue. Those values come from the immutable invoice snapshot. See Invoice data.

Re-run the generation command

Use the same command as the initial generation:

bin/console compliance:invoice:generate <invoice-id>

You can request an exported PDF at the same time:

bin/console compliance:invoice:generate <invoice-id> --output=/tmp/invoice-factur-x.pdf

What Invoice does

The generator follows a guarded recovery path:

Existing state Result
Complete, validated document with valid XML/PDF integrity Reuse the existing document; no duplicate fiscal document is created.
Generated document awaiting validation Validate it before reuse.
Legitimately missing/incomplete generated artefact that can be reconstructed Rebuild it from the immutable invoice data.
Existing document is marked invalid Stop and surface the persisted validation errors.
Stored XML or Factur-X PDF fails integrity verification Stop; the artefact is not silently overwritten.
Reconstructed XML differs from the frozen structured XML Stop; Invoice refuses the fiscal divergence.

The command returns 0 for a successful recovery or idempotent no-op, 2 when the invoice cannot be found and 1 for other failures.

What regeneration never does

Regeneration does not:

  • allocate a new invoice number;
  • alter the original Sylius invoice;
  • recalculate fiscal history from mutable order data;
  • silently replace an integrity-failing artefact;
  • transmit the document to a platform from the manual generation command.

If the commercial correction changes what was invoiced, use a credit note rather than regeneration. For destructive “cancellation”, see Cancel an invoice.