Generation Modes
The E-Invoice extension supports multiple generation modes to fit different business scenarios. These modes apply to invoices and, when enabled, to credit memos.
Overview
| Mode | Processing | Best For |
|---|---|---|
| Disabled (Manual Only) | No automatic generation | Fully manual workflows |
| Immediate | During invoice save | Low volume, real-time needs |
| Queued | Message queue background | Medium volume, async processing |
| Cron Hourly | Scheduled batch processing | High volume, continuous batching |
| Cron Daily | Scheduled batch processing | Batch windows (e.g. nightly) |
Immediate Mode
E-invoices are generated synchronously when an invoice is created.
How It Works
- Admin creates invoice
- E-invoice is generated immediately
- Files are saved to storage
- Invoice status is updated
- Invoice save completes
Pros & Cons
| Pros | Cons |
|---|---|
| Instant feedback | Slows invoice creation |
| Real-time status | Not suitable for high volume |
| Simple setup | Errors block invoice (if configured) |
Configuration
Stores >Configuration > MageB2B > E-Invoice > Invoice Settings Generation Mode: ImmediateQueued Mode
E-invoices are added to a message queue for background processing.
How It Works
- Admin creates invoice
- Generation request is queued
- Invoice save completes immediately
- Background consumer processes queue
- Status is updated asynchronously
Requirements
- Magento Message Queue configured
- Queue consumer running:
php bin/magento queue:consumers:start mageb2b.einvoice.generatePros & Cons
| Pros | Cons |
|---|---|
| Non-blocking invoice creation | Requires queue setup |
| Scalable | Delayed status updates |
| Error isolation | More complex monitoring |
Configuration
Stores >Configuration > MageB2B > E-Invoice > Invoice Settings Generation Mode: QueuedCron Hourly Mode
E-invoices are generated in batches by a scheduled cron job.
How It Works
- Admin creates invoice
- Invoice is marked as "pending" e-invoice
- Hourly cron runs
- Pending invoices are processed in batch
- Status is updated
Schedule
The cron runs every hour at minute 0:
0 * * * * # Every hourPros & Cons
| Pros | Cons |
|---|---|
| Best for high volume | Up to 1 hour delay |
| No queue infrastructure | Less real-time visibility |
| Batch efficiency | Errors accumulate |
Configuration
Stores >Configuration > MageB2B > E-Invoice > Invoice Settings Generation Mode: Cron HourlyCron Daily Mode
Cron Daily is also a batch mode, but with a daily schedule (default: 0 2 * * *).
- Useful when you want a controlled batch window (e.g. after business hours)
- Supports a Daily Cron Batch Size setting
Disabled / Manual Only
If you choose Disabled - Manual Only, the extension will not automatically generate E-Invoices.
You can still generate manually via:
- Admin document view action (“Generate E-Invoice”)
- Admin mass action (“Generate E-Invoice”)
- CLI command (
einvoice:generate) - REST API endpoint (
POST /V1/einvoice/invoice/{invoiceId}/generate)
Choosing a Mode
Use Immediate When:
- Processing < 100 invoices/day
- Real-time status is important
- Errors should immediately block workflow
Use Queued When:
- Processing 100-1000 invoices/day
- You have message queue infrastructure
- Non-blocking invoice creation is important
Use Cron Hourly When:
- Processing >1000 invoices/day
- Batch processing is acceptable
- Simple infrastructure is preferred
Status Values
| Status | Meaning |
|---|---|
pending | Waiting for generation (queued/cron modes) |
generated | Successfully generated |
error | Generation failed |
disabled | E-invoicing disabled for this invoice |
Monitoring
Check Pending Invoices
From admin: Sales >Invoices → Filter by e-invoice status "pending"
Logs
Check Magento logs for generation details:
var/log/system.logvar/log/exception.log
