# oca/l10n-spain architecture

> Architecture diagram of the GitHub repository oca/l10n-spain, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-04-01). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/oca/l10n-spain
- Repository: https://github.com/oca/l10n-spain

## Overview

##### Overall project context
- Project Type & Purpose: This is an ecosystem of Odoo add-ons providing Spanish-specific functionality for accounting, taxation (AEAT, various tax forms like models 111, 115, 303, 347, etc.), payment integrations (e.g., Redsys, Sabadell confirming), delivery carriers, translation/localization (e.g., Facturae, IGIC), and more.
- It is built on top of the Odoo framework (an MVC-type ERP system in Python), so while the repository contains hundreds of modules, they are all “plugins” that integrate with Odoo’s underlying ORM, business logic, and web client.

##### File structure
- At a high level, each directory (such as “delivery_dhl_parcel”, “l10n_es_aeat”, “payment_redsys”, etc.) is a self-contained module.
- Each module typically has the standard Odoo directory structure: a manifest file (__manifest__.py), models, views, wizards, data, security, tests, and static files.
- Some modules include API integrations (e.g., using web services), others include reporting (XML reports), while still others handle translation and localization.
- There are shared “setup” and configuration files at the root (pre-commit configs, .editorconfig, etc.), which support the development and integration process but are not part of the runtime architecture.

##### Main components and relationships
- Odoo Core: At the center, an Odoo server that provides the execution environment for business objects (ORM, business logic, workflows, etc.), along with the PostgreSQL database.
- -on Modules: Each module is plugged into the Odoo framework. Group them by function:
– Localization Modules (l10n_es_aeat, l10n_es_account_asset, l10n_es_partner, l10n_es_facturae, etc.)
– Tax & Regulatory Modules (modules for different AEAT models, VAT Book, Intrastat reporting)
– Payment Modules (payment_redsys, l10n_es_payment_order_confirming_sabadell, etc.)
– Delivery & Logistics Integrations (delivery_dhl_parcel, delivery_gls_asm, delivery_seur_atlas)
– Supporting/Utility Modules (l10n_es_toponyms, l10n_es_cnae)

##### Architectural patterns and design principles to be highlighted
- Modular Architecture: Emphasize that each add-on acts as a plug-in with common interface points (manifest metadata, model inheritance, view modifications).
- MVC / ORM Patterns: Odoo itself follows an MVC or “Odoo-style” pattern. Models (Python classes), Views (XML layouts), and Controllers/Wizards (Python or XML-driven workflows) are subdivided per module.
- Separation of Concerns: Each module is focused on a specific localization or functionality area, which aids maintainability and reusability.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Core Components
    subgraph "Odoo Core"
        Core["Odoo Core"]:::core
        ORM["ORM Engine"]:::core
        BL["Business Logic Engine"]:::core
        WS["Web Server (HTTP Controllers)"]:::core
        DB["PostgreSQL Database"]:::database
    end

    %% External Services
    ExternalFacturae["External Facturae API"]:::external
    ExternalDelivery["External Delivery API"]:::external

    %% Localization Modules
    subgraph "Localization Modules"
        l10n_es_aeat["l10n_es_aeat"]:::localization
        l10n_es_account_asset["l10n_es_account_asset"]:::localization
        l10n_es_partner["l10n_es_partner"]:::localization
        l10n_es_facturae["l10n_es_facturae"]:::localization
        l10n_es_igic["l10n_es_igic"]:::localization
        l10n_es_toponyms["l10n_es_toponyms"]:::localization
    end

    %% Tax & Regulatory Modules
    subgraph "Tax & Regulatory Modules"
        l10n_es_aeat_mod111["l10n_es_aeat_mod111"]:::tax
        l10n_es_aeat_mod115["l10n_es_aeat_mod115"]:::tax
        l10n_es_aeat_mod123["l10n_es_aeat_mod123"]:::tax
        l10n_es_aeat_mod130["l10n_es_aeat_mod130"]:::tax
        l10n_es_aeat_mod190["l10n_es_aeat_mod190"]:::tax
        l10n_es_aeat_mod303["l10n_es_aeat_mod303"]:::tax
        l10n_es_aeat_mod347["l10n_es_aeat_mod347"]:::tax
        l10n_es_aeat_mod349["l10n_es_aeat_mod349"]:::tax
        l10n_es_aeat_mod390["l10n_es_aeat_mod390"]:::tax
        l10n_es_aeat_mod592["l10n_es_aeat_mod592"]:::tax
        l10n_es_vat_book["l10n_es_vat_book"]:::tax
        l10n_es_vat_book_oss["l10n_es_vat_book_oss"]:::tax
        l10n_es_vat_prorate["l10n_es_vat_prorate"]:::tax
    end

    %% Payment Integrations
    subgraph "Payment Integrations"
        payment_redsys["payment_redsys"]:::payments
        l10n_es_payment_order_confirming_aef["l10n_es_payment_order_confirming_aef"]:::payments
        l10n_es_payment_order_confirming_sabadell["l10n_es_payment_order_confirming_sabadell"]:::payments
    end

    %% Delivery & Logistics Integrations
    subgraph "Delivery & Logistics"
        delivery_dhl_parcel["delivery_dhl_parcel"]:::delivery
        delivery_gls_asm["delivery_gls_asm"]:::delivery
        delivery_seur_atlas["delivery_seur_atlas"]:::delivery
    end

    %% Supporting / Utility & Regional Modules
    subgraph "Supporting & Utility / Regional Modules"
        l10n_ca_es_cnae["l10n_ca_es_cnae"]:::support
        l10n_es_cnae["l10n_es_cnae"]:::support
        l10n_es_intrastat_report["l10n_es_intrastat_report"]:::support
        l10n_es_location_nuts["l10n_es_location_nuts"]:::support
        l10n_es_mis_report["l10n_es_mis_report"]:::support
        l10n_es_partner_mercantil["l10n_es_partner_mercantil"]:::support
        l10n_es_reav["l10n_es_reav"]:::support
        l10n_es_pos_oca["l10n_es_pos_oca"]:::support
        l10n_es_aeat_sii_oca["l10n_es_aeat_sii_oca"]:::support
        l10n_es_aeat_sii_oss["l10n_es_aeat_sii_oss"]:::support
    end

    %% Connections from Modules to Odoo Core
    l10n_es_aeat -->|"hooks"| Core
    l10n_es_account_asset -->|"hooks"| Core
    l10n_es_partner -->|"hooks"| Core
    l10n_es_facturae -->|"hooks"| Core
    l10n_es_igic -->|"hooks"| Core
    l10n_es_toponyms -->|"hooks"| Core

    l10n_es_aeat_mod111 -->|"hooks"| Core
    l10n_es_aeat_mod115 -->|"hooks"| Core
    l10n_es_aeat_mod123 -->|"hooks"| Core
    l10n_es_aeat_mod130 -->|"hooks"| Core
    l10n_es_aeat_mod190 -->|"hooks"| Core
    l10n_es_aeat_mod303 -->|"hooks"| Core
    l10n_es_aeat_mod347 -->|"hooks"| Core
    l10n_es_aeat_mod349 -->|"hooks"| Core
    l10n_es_aeat_mod390 -->|"hooks"| Core
    l10n_es_aeat_mod592 -->|"hooks"| Core
    l10n_es_vat_book -->|"hooks"| Core
    l10n_es_vat_book_oss -->|"hooks"| Core
    l10n_es_vat_prorate -->|"hooks"| Core

    payment_redsys -->|"hooks"| Core
    l10n_es_payment_order_confirming_aef -->|"hooks"| Core
    l10n_es_payment_order_confirming_sabadell -->|"hooks"| Core

    delivery_dhl_parcel -->|"hooks"| Core
    delivery_gls_asm -->|"hooks"| Core
    delivery_seur_atlas -->|"hooks"| Core

    l10n_ca_es_cnae -->|"hooks"| Core
    l10n_es_cnae -->|"hooks"| Core
    l10n_es_intrastat_report -->|"hooks"| Core
    l10n_es_location_nuts -->|"hooks"| Core
    l10n_es_mis_report -->|"hooks"| Core
    l10n_es_partner_mercantil -->|"extends"| l10n_es_partner
    l10n_es_partner_mercantil -->|"hooks"| Core
    l10n_es_reav -->|"hooks"| Core
    l10n_es_pos_oca -->|"hooks"| Core
    l10n_es_aeat_sii_oca -->|"hooks"| Core
    l10n_es_aeat_sii_oss -->|"hooks"| Core

    %% External Integrations
    l10n_es_facturae -->|"calls"| ExternalFacturae
    delivery_dhl_parcel -->|"calls"| ExternalDelivery
    delivery_gls_asm -->|"calls"| ExternalDelivery
    delivery_seur_atlas -->|"calls"| ExternalDelivery

    %% Click Events for Localization Modules
    click l10n_es_aeat "https://github.com/oca/l10n-spain/tree/17.0/l10n_es_aeat/"
    click l10n_es_account_asset "https://github.com/oca/l10n-spain/tree/17.0/l10n_es_account_asset/"
    click l10n_es_partner "https://github.com/oca/l10n-spain/tree/17.0/l10n_es_partner/"
    click l10n_es_facturae "https://github.com/oca/l10n-spain/tree/17.0/l10n_es_facturae/"
    click l10n_es_igic "https://github.com/oca/l10n-spain/tree/17.0/l10n_es_igic/"
    click l10n_es_toponyms "https://github.com/oca/l10n-spain/tree/17.0/l10n_es_toponyms/"

    %% Click Events for Tax & Regulatory Modules
    click l10n_es_aeat_mod111 "https://github.com/oca/l10n-spain/tree/17.0/l10n_es_aeat_mod111/"
    click l10n_es_aeat_mod115 "https://github.com/oca/l10n-spain/tree/17.0/l10n_es_aeat_mod115/"
    click l10n_es_aeat_mod123 "https://github.com/oca/l10n-spain/tree/17.0/l10n_es_aeat_mod123/"
    click l10n_es_aeat_mod130 "https://github.com/oca/l10n-spain/tree/17.0/l10n_es_aeat_mod130/"
    click l10n_es_aeat_mod190 "https://github.com/oca/l10n-spain/tree/17.0/l10n_es_aeat_mod190/"
    click l10n_es_aeat_mod303 "https://github.com/oca/l10n-spain/tree/17.0/l10n_es_aeat_mod303/"
    click l10n_es_aeat_mod347 "https://github.com/oca/l10n-spain/tree/17.0/l10n_es_aeat_mod347/"
    click l10n_es_aeat_mod349 "https://github.com/oca/l10n-spain/tree/17.0/l10n_es_aeat_mod349/"
    click l10n_es_aeat_mod390 "https://github.com/oca/l10n-spain/tree/17.0/l10n_es_aeat_mod390/"
    click l10n_es_aeat_mod592 "https://github.com/oca/l10n-spain/tree/17.0/l10n_es_aeat_mod592/"
    click l10n_es_vat_book "https://github.com/oca/l10n-spain/tree/17.0/l10n_es_vat_book/"
    click l10n_es_vat_book_oss "https://github.com/oca/l10n-spain/tree/17.0/l10n_es_vat_book_oss/"
    click l10n_es_vat_prorate "https://github.com/oca/l10n-spain/tree/17.0/l10n_es_vat_prorate/"

    %% Click Events for Payment Integrations
    click payment_redsys "https://github.com/oca/l10n-spain/tree/17.0/payment_redsys/"
    click l10n_es_payment_order_confirming_aef "https://github.com/oca/l10n-spain/tree/17.0/l10n_es_payment_order_confirming_aef/"
    click l10n_es_payment_order_confirming_sabadell "https://github.com/oca/l10n-spain/tree/17.0/l10n_es_payment_order_confirming_sabadell/"

    %% Click Events for Delivery & Logistics
    click delivery_dhl_parcel "https://github.com/oca/l10n-spain/tree/17.0/delivery_dhl_parcel/"
    click delivery_gls_asm "https://github.com/oca/l10n-spain/tree/17.0/delivery_gls_asm/"
    click delivery_seur_atlas "https://github.com/oca/l10n-spain/tree/17.0/delivery_seur_atlas/"

    %% Click Events for Supporting / Utility Modules
    click l10n_ca_es_cnae "https://github.com/oca/l10n-spain/tree/17.0/l10n_ca_es_cnae/"
    click l10n_es_cnae "https://github.com/oca/l10n-spain/tree/17.0/l10n_es_cnae/"
    click l10n_es_intrastat_report "https://github.com/oca/l10n-spain/tree/17.0/l10n_es_intrastat_report/"
    click l10n_es_location_nuts "https://github.com/oca/l10n-spain/tree/17.0/l10n_es_location_nuts/"
    click l10n_es_mis_report "https://github.com/oca/l10n-spain/tree/17.0/l10n_es_mis_report/"
    click l10n_es_partner_mercantil "https://github.com/oca/l10n-spain/tree/17.0/l10n_es_partner_mercantil/"
    click l10n_es_reav "https://github.com/oca/l10n-spain/tree/17.0/l10n_es_reav/"
    click l10n_es_pos_oca "https://github.com/oca/l10n-spain/tree/17.0/l10n_es_pos_oca/"
    click l10n_es_aeat_sii_oca "https://github.com/oca/l10n-spain/tree/17.0/l10n_es_aeat_sii_oca/"
    click l10n_es_aeat_sii_oss "https://github.com/oca/l10n-spain/tree/17.0/l10n_es_aeat_sii_oss/"

    %% Class Styles
    classDef core fill:#ffcc00,stroke:#333,stroke-width:2px;
    classDef database fill:#ff9999,stroke:#333,stroke-width:2px;
    classDef localization fill:#99ccff,stroke:#333,stroke-width:2px;
    classDef tax fill:#99ff99,stroke:#333,stroke-width:2px;
    classDef payments fill:#ffcc99,stroke:#333,stroke-width:2px;
    classDef delivery fill:#ccffcc,stroke:#333,stroke-width:2px;
    classDef support fill:#ff99ff,stroke:#333,stroke-width:2px;
    classDef external fill:#e6e6e6,stroke:#333,stroke-width:2px;
```
