VAVANG INVOICE / DOCS / EN

Generate an invoice

Use this procedure when you need to generate or recover the compliance document for an invoice that already exists in Sylius.

Preconditions

Before generating anything:

  1. the Sylius invoice must already exist;
  2. Invoice must have captured the immutable fiscal snapshot for that invoice;
  3. the supported stack and database migrations must be in place;
  4. blocking diagnostics must be resolved.
bin/console sylius-invoice:check-requirements
bin/console sylius-invoice:compliance:doctor

See Requirements, Configuration and Invoice data for the underlying contracts.

Generate the compliance document

Run the command with the Sylius invoice identifier:

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

To also copy the resulting Factur-X PDF to a file you control:

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

--output is an export path. The plugin still keeps the governed compliance artefacts in its own storage.

Expected result

For a valid invoice, Invoice builds the electronic invoice from the frozen fiscal data, generates the Factur-X PDF and structured XML, validates the electronic document, stores integrity hashes and records the compliance document.

The manual generation command does not transmit the document to a platform/provider. Transmission remains a separate concern; keep it in MANUAL while onboarding unless automatic transmission has deliberately been configured.

Exit codes

Code Meaning
0 Generation succeeded, or the existing valid document was reused as an idempotent no-op.
1 Generation failed. Read the command error and compliance diagnostics before retrying.
2 The supplied invoice identifier does not resolve to an invoice.

Important behavior

Generation is intentionally idempotent. Re-running the command does not create a second fiscal invoice or a new invoice number. If a complete, valid compliance document already exists, it is reused.

If you are trying to recover a missing artefact, continue with Regenerate an invoice. To retrieve the generated files, see Download an invoice.