← Back to Pull requests

odooindex_connector: split into core, CLI and Odoo UI #7

Closed
unknown closed this pull request without merging on Sep 01, 2026 08:10 UTC
View on GitHub
unknown unknown commented on Sep 01, 2026 06:13 UTC
Author

Summary

This PR reorganizes odooindex_connector into three layers and exposes a single, pipx-installable command-line tool called clox:

1. odooindex_connector/core/ – pure-Python HTTP client, inventory builder, chunked upload, download and pairing helpers (no Odoo imports).
2. odooindex_connector/clox.py + __main__.py and the root pyproject.toml – a standalone clox entry point that does not require the odoo Python package. It parses the Odoo configuration file and connects directly to PostgreSQL with psycopg/psycopg2, reads ir.config_parameter and ir.module.module over SQL, and writes the pairing token back with an UPSERT.
3. odooindex_connector/models/ir_module_module.py and wizards/odooindex_connector_pair_wizard.py – thin Odoo wrappers around the same core service classes.

clox has no subcommands. It detects the required work automatically:

  • read config from the Odoo config file (-c / ODOO_RC) and DB name (-d / ODOO_DATABASE);

  • ensure an odooindex_connector.api_token exists (pair with OdooIndex when missing, prompting for the PIN);

  • upload the installed module inventory;

  • download readiness updates and print a migration report.
  • Install with pipx and run:

    pipx install git+https://github.com/OdooEssentials/odooindex-connector.git
    clox -c /my/config -d mydb
    clox -c /my/config -d mydb --target-version 19.0 --json
    

    Supported environment variables:

  • ODOO_RC – Odoo configuration file

  • ODOO_DATABASE – Odoo database name

  • ODOOINDEX_API_TOKEN – existing OdooIndex API token

  • ODOOINDEX_TARGET_VERSION – target Odoo version

  • ODOOINDEX_INSTANCE_NAME – display name for this instance

  • ODOOINDEX_BASE_URL – OdooIndex API base URL
  • Notes

  • ruff check ., pylint --rcfile=.pylintrc-mandatory odooindex_connector, and pylint --rcfile=.pylintrc odooindex_connector all pass.

  • The pre-commit hook could not be exercised end-to-end because .pre-commit-config.yaml pins default_language_version: python3.12, while the environment provides Python 3.11.

  • Pairing prompts and informational messages are written to stderr so --json output on stdout remains valid JSON.

  • Non-local plain-HTTP base URLs are rejected to avoid exposing the bearer token or inventory data.

  • A wheel built from the new root pyproject.toml contains the clox = odooindex_connector.clox:main console script.

  • The Sync Now button in Settings now force-reloads ir.config_parameter (via self.env.registry.clear_cache("default")) before syncing, so values written outside the ORM (e.g., by the clox CLI) are picked up immediately.
  • Assisted-by: Devin

    Link to Devin session: https://app.devin.ai/sessions/4cb03762550148e88bacf9ee4bf4e849
    Open in Devin Desktop: https://app.devin.ai/desktop/session/4cb03762550148e88bacf9ee4bf4e849?variant=devin
    Requested by: @dreispt

    Diff: 357 lines (+267 / -90) across 4 files Reviewer: dreispt Review duration: 117m
    All Vouch review confidence checks passed
    Residual risk 0.17 = Change Risk (0.43) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.43 · 357 lines diff across 4 files
    0.43
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    60%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.352
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #7"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 60.5% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 42.6% (MEDIUM) · Higher = larger blast radius
    42.6%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 60.5% · Lower = rushed or shallow review
    60.5%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 16.8% · Safe to merge
    16.8%