Skip to content

feat: add --project-dir option to create command#12

Merged
trisdoan merged 3 commits intotrobz:mainfrom
hailangvn:project_dir
Feb 26, 2026
Merged

feat: add --project-dir option to create command#12
trisdoan merged 3 commits intotrobz:mainfrom
hailangvn:project_dir

Conversation

@hailangvn
Copy link
Copy Markdown
Collaborator

Summary

  • Adds --project-dir option that uses odoo-addons-path to auto-detect --addons-path, --odoo-dir, and --preset=project
  • Makes ODOO_VERSION optional when --project-dir is used — inferred from odoo/release.py
  • Adds odoo-addons-path as a dependency

Usage

# Before: all parameters manual
odoo-venv create 18.0 --preset project --odoo-dir /path/to/project/odoo --addons-path "..."

# After: single flag does it all
odoo-venv create --project-dir /path/to/project

Test plan

  • odoo-venv create --project-dir /path/to/project --dry-run — auto-detects everything
  • odoo-venv create 18.0 --project-dir /path --dry-run — explicit version takes precedence
  • odoo-venv create --preset local --project-dir /path --dry-run — explicit preset takes precedence
  • odoo-venv create --dry-run — errors with clear message about missing ODOO_VERSION
  • odoo-venv create 18.0 --dry-run — existing behavior unchanged

🤖 Generated with Claude Code

@nilshamerlinck
Copy link
Copy Markdown
Contributor

waiting for trobz/odoo-addons-path#7

…sion

Uses odoo-addons-path to detect codebase layout and infer --addons-path,
--odoo-dir, --python-version, and --preset=project from a project directory.
ODOO_VERSION becomes optional when --project-dir is provided, as it is
read from odoo/release.py.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@hailangvn hailangvn marked this pull request as ready for review February 25, 2026 08:55
@trisdoan
Copy link
Copy Markdown
Collaborator

trisdoan commented Feb 26, 2026

Hi anh @hailangvn , thanks for the work.

I just added a few improvements

  • reduces create() complexity enough to remove noqa: C90 by introducing 2 helpers
  • fix NameError of detected_paths

Cool with it?

…Error

detected_paths was only assigned inside an `if project_dir_value` block
but referenced outside it, risking a NameError. Extract detection logic
into _detect_project_layout() and _resolve_odoo_dir_and_version() helpers,
which also reduces create() complexity enough to remove noqa: C901.
@hailangvn
Copy link
Copy Markdown
Collaborator Author

Thanks @trisdoan for the fix. I have just moved code around to group relevant code together.

@trisdoan trisdoan merged commit 98bebed into trobz:main Feb 26, 2026
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants