DocHub
Custom Odoo module for CAI invoice authorization — required by Honduras tax law

Honduras SAR Compliance Module

What is SAR / CAI?

SAR (Servicio de Administracion de Rentas) is Honduras’s tax authority. All businesses issuing invoices must comply with SAR’s electronic invoicing rules.

CAI (Clave de Autorizacion de Impresion) is a Print Authorization Key — a code issued by SAR that authorizes a business to print invoices within a specific number range and time period.

Why This Module Exists

Honduras law requires every commercial invoice to include:

Field Description
Razon Social Legal business name
RTN 14-digit tax ID (Registro Tributario Nacional)
“FACTURA” Document type label
CAI Authorization code from SAR
Rango Autorizado Authorized invoice number range
Fecha Limite CAI expiration date
Numero de Factura Sequential invoice number in prescribed format
ISV Tax amount shown separately
“Original: Cliente / Copia: Emisor” Copy designation

When transaction exceeds L 10,000 the customer’s RTN must also appear on the invoice.

Odoo has no built-in Honduras localization, so this custom module was built.

Module Details

Item Value
Module name honduras_sar
Version 17.0.1.0.0
Category Accounting/Localizations
Dependencies point_of_sale, account
License LGPL-3
Location addons/honduras_sar/

Files

addons/honduras_sar/
├── __init__.py
├── __manifest__.py          # Module metadata and dependencies
├── models/
│   ├── __init__.py
│   └── cai_authorization.py # Core CAI model (266 lines)
├── views/
│   ├── cai_views.xml        # Tree and form views
│   └── menu.xml             # Menu structure under POS
└── security/
    └── ir.model.access.csv  # ACL: POS users read-only, managers full CRUD

Invoice Number Format

Honduras invoices use a 16-digit format:

NNN-NNN-NN-NNNNNNNN
 |    |   |    |
 |    |   |    +-- Sequential number (8 digits, zero-padded)
 |    |   +------- Document type (01 = Invoice)
 |    +----------- Point of emission (001 = first register)
 +---------------- Establishment (001 = first location)

Example: 001-001-01-00000042

For Captain Van’s (single location, single register): prefix is always 001-001-01-

CAI Model Fields

The honduras.cai model manages authorization records:

Core Fields

Field Type Description
name Char CAI code from SAR (required)
establishment Char(3) Location code (default: 001)
emission_point Char(3) Register code (default: 001)
document_type Char(2) Document type (default: 01 = Invoice)
range_start Integer First authorized invoice number
range_end Integer Last authorized invoice number
current_number Integer Next invoice number to issue
expiration_date Date CAI validity deadline
is_active Boolean Active flag (only one per company)
state Selection draft / active / exhausted / expired

Computed Fields

Field Purpose
range_used Numbers already issued
range_remaining Available invoice numbers
usage_percent Percentage of range consumed
days_until_expiry Days remaining before expiration
warning_message Auto-generated warnings (80% usage, 30 days to expiry, expired, exhausted)
range_display Formatted range: “Del 001-001-01-00000001 al 001-001-01-00001000”
prefix_display Invoice prefix: “001-001-01-”

Constraints

  • Single active CAI: Only one CAI can be active per company (enforced by _check_single_active)
  • Valid range: range_start must be <= range_end
  • Valid current: current_number cannot be < range_start

Key Methods

action_activate()

Activates a CAI record:

  1. Deactivates any other active CAI for the same company
  2. Sets state to “active”
  3. Calls _update_pos_config() to update POS receipt and invoice sequence

action_deactivate()

Deactivates the CAI, sets state back to “draft”.

_update_pos_config()

Automatically updates POS configuration:

  • Sets invoice sequence to match the CAI range
  • Updates receipt header with CAI code, authorized range, and expiration
  • Updates receipt footer with legal copy designation

get_next_invoice_number()

Returns the next invoice number formatted as 001-001-01-00000042, increments the counter. Marks CAI as “exhausted” if range is consumed.

User Interface

Access

Point of Sale > Configuration > Honduras SAR > CAI Authorizations

Tree View

Shows all CAIs with: state badge, usage percentage, warning messages, days until expiry.

Form View

Full CAI editor with:

  • Activate / Deactivate buttons
  • Usage statistics and progress
  • Warning banners
  • Range preview formatted for receipt

Security

Role Access
POS User Read only
POS Manager Full CRUD

Activation Workflow

  1. Client obtains RTN from SAR (14-digit Registro Tributario Nacional)
  2. Client requests CAI from SAR (Form SAR-927)
  3. Enter RTN: Settings > Companies > Captain Van’s > Tax ID (VAT)
  4. Create CAI record: POS > Configuration > Honduras SAR > CAI Authorizations
    • Enter CAI code, range start/end, expiration date
  5. Click Activate
  6. POS receipt automatically updates with all legal fields

Receipt Layout (After Activation)

              Captain Van's
    West End, Roatan, Islas de la Bahia
           Tel: +504-XXXX-XXXX

               FACTURA
    RTN: XXXXXXXXXXXXXX
    CAI: XXXXXX-XXXXXX-XXXXXX-XXXXXX-...
    Rango: Del 001-001-01-00000001
           al  001-001-01-00001000
    Fecha Limite: DD/MM/YYYY

    No. Factura: 001-001-01-00000042

    ─────────────────────────────
    [items, quantities, prices]
    ─────────────────────────────
    Subtotal:     L XXX.XX
    ISV 15%:      L  XX.XX
    Total:        L XXX.XX

    Original: Cliente / Copia: Emisor
           Gracias por su compra!