CRMconnect Azuvio · Docs

Workflow: eTransport + eFactura — ANAF Compliance

Modules involved: eTransport · Billing (eFactura) · Invoices · Warehouse (Goods Delivery — optional reference)
Who uses it: Finance · Accounting · Logistics
Typical duration: eTransport = before departure · eFactura = on the day of issuance or automatically after N days

Overview

CRMConnect covers both ANAF obligations for companies in Romania:

Obligation Module Trigger
e-Transport (RO-e-Transport) etransport Manual — filled in by user before departure
e-Factura (RO e-Factura) billing → controller Efactura Manual (button on invoice) or automatic via cron

Architectural note: Both systems communicate through the CRMConnect intermediary (https://einvoice.crmconnect.ro/api/e-factura/), not directly with ANAF. The ANAF OAuth token is stored on the CRMConnect server, not locally. Authentication is done once at https://einvoice.crmconnect.ro/e-factura/auth.

eTransport is not generated automatically when a delivery note or sales order is created. The user manually completes the declaration, with the option to select existing delivery notes/invoices as a reference.


Flow diagram

[INITIAL SETUP — admin, once only]
  │
  ├── Settings → General: company_vat (company VAT number), instance_id (CRMConnect account)
  ├── Settings → default_country = Romania (142) ← condition for eFactura menu
  ├── ANAF token authorization: https://einvoice.crmconnect.ro/e-factura/auth
  │     (SPV ANAF login, token stored on CRMConnect proxy)
  └── Banking: at least one bank account (IBAN) configured in Billing → Banks
  │
  ↓
════════════════════════════════════════════
E-TRANSPORT (before departure)
════════════════════════════════════════════
  │
  ├── [Optional] Create delivery note in Warehouse or Sales Order
  │
  ├── eTransport → Documents → Add Declaration
  │     ├── Operation type (from tipuri_operatii table)
  │     ├── Commercial partner (client or vendor)
  │     ├── Vehicle: license plate (+ trailer 1/2 optional)
  │     ├── Transport date (open_till)
  │     ├── Goods transported: NC tariff code, UOM, quantity, weight, value
  │     ├── Route: start (county+address / customs office / border crossing point) + end
  │     └── Transport documents: delivery note/invoice (type, series, number, date) ← optional reference
  │
  ├── Initial status: Not sent (3)
  ├── "Send to eTransport" button → POST to einvoice.crmconnect.ro/generate-xml
  │     → Response: indexIncarcare (upload_index) + uit (UIT code)
  │     → Status becomes: In processing (0)
  ├── Status polling: Get Status → transport-status endpoint
  │     → Status becomes: Validated (1) or Error (2)
  │
  ├── If needed: Vehicle modification (send_modif_vehicul → type:'modifVehicul')
  └── If needed: Declaration deletion (type:'stergere' with existing UIT)
  │
  ↓
════════════════════════════════════════════
E-FACTURA (at issuance or automatically)
════════════════════════════════════════════
  │
  ├── Invoice created → automatic eligibility check:
  │     ✓ Currency = RON (currency_id = 3)
  │     ✓ Client country = Romania (cod_tara_client = 'RO')
  │     ✓ Invoice status ≠ cancelled, ≠ draft
  │
  ├── Path A — Manual: "Send eFactura" button on invoice
  │     → POST /billing/efactura/send_invoice/{id}
  │     → estatus = 'trimis'
  │
  └── Path B — Automatic (cron): autosend_efactura = 1
        → selects invoices: estatus IS NULL AND eindex IS NULL
        AND date = today - autosend_efactura_days (default 3 days)
        → limit 1 per cron run
  │
  ↓
[ANAF PROCESSING]
  │
  ├── estatus = 'in prelucrare' (ANAF processing)
  ├── Cron sync: polls up to 10 invoices per run
  │     → estatus = 'ok' (accepted) or 'nok' (rejected)
  └── On 'nok': download ZIP archive with errors (download-invoice endpoint)
  │
  ↓
[IMPORT RECEIVED INVOICES — optional]
  │
  ├── Cron: sync_efactura_invoices() every autoimport_efactura_interval hours
  ├── Polls company-messages endpoint (filters P and R)
  └── Automatically imports vendor invoices into Purchase → Vendor Invoices

[DECLARATIONS COMPLETE ✓ · INVOICES ACCEPTED BY ANAF ✓]

Step by step

1. Initial setup (admin)

1a. General settings

Where: /admin/settings → General Settings

Field Description
company_vat Company VAT number (with or without RO prefix — the code strips it automatically on submission)
instance_id CRMConnect account UUID (generated at registration)
customer_default_country Must be set to 142 (Romania) — without this, all eFactura pages return 404

1b. ANAF token authorization

Navigate to:

https://einvoice.crmconnect.ro/e-factura/auth?company_id={instance_id}&fiscal_code={VAT}&partner_id=2

You will be redirected to SPV ANAF for authentication with a digital certificate or SPV username+password. The resulting token is stored on the CRMConnect server — does not require manual renewal if the connection remains active.

You can verify the token status from: Billing → eFactura → Settings → Check ANAF Token.

1c. Bank account (for eFactura)

Where: /admin/billing → Banks → Add Bank Account

The IBAN appears in the e-Factura XML. Without at least one configured account, the generated XML does not include banking details.

1d. Test vs. production mode

Where: /admin/billing → eFactura → Settings → einvoice_test_mode

  • 1 = uses https://deveinvoice.crmconnect.ro/api/e-factura/ (sandbox)
  • 0 = production (default after completing setup)

2. eTransport declaration

Where: /admin/etransport → Documents → Add

2a. Operation types

The operation type determines mandatory fields and whether prior notifications are required (previous_notifications = true → the notificareAnterioara field becomes mandatory).

Required fields:

Field Description
operation_type Operation code (from tbletransport_tipuri_operatii)
id_client / id_provider Commercial partner (client or vendor)
vehicle_registration_number Vehicle license plate number
open_till Transport date

Goods transported (at least one):

Field Description
tariff_code NC tariff code (from tbletransport_cod_tarifar_nc)
operation_purpose Operation purpose code (from etransport_documente_scopuri_operatii)
unit_of_measure ANAF unit of measure code
quantity Quantity
total_net_weight / total_gross_weight Weights (kg)
unit_price_without_vat Unit price excluding VAT
currency Currency code (e.g., RON)

Route (start + end required): Each route point is one of: address (county + locality + street) / customs office (code from tbletransport_list_birou_vamal) / border crossing point (code from tbletransport_list_ptf).

Transport documents (at least one):

Field Description
type_document Document type code (from tbletransport_list_tip_document)
document_series_and_number Series and number
date_document Document date

2b. eTransport declaration statuses

status Label Meaning
3 Not sent Created locally, not sent to ANAF
0 In processing Sent, ANAF is processing
1 Validated Accepted by ANAF (UIT active)
2 Error Rejected by ANAF

UIT validity (uit_valability — display):

Value Meaning
2 Active
0 Expires today
3 Expired
1 Inactive

2c. Vehicle modification after submission

If the vehicle changes after the UIT has been issued, use the Modify Vehicle button — sends type: 'modifVehicul' with the new license plate and existing UIT.


3. Sending eFactura

Where: invoice → Send eFactura button OR automatically via cron

3a. Eligibility conditions (checked at submission)

Condition Detail
RON currency invoices.currency = 3 — invoices in other currencies cannot be sent
Client from Romania cod_tara_client = 'RO' — clients from other countries are excluded
Valid status Invoice is not cancelled or draft
Active token ANAF token must be valid on proxy

3b. eFactura statuses

estatus Meaning
NULL Not sent
'trimis' Sent, awaiting confirmation
'in prelucrare' ANAF processing
'ok' Accepted by ANAF
'nok' Rejected by ANAF — download the error archive

3c. Automatic sending via cron

Where: /admin/billing → eFactura → Settings

Option Description
autosend_efactura 1 = enable auto-send
autosend_efactura_days Days after issuance until automatic sending (default: 3)

The cron sends maximum 1 invoice per run in automatic mode. Rejected invoices (nok) are not automatically resent — manual intervention required.

3d. Importing vendor invoices from SPV

Where: /admin/billing → eFactura → Settings → autoimport_efactura_interval (hours)

The cron queries the SPV inbox and automatically imports invoices received from vendors into Purchase → Vendor Invoices. Works independently of eFactura sending.


Required permissions

Action Condition
eTransport — view/create/edit etransport module permissions
eFactura — manual sending Access to billing module + editable invoice
eFactura — settings (autosend, interval) is_admin()
ANAF token verification is_admin()
customer_default_country setting is_admin()

Gotchas

Problem Cause Solution
eFactura menu does not appear customer_default_country ≠ 142 Set default country to Romania in Settings → General
ANAF token expired OAuth token not renewed on proxy Re-authorize at https://einvoice.crmconnect.ro/e-factura/auth
Invoice rejected at submission (currency) Invoice is not in RON Issue the invoice in RON or convert manually
UIT expired before transport Declaration was not sent/validated in time Create a new declaration with a new UIT
eFactura nok from ANAF XML validation errors (incorrect VAT, missing tax code, etc.) Download the ZIP error archive → correct the invoice → manually resend
Autosend not sending Cron inactive or autosend_efactura_days not reached Check cron job + days setting
Vendor invoices not importing autoimport_efactura_interval = 0 or token invalid Set interval > 0 and verify the token

Module references

Tip

Generate and submit the eTransport declaration before goods physically depart — the UIT confirmation number must accompany the shipment and goods cannot legally leave without it. Build submission into the dispatch checklist, not as an afterthought.

Warning

The ANAF authentication token for e-invoicing expires periodically. A lapsed token silently blocks all B2B e-invoice submissions without an obvious error on the invoice itself — monitor token status in e-Invoice settings and renew proactively before expiry.