Skip to content

Como integrar Cargoffer con Odoo

Lo que vas a conseguir

Sincronizar contratos y facturas de Cargoffer con Odoo automaticamente, sin tener que introducir datos manualmente.

El flujo de integracion

Contrato firmado en Cargoffer → Webhook → Tu sistema → Crear factura en Odoo

Paso 1: Configurar webhook en Cargoffer

Documentacion: docs.cargoffer.com/#tag/webhooks

bash
curl -X POST "https://api.pro.cargoffer.com/api/webhook" \
  -H "Authorization: Bearer *** \
  -H "Content-Type: application/json" \
  -d '{"url": "https://tu-odoo.com/webhook/cargoffer", "events": ["contract.signed"]}'

Paso 2: Recibir el evento en Odoo

Cuando se firme un contrato, recibiras:

json
{
  "event": "contract.signed",
  "data": {
    "serviceCode": "SRV-2026-001",
    "amount": 1250.00,
    "client": {"name": "Cliente SA", "cif": "A12345678"},
    "date": "2026-06-17"
  }
}

Paso 3: Crear factura en Odoo via XML-RPC

python
import requests
import xmlrpc.client

# Conectar a Odoo
odoo_url = "https://tu-odoo.com"
db = "produccion"
uid = 1
password = "tu_password"


models = xmlrpc.client.ServerProxy(f"{odoo_url}/xmlrpc/2/object")

# Buscar cliente por CIF
partner_id = models.execute_kw(db, uid, password,
    "res.partner", "search", [[["vat", "=", "A12345678"]]])

# Crear factura
invoice_id = models.execute_kw(db, uid, password,
    "account.move", "create", [{
        "move_type": "out_invoice",
        "partner_id": partner_id[0] if partner_id else False,
        "invoice_line_ids": [(0, 0, {
            "name": "Transporte SRV-2026-001",
            "quantity": 1,
            "price_unit": 1250.00
        })]
    }])

Otras integraciones

Mira tambien: Sage 50, Contasol, SAP, Dynamics.

Documentación de Cargoffer