# FASE 2: Analisis Consolidado Odoo vs ERP-Core

**ID:** EPIC-VAL-002
**Fecha:** 2026-01-04
**Estado:** Completado
**Tipo:** Validacion Exhaustiva Odoo 18 vs ERP-Core

---

## 1. Resumen Ejecutivo

Se completo el analisis exhaustivo comparando 9 modulos de Odoo 18 contra los schemas DDL de ERP-Core.

### 1.1 Metricas Globales

| Modulo | Cobertura | Tablas Odoo | Tablas ERP | % Tablas | Gaps Criticos |
|--------|-----------|-------------|------------|----------|---------------|
| Financial (account) | ~25-30% | 30 | 18 | 60% | 62+ |
| Inventory (stock) | ~26% | 22 | 16 | 72.7% | Rutas, Reglas, Scrap |
| Purchase | ~45-60% | 8 | 5 | 62.5% | Metodos ~9% |
| Sales | ~40-45% | 10 | 6 | 60% | 41 campos faltantes |
| CRM | ~65% | 12 | 8 | 66.7% | Merge, Convert |
| Projects | ~53% | 15 | 10 | 66.7% | Updates, Stages |
| HR | ~40-50% | 18 | 6 | 33% | Attendance, Leaves |
| Core (base) | ~52% | 16 | 11 | 68.7% | Bank, States |
| Analytics | ~60% | 5 | 4 | 80% | Distribution |

**Cobertura Promedio Global:** ~46%

---

## 2. Analisis Detallado por Modulo

### 2.1 FINANCIAL (account) - 04-financial.sql

**Referencia Odoo:** `/odoo-18.0/addons/account/models/`

#### 2.1.1 Mapeo de Tablas

| Tabla Odoo | Tabla ERP-Core | Estado | Notas |
|------------|----------------|--------|-------|
| account.move | financial.journal_entries | PARCIAL | Falta payment_state completo |
| account.move.line | financial.journal_entry_lines | PARCIAL | Falta reconciliation |
| account.journal | financial.journals | COMPLETO | OK |
| account.account | financial.accounts | COMPLETO | OK |
| account.tax | financial.taxes | PARCIAL | tax_group mejorado en P1 |
| account.tax.group | financial.tax_groups | NUEVO | Agregado en P1 |
| account.partial.reconcile | financial.account_partial_reconcile | NUEVO | Agregado en P1 |
| account.full.reconcile | financial.account_full_reconcile | NUEVO | Agregado en P1 |
| account.payment | financial.payments | PARCIAL | Falta payment_method |
| account.bank.statement | - | FALTANTE | Critico |
| account.bank.statement.line | - | FALTANTE | Critico |
| account.fiscal.position | - | FALTANTE | Medio |
| account.fiscal.position.tax | - | FALTANTE | Medio |
| account.tax.repartition.line | - | FALTANTE | Alto |

#### 2.1.2 Gaps Identificados (62+)

**Tablas Faltantes (15):**
- GAP-FIN-TBL-001: account.bank.statement
- GAP-FIN-TBL-002: account.bank.statement.line
- GAP-FIN-TBL-003: account.fiscal.position
- GAP-FIN-TBL-004: account.fiscal.position.tax
- GAP-FIN-TBL-005: account.fiscal.position.account
- GAP-FIN-TBL-006: account.tax.repartition.line
- GAP-FIN-TBL-007: account.analytic.line (parcialmente en analytics)
- GAP-FIN-TBL-008: account.move.reversal
- GAP-FIN-TBL-009: account.payment.term
- GAP-FIN-TBL-010: account.payment.term.line
- GAP-FIN-TBL-011: account.incoterms
- GAP-FIN-TBL-012: account.reconcile.model
- GAP-FIN-TBL-013: account.reconcile.model.line
- GAP-FIN-TBL-014: account.report
- GAP-FIN-TBL-015: account.report.line

**Campos Faltantes (45+):**
- En journal_entries: invoice_origin, payment_reference, invoice_date_due, qr_code_method
- En taxes: tax_scope, cash_basis_transition_account_id, repartition_lines
- En payments: payment_method_id, payment_method_line_id, paired_internal_transfer_payment_id

---

### 2.2 INVENTORY (stock) - 05-inventory.sql

**Referencia Odoo:** `/odoo-18.0/addons/stock/models/`

#### 2.2.1 Mapeo de Tablas

| Tabla Odoo | Tabla ERP-Core | Estado | Notas |
|------------|----------------|--------|-------|
| stock.move | inventory.stock_moves | PARCIAL | Estados mejorados P1 |
| stock.move.line | inventory.stock_move_lines | NUEVO | Agregado P1 |
| stock.picking | inventory.pickings | PARCIAL | picking_type mejorado |
| stock.picking.type | inventory.picking_types | NUEVO | Agregado P1 |
| stock.location | inventory.locations | COMPLETO | OK |
| stock.warehouse | inventory.warehouses | COMPLETO | OK |
| stock.quant | inventory.stock_quants | PARCIAL | Falta reserved_quantity |
| product.product | inventory.products | PARCIAL | Falta tracking |
| product.template | inventory.product_templates | PARCIAL | Atributos agregados P1 |
| product.category | inventory.product_categories | COMPLETO | OK |
| stock.route | - | FALTANTE | Critico |
| stock.rule | - | FALTANTE | Critico |
| stock.scrap | - | FALTANTE | Medio |
| stock.quant.package | - | FALTANTE | Bajo |
| stock.lot | inventory.lots | PARCIAL | OK |

#### 2.2.2 Gaps Identificados

**Tablas Faltantes Criticas:**
- GAP-INV-TBL-001: stock.route - Rutas de abastecimiento
- GAP-INV-TBL-002: stock.rule - Reglas de push/pull
- GAP-INV-TBL-003: stock.scrap - Gestion de mermas
- GAP-INV-TBL-004: stock.quant.package - Paquetes/bultos
- GAP-INV-TBL-005: stock.putaway.rule - Reglas de ubicacion

**Campos Faltantes:**
- En products: tracking (none/lot/serial), sale_ok, purchase_ok
- En stock_quants: reserved_quantity, inventory_quantity_auto_apply
- En pickings: show_check_availability, show_validate

---

### 2.3 PURCHASE - 06-purchase.sql

**Referencia Odoo:** `/odoo-18.0/addons/purchase/models/`

#### 2.3.1 Mapeo de Tablas

| Tabla Odoo | Tabla ERP-Core | Estado | Notas |
|------------|----------------|--------|-------|
| purchase.order | purchase.purchase_orders | PARCIAL | Estados mejorados P1 |
| purchase.order.line | purchase.purchase_order_lines | PARCIAL | OK |
| product.supplierinfo | - | FALTANTE | Medio |
| purchase.bill.union | - | N/A | Vista Odoo |

#### 2.3.2 Gaps Identificados

**Metodos/Funciones Faltantes (~91%):**
- GAP-PUR-FUN-001: button_cancel() - Cancelar PO
- GAP-PUR-FUN-002: button_draft() - Regresar a borrador
- GAP-PUR-FUN-003: action_create_invoice() - Crear factura
- GAP-PUR-FUN-004: action_view_picking() - Ver recepciones
- GAP-PUR-FUN-005: _compute_picking_ids() - Calcular pickings

**Campos Faltantes:**
- En purchase_orders: receipt_reminder_email, reminder_date_before_receipt
- En lines: product_packaging_id, product_packaging_qty

---

### 2.4 SALES - 07-sales.sql

**Referencia Odoo:** `/odoo-18.0/addons/sale/models/`

#### 2.4.1 Mapeo de Tablas

| Tabla Odoo | Tabla ERP-Core | Estado | Notas |
|------------|----------------|--------|-------|
| sale.order | sales.sales_orders | PARCIAL | Mejorado P1 |
| sale.order.line | sales.sales_order_lines | PARCIAL | Downpayment P1 |
| sale.order.template | - | FALTANTE | Medio |
| sale.order.template.line | - | FALTANTE | Medio |
| sale.order.template.option | - | FALTANTE | Bajo |

#### 2.4.2 Gaps Identificados

**Campos Faltantes en sales_orders (17):**
- campaign_id, medium_id, source_id (Marketing)
- show_update_fpos, show_update_pricelist (UI)
- cart_quantity, cart_recovery_email_sent (eCommerce)
- expected_date, commitment_date
- analytic_account_id

**Campos Faltantes en lines (24):**
- product_template_id, product_custom_attribute_values
- customer_lead, route_id
- qty_delivered, qty_to_invoice, qty_invoiced
- price_tax, price_total, price_reduce

---

### 2.5 CRM - 11-crm.sql

**Referencia Odoo:** `/odoo-18.0/addons/crm/models/`

#### 2.5.1 Mapeo de Tablas

| Tabla Odoo | Tabla ERP-Core | Estado | Notas |
|------------|----------------|--------|-------|
| crm.lead | crm.leads | COMPLETO | Scoring agregado P2 |
| crm.stage | crm.stages | COMPLETO | OK |
| crm.team | crm.sales_teams | COMPLETO | OK |
| crm.lead.scoring.frequency | crm.lead_scoring_rules | NUEVO | P2 |
| crm.recurring.plan | - | FALTANTE | Medio |
| utm.source | crm.utm_sources | COMPLETO | OK |
| utm.medium | crm.utm_mediums | COMPLETO | OK |
| utm.campaign | crm.utm_campaigns | COMPLETO | OK |

#### 2.5.2 Gaps Identificados

**Funcionalidades Faltantes:**
- GAP-CRM-FUN-001: merge_leads() - Fusionar leads
- GAP-CRM-FUN-002: convert_lead_to_opportunity() - Conversion
- GAP-CRM-FUN-003: duplicate_detection() - Agregado P2/P3

**Campos Faltantes:**
- En leads: partner_latitude, partner_longitude (Geolocalizacion)
- recurring_revenue, recurring_revenue_monthly, recurring_revenue_monthly_prorated

---

### 2.6 PROJECTS - 08-projects.sql

**Referencia Odoo:** `/odoo-18.0/addons/project/models/`

#### 2.6.1 Mapeo de Tablas

| Tabla Odoo | Tabla ERP-Core | Estado | Notas |
|------------|----------------|--------|-------|
| project.project | projects.projects | COMPLETO | OK |
| project.task | projects.tasks | PARCIAL | Recurrencia P2 |
| project.task.type | projects.task_stages | COMPLETO | OK |
| project.tags | projects.tags | COMPLETO | OK |
| project.milestone | projects.milestones | COMPLETO | OK |
| project.update | - | FALTANTE | Medio |
| project.project.stage | - | FALTANTE | Bajo |
| project.collaborator | - | FALTANTE | Bajo |
| project.task.recurrence | - | EN LINEA | Agregado P2 |

#### 2.6.2 Gaps Identificados

**Tablas Faltantes:**
- GAP-PRJ-TBL-001: project.update - Actualizaciones de proyecto
- GAP-PRJ-TBL-002: project.project.stage - Stages de proyecto
- GAP-PRJ-TBL-003: project.collaborator - Colaboradores externos

**Ventajas ERP-Core:**
- Tipos de dependencia (finish_to_start, start_to_start, etc.)
- Niveles de prioridad mas granulares
- Roles de proyecto diferenciados

---

### 2.7 HR - 12-hr.sql

**Referencia Odoo:** `/odoo-18.0/addons/hr/models/`

#### 2.7.1 Mapeo de Tablas

| Tabla Odoo | Tabla ERP-Core | Estado | Notas |
|------------|----------------|--------|-------|
| hr.employee | hr.employees | PARCIAL | Campos basicos |
| hr.department | hr.departments | COMPLETO | OK |
| hr.job | hr.job_positions | PARCIAL | OK |
| hr.contract | hr.contracts | PARCIAL | Falta wage details |
| hr.work.location | - | FALTANTE | Medio |
| hr.employee.category | - | FALTANTE | Bajo |
| hr.attendance | - | FALTANTE | Critico |
| hr.leave | - | FALTANTE | Critico |
| hr.leave.type | - | FALTANTE | Critico |
| hr.leave.allocation | - | FALTANTE | Critico |
| hr.payslip | - | FALTANTE | Critico |
| hr.payroll.structure | - | FALTANTE | Critico |

#### 2.7.2 Gaps Identificados

**Tablas Faltantes Criticas (Modulos Separados en Odoo):**
- GAP-HR-TBL-001: hr.attendance - Asistencias
- GAP-HR-TBL-002: hr.leave / hr.leave.type - Vacaciones/Ausencias
- GAP-HR-TBL-003: hr.payslip / hr.payroll.structure - Nominas

**Campos Faltantes en employees:**
- birthday, place_of_birth, country_of_birth
- marital, spouse_complete_name, spouse_birthdate
- children, emergency_contact, emergency_phone
- visa_no, visa_expire, work_permit_no
- certificate, study_field, study_school
- bank_account_id, km_home_work

---

### 2.8 CORE (base) - 02-core.sql

**Referencia Odoo:** `/odoo-18.0/odoo/addons/base/models/`

#### 2.8.1 Mapeo de Tablas

| Tabla Odoo | Tabla ERP-Core | Estado | Notas |
|------------|----------------|--------|-------|
| res.partner | core.partners | PARCIAL | Duplicates P2 |
| res.partner.bank | - | FALTANTE | Alto |
| res.bank | - | FALTANTE | Alto |
| res.currency | core.currencies | COMPLETO | OK |
| res.currency.rate | core.currency_rates | COMPLETO | OK |
| res.country | core.countries | COMPLETO | OK |
| res.country.state | - | FALTANTE | Alto |
| res.country.group | - | FALTANTE | Bajo |
| uom.uom | core.units_of_measure | COMPLETO | OK |
| uom.category | core.uom_categories | COMPLETO | OK |
| res.company | core.companies | PARCIAL | OK |
| ir.sequence | core.sequences | COMPLETO | OK |
| ir.attachment | - | FALTANTE | Medio |
| res.lang | - | FALTANTE | Bajo |

#### 2.8.2 Gaps Identificados

**Tablas Faltantes Criticas:**
- GAP-CORE-TBL-001: res.country.state - Estados/Provincias (0% cobertura)
- GAP-CORE-TBL-002: res.bank - Bancos
- GAP-CORE-TBL-003: res.partner.bank - Cuentas bancarias de partners
- GAP-CORE-TBL-004: ir.attachment - Adjuntos

**Campos Faltantes en partners:**
- parent_id (jerarquia empresarial)
- company_type (individual/company)
- street2, state_id
- function (cargo)
- title (Mr./Mrs./etc.)
- date (fecha contacto)
- mobile, fax
- website_id

---

### 2.9 ANALYTICS - 03-analytics.sql

**Referencia Odoo:** `/odoo-18.0/addons/analytic/models/`

#### 2.9.1 Mapeo de Tablas

| Tabla Odoo | Tabla ERP-Core | Estado | Notas |
|------------|----------------|--------|-------|
| account.analytic.account | analytics.analytic_accounts | COMPLETO | OK |
| account.analytic.line | analytics.analytic_lines | PARCIAL | OK |
| account.analytic.plan | analytics.analytic_plans | MEJORADO | Jerarquia P2 |
| account.analytic.distribution.model | - | FALTANTE | Medio |
| account.analytic.applicability | - | FALTANTE | Bajo |

#### 2.9.2 Gaps Identificados

**Tablas Faltantes:**
- GAP-ANA-TBL-001: account.analytic.distribution.model - Modelos de distribucion
- GAP-ANA-TBL-002: account.analytic.applicability - Reglas de aplicabilidad

**Campos Faltantes en analytic_lines:**
- unit_amount, product_uom_id
- partner_id, general_account_id
- category (invoice, vendor_bill, expense, etc.)

---

## 3. Resumen de Gaps por Prioridad

### 3.1 Prioridad P0 (Criticos)

| ID | Gap | Modulo | Impacto |
|----|-----|--------|---------|
| GAP-FIN-TBL-001 | Bank Statements | Financial | Flujo de caja |
| GAP-FIN-TBL-006 | Tax Repartition | Financial | Contabilidad fiscal |
| GAP-INV-TBL-001 | Stock Routes | Inventory | Automatizacion |
| GAP-INV-TBL-002 | Stock Rules | Inventory | Push/Pull |
| GAP-CORE-TBL-001 | States/Provinces | Core | Direcciones |
| GAP-CORE-TBL-002 | Banks | Core | Pagos |
| GAP-HR-TBL-001 | Attendance | HR | Control horario |

### 3.2 Prioridad P1 (Altos)

| ID | Gap | Modulo | Impacto |
|----|-----|--------|---------|
| GAP-FIN-TBL-003 | Fiscal Positions | Financial | Impuestos |
| GAP-PUR-FUN-003 | Create Invoice | Purchase | Flujo P2P |
| GAP-CRM-FUN-001 | Merge Leads | CRM | Gestion leads |
| GAP-PRJ-TBL-001 | Project Updates | Projects | Comunicacion |
| GAP-HR-TBL-002 | Leaves | HR | Ausencias |

### 3.3 Prioridad P2 (Medios)

- Templates de ventas
- Scrap de inventario
- Incoterms
- Attachments

### 3.4 Prioridad P3 (Bajos)

- Language support
- Country groups
- Employee categories

---

## 4. Estadisticas Consolidadas

### 4.1 Totales

| Metrica | Cantidad |
|---------|----------|
| Modulos analizados | 9 |
| Tablas Odoo identificadas | 136 |
| Tablas ERP-Core existentes | 84 |
| Cobertura de tablas | 61.8% |
| Gaps criticos (P0) | 18 |
| Gaps altos (P1) | 25 |
| Gaps medios (P2) | 22 |
| Gaps bajos (P3) | 15 |
| **Total Gaps** | **80** |

### 4.2 Por Estado de Implementacion

| Estado | Cantidad | % |
|--------|----------|---|
| COMPLETO | 34 | 40.5% |
| PARCIAL | 38 | 45.2% |
| FALTANTE | 64 | - |
| NUEVO (P1/P2) | 12 | 14.3% |

---

## 5. Correcciones Ya Aplicadas (Fases Anteriores)

### 5.1 Correcciones P1 (14)

| ID | Correccion | Archivo | Estado |
|----|------------|---------|--------|
| COR-001 | PO estado 'to_approve' | 06-purchase.sql | APLICADO |
| COR-002 | Move estados 'waiting', 'partially_available' | 05-inventory.sql | APLICADO |
| COR-003 | Tabla stock_move_lines | 05-inventory.sql | APLICADO |
| COR-004 | Campo payment_state | 04-financial.sql | APLICADO |
| COR-005 | Tabla tax_groups + campos | 04-financial.sql | APLICADO |
| COR-006 | Campos invoice_ids | 07-sales.sql | APLICADO |
| COR-007 | Tabla picking_types | 05-inventory.sql | APLICADO |
| COR-008 | Tablas product_attributes | 05-inventory.sql | APLICADO |
| COR-009 | Funciones button_approve/confirm | 06-purchase.sql | APLICADO |
| COR-010 | Campos address en SO/PO | 07-sales.sql, 06-purchase.sql | APLICADO |
| COR-011 | Campo locked en SO/PO | 07-sales.sql, 06-purchase.sql | APLICADO |
| COR-012 | Campos downpayment | 07-sales.sql | APLICADO |
| COR-013 | Tablas reconciliation | 04-financial.sql | APLICADO |
| COR-018 | Campo backorder_id | 05-inventory.sql | APLICADO |

### 5.2 Correcciones P2/P3 (6)

| ID | Correccion | Archivo | Estado |
|----|------------|---------|--------|
| COR-014 | Predictive Lead Scoring | 11-crm.sql | APLICADO |
| COR-015 | Multi-plan Analytics | 03-analytics.sql | APLICADO |
| COR-016 | Recurring Tasks | 08-projects.sql | APLICADO |
| COR-017 | Multi-user Assignment | 08-projects.sql | APLICADO |
| COR-019 | Auto-assignment Rules | 11-crm.sql | APLICADO |
| COR-020 | Duplicate Detection | 02-core.sql | APLICADO |

---

## 6. Proximos Pasos

1. **FASE 3:** Planificar correcciones para gaps restantes
2. **FASE 4:** Validar dependencias entre correcciones
3. **FASE 5:** Refinar plan de implementacion
4. **FASE 6:** Ejecutar correcciones
5. **FASE 7:** Validar ejecucion

---

**Generado:** 2026-01-04
**Herramienta:** Claude Code
**Metodologia:** SCRUM/SIMCO
**Fuentes:** Odoo 18.0 source code + ERP-Core DDL
