# abgrxenda/rental_management architecture

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

- Interactive diagram: https://gitdiagram.com/abgrxenda/rental_management
- Repository: https://github.com/abgrxenda/rental_management

## Overview

##### Project Type and Purpose
- This is an Odoo 18 module (“rental_management”) that extends the Odoo full-stack ERP.
- Purpose: Provide a rental management system with equipment tracking, QR code generation/scanning, lifecycle workflows (draft→reserved→ongoing→returned→invoiced), and reporting.

##### File Structure
- Top-level directories:
- models/           ← business objects & ORM logic (equipment, serials, projects, statuses, QR generator, settings)
- controllers/      ← HTTP endpoints (e.g., QR scanner API)
- views/            ← XML form/list/kanban/menu definitions
- wizards/          ← transient models & flows for bulk serials, return wizards, confirmation dialogs
- reports/          ← QWeb/XML templates for PDF/label output
- static/           ← front-end assets (JS, CSS, html, jsQR library)
- data/             ← default records (sequences, sample data)
- security/         ← access control lists & record rules
- Configuration files (__manifest__.py, filemap.md) declare dependencies (base, web, stock, account…) and load order.

##### README for Additional Insights
- Confirms tech stack: Python ORM, qrcode + Pillow for server-side QR, jsQR for client scanning.
- Describes major workflows (equipment setup, project creation, reserve/start/return/invoice).
- Lists models & their roles, dependencies, security groups, multi-company support.

##### Main Components
a. Odoo Application Server
- Core Odoo framework (ORM, web controllers, QWeb engine)
- rental_management module sub-components
b. PostgreSQL Database
- Tables for rental.equipment, rental.equipment.serial, rental.project, etc.
- ir.sequence, ir.model.access, other metadata
c. Web Client (Browser)
- QWeb views loaded via HTTP
- JavaScript assets: qr_scanner.js + jsQR for mobile scanning
d. External Libraries & Services
- Python qrcode + Pillow (server QR generation)
- Static jsQR library (client-side decoding)
e. Third-party Odoo Modules
- base, web, stock, account, sale_management, contacts

##### Relationships and Data Flows
- Browser ←→ Odoo HTTP/WebSocket: UI interactions (form submissions, Kanban drag-drop)
- Odoo Server → PostgreSQL: CRUD via ORM
- Odoo Server → qrcode/Pillow: Generate PNGs for serial QR codes
- Browser → Static/jsQR: Scan camera feed, decode QR, then send scanned code back to Odoo controller
- Wizards and controllers orchestrate multi-step flows (reserve, return, bulk serial gen)

##### Architectural Patterns & Principles
- MVC / ORM pattern (Models = data layer, Views = XML/QWeb, Controllers = web endpoints)
- TransientModel pattern for wizards (stateless, per-user flows)
- QWeb templates for reporting and printing
- Modular design adhering to Odoo “addon” structure

##### Final Advice
- Be exhaustive: represent all six key folders (models, views, controllers, wizards, reports, static).
- Data flows at each rental lifecycle step (create project → reserve → start → return → invoice).
- Don’t omit security: show ir.model.access and group checks regulating access.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Deployment Components
    UI["Browser UI"]:::deploy
    Core["Odoo Core\n(ORM, Controllers, QWeb)"]:::deploy
    Database["PostgreSQL DB"]:::deploy
    ExternalQR["qrcode + Pillow\n(Server)"]:::external

    %% Browser Cluster
    subgraph Browser
        UI
        JSassets["Static Assets Loaded"]:::subsystem
        jsQR["jsQR (client)"]:::external
    end

    %% Odoo Server Cluster
    subgraph Odoo_Server
        Core
        subgraph "rental_management Module"
            manifest["__manifest__.py"]:::subsystem

            subgraph Models
                eq["rental_equipment.py"]
                eqs["rental_equipment_serial.py"]
                eqc["rental_equipment_category.py"]
                rp["rental_project.py"]
                rpi["rental_project_item.py"]
                rpis["rental_project_item_status.py"]
                log["rental_scan_log.py"]
                qrgen["qr_generator.py"]
                sqm["serial_qr_model.py"]
                rcs["res_config_settings.py"]
                cqe["company_qr_extension.py"]
            end

            subgraph Controllers
                mainpy["main.py"]
            end

            subgraph Wizards
                bsw["bulk_serial_wizard.py"]
                rrw["rental_return_wizard.py"]
                sdcw["serial_delete_confirm_wizard.py"]
                ssw["serial_selection_wizard.py"]
            end

            subgraph Views
                menus["rental_menus.xml"]
                ev["rental_equipment_views.xml"]
                esv["rental_equipment_serial_views.xml"]
                ecv["rental_equipment_category_views.xml"]
                prv["rental_project_views.xml"]
                piv["rental_project_item_views.xml"]
                qsv["qr_scanner_views.xml"]
                rcsv["res_config_settings_views.xml"]
            end

            subgraph Reports
                rr["rental_reports.xml"]
                qrl["qr_label_report.xml"]
            end

            subgraph Static
                qrjs["qr_scanner.js"]
                jsqrlib["jsQR.js"]
                css["qr_scanner_css.css"]
                xmlt["qr_scanner_template.xml"]
                desc["index.html"]
            end

            subgraph Data
                rd["rental_data.xml"]
                rs["rental_sequence.xml"]
            end

            subgraph Security
                acls["ir.model.access.csv"]
                rules["rental_security.xml"]
            end
        end
    end

    %% Documentation
    subgraph Documentation
        readme["README.md"]:::subsystem
        filemap["filemap.md"]:::subsystem
    end

    %% Relationships
    UI -->|HTTP/WebSocket| Core
    UI -->|Load Assets| JSassets
    JSassets -->|Includes qr_scanner.js| qrjs
    JSassets -->|Includes jsQR| jsqrlib
    UI -->|Camera Feed| jsQR
    jsQR -->|POST scan code| mainpy
    Core -->|CRUD via ORM| Database
    Core -->|Generate QR| ExternalQR
    mainpy -->|calls| Models
    mainpy -->|orchestrates| Wizards
    mainpy -->|renders| Reports
    mainpy -->|serves| Views
    Reports -->|via QWeb| Core

    %% Click Events
    click manifest "https://github.com/abgrxenda/rental_management/blob/main/__manifest__.py"
    click acls "https://github.com/abgrxenda/rental_management/blob/main/security/ir.model.access.csv"
    click rules "https://github.com/abgrxenda/rental_management/blob/main/security/rental_security.xml"
    click rd "https://github.com/abgrxenda/rental_management/blob/main/data/rental_data.xml"
    click rs "https://github.com/abgrxenda/rental_management/blob/main/data/rental_sequence.xml"
    click eq "https://github.com/abgrxenda/rental_management/blob/main/models/rental_equipment.py"
    click eqs "https://github.com/abgrxenda/rental_management/blob/main/models/rental_equipment_serial.py"
    click eqc "https://github.com/abgrxenda/rental_management/blob/main/models/rental_equipment_category.py"
    click rp "https://github.com/abgrxenda/rental_management/blob/main/models/rental_project.py"
    click rpi "https://github.com/abgrxenda/rental_management/blob/main/models/rental_project_item.py"
    click rpis "https://github.com/abgrxenda/rental_management/blob/main/models/rental_project_item_status.py"
    click log "https://github.com/abgrxenda/rental_management/blob/main/models/rental_scan_log.py"
    click qrgen "https://github.com/abgrxenda/rental_management/blob/main/models/qr_generator.py"
    click sqm "https://github.com/abgrxenda/rental_management/blob/main/models/serial_qr_model.py"
    click rcs "https://github.com/abgrxenda/rental_management/blob/main/models/res_config_settings.py"
    click cqe "https://github.com/abgrxenda/rental_management/blob/main/models/company_qr_extension.py"
    click mainpy "https://github.com/abgrxenda/rental_management/blob/main/controllers/main.py"
    click bsw "https://github.com/abgrxenda/rental_management/blob/main/wizards/bulk_serial_wizard.py"
    click rrw "https://github.com/abgrxenda/rental_management/blob/main/wizards/rental_return_wizard.py"
    click sdcw "https://github.com/abgrxenda/rental_management/blob/main/wizards/serial_delete_confirm_wizard.py"
    click ssw "https://github.com/abgrxenda/rental_management/blob/main/wizards/serial_selection_wizard.py"
    click menus "https://github.com/abgrxenda/rental_management/blob/main/views/rental_menus.xml"
    click ev "https://github.com/abgrxenda/rental_management/blob/main/views/rental_equipment_views.xml"
    click esv "https://github.com/abgrxenda/rental_management/blob/main/views/rental_equipment_serial_views.xml"
    click ecv "https://github.com/abgrxenda/rental_management/blob/main/views/rental_equipment_category_views.xml"
    click prv "https://github.com/abgrxenda/rental_management/blob/main/views/rental_project_views.xml"
    click piv "https://github.com/abgrxenda/rental_management/blob/main/views/rental_project_item_views.xml"
    click qsv "https://github.com/abgrxenda/rental_management/blob/main/views/qr_scanner_views.xml"
    click rcsv "https://github.com/abgrxenda/rental_management/blob/main/views/res_config_settings_views.xml"
    click rr "https://github.com/abgrxenda/rental_management/blob/main/reports/rental_reports.xml"
    click qrl "https://github.com/abgrxenda/rental_management/blob/main/reports/qr_label_report.xml"
    click qrjs "https://github.com/abgrxenda/rental_management/blob/main/static/src/js/qr_scanner.js"
    click jsqrlib "https://github.com/abgrxenda/rental_management/blob/main/static/lib/jsQR/jsQR.js"
    click css "https://github.com/abgrxenda/rental_management/blob/main/static/src/css/qr_scanner_css.css"
    click xmlt "https://github.com/abgrxenda/rental_management/blob/main/static/src/xml/qr_scanner_template.xml"
    click desc "https://github.com/abgrxenda/rental_management/blob/main/static/description/index.html"
    click readme "https://github.com/abgrxenda/rental_management/blob/main/README.md"
    click filemap "https://github.com/abgrxenda/rental_management/blob/main/filemap.md"

    %% Styles
    classDef deploy fill:#D0E8FF,stroke:#0366d6,color:#000
    classDef subsystem fill:#E0FFE0,stroke:#228B22,color:#000
    classDef external fill:#F0F0F0,stroke:#888,color:#000
```
