@startuml D-ARQ-TECH-002 — Arquitectura con Estilos Arquitectonicos Identificados

title SAP-TFI-2026 — Arquitectura de Odoo 19.0 con Estilos Arquitectonicos

skinparam shadowing false
skinparam handwritten false
skinparam defaultFontName Arial
skinparam defaultFontSize 11
skinparam linetype ortho
skinparam backgroundColor white

' ─────────────────────── ESTILOS APLICADOS ───────────────────────
note as N1
  Estilos arquitectonicos identificados:
  - Cliente-Servidor (browser <-> Odoo server)
  - 3-Tier / N-Tier (Cliente, Aplicacion, Datos)
  - MVC (Modelo-Vista-Controlador, extendido)
  - Capas (Presentation, Web, Logic, Data)
  - Pipe-and-Filter (request pipeline HTTP)
  - Microkernel (extension via _inherit)
  - Repository (ORM Odoo encapsula BD)
  - Event-Driven (mail.thread, onchange)
end note

' ─────────────────────── CLIENTE ───────────────────────
package "Cliente (Browser)\n[Estilo: Cliente-Servidor]" {
    node "Web Browser" as Browser
    node "JavaScript Runtime" as JSRuntime
}

' ─────────────────────── CAPA PRESENTACION ───────────────────────
package "Capa 2.1: Presentacion (UI)\n[Estilo: MVC - Vista]" {
    node "OWL Framework" as OWL
    node "Static Assets (JS/CSS)" as Static
    database "Views (XML)" as Views
}

' ─────────────────────── WEB LAYER ───────────────────────
package "Capa 2.2: Web Layer\n[Estilos: Pipe-and-Filter, MVC-Controlador]" {
    node "Router\n(addons/web/http.py)" as Router
    node "HTTP Controllers" as Controllers
    node "JSON-RPC Endpoint" as JSONRPC
    node "XML-RPC Endpoint" as XMLRPC
}

' ─────────────────────── LOGICA ───────────────────────
package "Capa 2.3: Business Logic\n[Estilos: MVC-Modelo, Microkernel, Event-Driven]" {
    node "Models (Python)\n(addons/<modulo>/models/)" as Models
    node "ORM (Object-Relational)\n[Estilo: Repository]" as ORM
    node "Compute Fields,\nonchange, constraints\n[Estilo: Event-Driven]" as Computed
}

' ─────────────────────── ADDONS ───────────────────────
package "Capa 2.4: Addons\n[Estilo: Microkernel (plugins via _inherit)]" {
    node "sale" as AddonSale
    node "account" as AddonAccount
    node "stock" as AddonStock
    node "product" as AddonProduct
}

' ─────────────────────── DATOS ───────────────────────
package "Capa 3: Persistencia\n[Estilo: 3-Tier - Capa de Datos]" {
    database "PostgreSQL\n[Estilo: Repository]" as DB
    node "Filestore" as Filestore
}

' ─────────────────────── INTEGRACION ───────────────────────
package "Capa 4: Integracion Externa\n[Estilos: Cliente-Servidor (inverso), Pipe-and-Filter]" {
    node "API REST" as RESTAPI
    node "SMTP" as SMTP
    node "Payment Gateway" as Payment
    node "Webhooks" as Webhooks
}

' ─────────────────────── CONEXIONES ───────────────────────

Browser --> OWL
Browser --> Static
OWL --> Router
Router --> Controllers : dispatch (Pipe-Filter)
Router --> Views : selecciona vista (MVC-Vista)
Controllers --> Models : invoca (MVC-Controlador)
JSONRPC <-- Controllers
XMLRPC <-- Models
Models --> ORM : queries (Repository)
Models --> Computed : logica (Event-Driven)
ORM --> DB : SQL
ORM --> Filestore
Models --> SMTP : envia emails (Event-Driven)
Models --> Payment : cobros
Models --> Webhooks : notifica

AddonSale --> Models
AddonAccount --> Models
AddonStock --> Models
AddonProduct --> Models

legend right
Proyecto: SAP-TFI-2026
Agente: saptfi2026
Estilos aplicados: 8 estilos GoF/Arquitectura

Cliente-Servidor: browser <-> server
3-Tier: Cliente | Aplicacion | Datos
MVC: Vista (XML/OWL) | Controlador (HTTP) | Modelo (ORM)
Capas: Presentacion | Web | Logic | Addons
Pipe-and-Filter: HTTP request pipeline
Microkernel: addons via _inherit
Repository: ORM Odoo encapsula BD
Event-Driven: mail.thread, onchange, cron
endlegend

@enduml