# hirenst/partner-contact architecture

> Architecture diagram of the GitHub repository hirenst/partner-contact, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-07-06). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/hirenst/partner-contact
- Repository: https://github.com/hirenst/partner-contact

## Overview

##### Project type and purpose
- This repository is a collection of Odoo “addons” (modules) under the “partner-contact” umbrella. Each module extends Odoo’s core partner/contact models, views, wizards, security rules, etc., to add new fields, constraints, cron jobs, UI improvements, or import routines.
- Purpose: Provide a suite of pluggable features for managing partner and contact data in an Odoo ERP instance (e.g., gender, birthdate, multi-relation, geonames import, deduplication, rank updates, labels, etc.).

##### File structure
- Top-level folders and files:
- .github, .pre-commit, lint, CI configs ⟶ development tooling
- README.md, LICENSE, requirements.txt
- A directory per addon-module (e.g. partner_address_split/, partner_external_map/, partner_multi_relation/, …).
- A `setup/` folder replicating module packaging for pip/odoo-make.
- Inside each module:
- __manifest__.py ⟶ module metadata (name, version, dependencies, license).
- models/ ⟶ Python ORM classes extending models.res_partner, models.res_company, etc.
- views/ ⟶ XML definitions (form, tree, menu, wizards).
- data/ (optional) ⟶ demo or initial data.
- wizard/, security/, reports/, tests/, i18n/, static/description ⟶ typical Odoo substructures.
- Architectural pattern:
- MVC-like: Models (Python ORM) ↔ Views (XML + JS) → Controllers (Odoo HTTP routing)
- Plugin architecture: Odoo core loads all addons, merges their models/views/security into one running app.

##### README for additional insights
- Dependencies are implied by __manifest__.py; no external microservices except Geonames import (base_location_geonames_import).

##### Main components
a. Odoo Application Server
– Core framework: HTTP/JSON-RPC controllers, ORM, Scheduler (cron), QWeb reports
b. PostgreSQL Database
– Partner/contact tables extended by addon-models
c. Web Client (browser)
– XML/JS assets delivered by server
d. External services
– Geonames API (for base_location_geonames_import)
– Optional email validation service (partner_email_check)
– Maps services (Google Maps, OSM, Bing via partner_external_map)

##### Relationships and interactions
- Web Client ⇄ Odoo Server via HTTP / JSON-RPC
- Server ⇄ DB via ORM
- Modules hook via:
- Inheritance of core models (res_partner, res_company…)
- XML view extension/injection
- Cron jobs (e.g. partner_auto_archive, partner_contact_age_range)
- Wizards (pop-up workflows)
- Security rules (ir.model.access.csv, security.xml)
- Data import routines (base_location_geonames_import/data)
- Report templates (partner_label)
- External API calls initiated by specific modules (e.g. geonames, email validation, map URLs).

##### Architectural patterns and principles
- Plugin / modular architecture: each feature is its own module, loosely coupled to core via Odoo’s extension points.
- MVC:
- Models: Python files under models/
- Views: XML under views/ (plus static assets)
- Controllers: generic Odoo controllers, plus wizards under wizard/
- Cron / Scheduler: server-side periodic tasks
- Security layers: access control CSV, record rules in security/
- Internationalization: i18n/ folders for translations

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Actors
    Browser["Web Client (Browser)"]:::external
    Browser -->|"HTTP/JSON-RPC"| OdooServer

    %% Odoo Server with Core and Plugins
    subgraph "Odoo Server"
        direction TB
        OdooServerCore["Core Framework\n(ORM, HTTP, Scheduler, QWeb)"]:::core
        PluginLoader["Plugin Loader"]:::core

        %% Add-on Modules
        subgraph "Partner Data Enrichment" 
            direction TB
            subgraph "Partner Birthdate Feature" 
                direction TB
                PB_manifest["__manifest__.py"]:::docs
                PB_model["res_partner.py"]:::mvc-model
                PB_view["res_partner.xml"]:::mvc-view
            end
            subgraph "Geonames Import" 
                direction TB
                GM_manifest["__manifest__.py"]:::docs
                GM_model["res_country.py"]:::mvc-model
                GM_wizard["geonames_import.py"]:::mvc-view
            end
            subgraph "Email Validation Service" 
                direction TB
                EV_manifest["__manifest__.py"]:::docs
                EV_model["res_partner.py"]:::mvc-model
                EV_view["base_config_view.xml"]:::mvc-view
            end
            subgraph "External Maps Integration" 
                direction TB
                EM_manifest["__manifest__.py"]:::docs
                EM_model["map_website.py"]:::mvc-model
                EM_view["map_website_view.xml"]:::mvc-view
            end
        end

        subgraph "Partner Automation & Maintenance"
            direction TB
            subgraph "Auto-Archive Cron Job"
                direction TB
                AA_manifest["__manifest__.py"]:::docs
                AA_model["res_partner.py"]:::mvc-model
                AA_data["ir_cron.xml"]:::security
            end
            subgraph "Deduplication & Security"
                direction TB
                D_manifest["__manifest__.py"]:::docs
                D_wizard["partner_merge.py"]:::mvc-view
                D_security["partner_deduplicate_acl_security.xml"]:::security
            end
        end

        OdooServerCore --> PluginLoader
        PluginLoader --> PB_manifest
        PluginLoader --> GM_manifest
        PluginLoader --> EV_manifest
        PluginLoader --> EM_manifest
        PluginLoader --> AA_manifest
        PluginLoader --> D_manifest
    end

    %% Database
    OdooServer -->|"ORM"| PostgreSQL
    PostgreSQL["PostgreSQL Database"]:::db

    %% External Services
    subgraph "External Services"
        direction TB
        Geonames["Geonames API"]:::external
        MapService["Map Providers\n(Google, OSM, Bing)"]:::external
        EmailValidator["Email Validator Service"]:::external
    end

    GM_wizard -->|Fetch locations| Geonames
    EM_model -->|Map URLs| MapService
    EV_model -->|Validate emails| EmailValidator

    %% Click Events
    click OdooServer "https://github.com/hirenst/partner-contact/blob/16.0/requirements.txt"
    click PB_manifest "https://github.com/hirenst/partner-contact/blob/16.0/partner_contact_birthdate/__manifest__.py"
    click PB_model "https://github.com/hirenst/partner-contact/blob/16.0/partner_contact_birthdate/models/res_partner.py"
    click PB_view "https://github.com/hirenst/partner-contact/blob/16.0/partner_contact_birthdate/views/res_partner.xml"
    click GM_manifest "https://github.com/hirenst/partner-contact/blob/16.0/base_location_geonames_import/__manifest__.py"
    click GM_model "https://github.com/hirenst/partner-contact/blob/16.0/base_location_geonames_import/models/res_country.py"
    click GM_wizard "https://github.com/hirenst/partner-contact/blob/16.0/base_location_geonames_import/wizard/geonames_import.py"
    click EV_manifest "https://github.com/hirenst/partner-contact/blob/16.0/partner_email_check/__manifest__.py"
    click EV_model "https://github.com/hirenst/partner-contact/blob/16.0/partner_email_check/models/res_partner.py"
    click EV_view "https://github.com/hirenst/partner-contact/blob/16.0/partner_email_check/views/base_config_view.xml"
    click EM_manifest "https://github.com/hirenst/partner-contact/blob/16.0/partner_external_map/__manifest__.py"
    click EM_model "https://github.com/hirenst/partner-contact/blob/16.0/partner_external_map/models/map_website.py"
    click EM_view "https://github.com/hirenst/partner-contact/blob/16.0/partner_external_map/views/map_website_view.xml"
    click AA_manifest "https://github.com/hirenst/partner-contact/blob/16.0/partner_auto_archive/__manifest__.py"
    click AA_model "https://github.com/hirenst/partner-contact/blob/16.0/partner_auto_archive/models/res_partner.py"
    click AA_data "https://github.com/hirenst/partner-contact/blob/16.0/partner_auto_archive/data/ir_cron.xml"
    click D_manifest "https://github.com/hirenst/partner-contact/blob/16.0/partner_deduplicate_acl/__manifest__.py"
    click D_wizard "https://github.com/hirenst/partner-contact/blob/16.0/partner_deduplicate_acl/wizards/partner_merge.py"
    click D_security "https://github.com/hirenst/partner-contact/blob/16.0/partner_deduplicate_acl/security/partner_deduplicate_acl_security.xml"

    %% Styles
    classDef core fill:#FFD700,stroke:#333,stroke-width:1px
    classDef plugin fill:#87CEFA,stroke:#333,stroke-width:1px
    classDef external fill:#90EE90,stroke:#333,stroke-width:1px
    classDef db fill:#FFB6C1,stroke:#333,stroke-width:1px
    classDef mvc-model fill:#E6E6FA,stroke:#333,stroke-width:1px
    classDef mvc-view fill:#FFFACD,stroke:#333,stroke-width:1px
    classDef security fill:#FFA07A,stroke:#333,stroke-width:1px
    classDef docs fill:#E0FFFF,stroke:#333,stroke-width:1px
```
