Create a Git Repository
Your quickstart guide to creating a new Odoo addon repository
π― Quick Start
Option 1: Use GitHub Template (Recommended)
- Go to base-template
- Click "Use this template" β "Create a new repository"
- Name your repository and create it
- Clone and configure (see next section)
Option 2: Manual Setup
# Clone the template git clone https://github.com/much-GmbH-sandbox/base-template.git my-new-repo cd my-new-repo # Remove template history and start fresh rm -rf .git git init git remote add origin <your-repo-url>
βοΈ Required Configuration
π Step 1: Update pyproject.toml
This is THE most important file. Open it and update:
[odoo] version = 18.0 # π Change to YOUR Odoo version (14.0, 15.0, 16.0, 17.0, 18.0, 19.0)
π Full pyproject.toml options
[odoo]
version = 17.0 # Required: Your Odoo version
edition = "enterprise" # "enterprise" or "community" (default: enterprise)
build_docker = true # CD only: Build Docker image on deploy
git_hosts = "" # CD only: Extra Git hosts for pip install in Docker builds
# Optional: Override Python version (default: 3.10)
# python_version = "3.12"
[odoo.testing]
enabled = true # Enable CI tests (default: true)
test_tags = "much_unit" # Test tag to filter tests (default: "much_unit")
# Leave empty to run ALL tests for affected modules
# Optional: Repository dependencies (for modules that depend on other repos)
# [odoo.dependencies]
# "much-GmbH/much-integration-hub" = "tag" # Clone latest v{odoo}.* tag
# "much-GmbH/much-notify" = "branch" # Clone {odoo}.0 branch
# Optional: Customer-specific Docker registry (CD only)
# [registry]
# url = "https://customer-registry.example.com"
# namespace = "customer-namespace"
# credentials_id = "jenkins-creds-id"
π§ CI Variables (GitHub Actions)
| Variable | Section | Default | Description |
| version | [odoo] | 17 | Odoo version - determines Docker image and API compatibility |
| edition | [odoo] | enterprise | Downloads enterprise modules for tests if set to "enterprise" |
| python_version | [odoo] | 3.10 | Python version for quality checks |
| enabled | [odoo.testing] | true | Enable/disable test execution |
| test_tags | [odoo.testing] | much_unit | Test tag to filter which tests run (empty = all tests) |
π¦ Repository Dependencies
| Variable | Section | Description |
| "org/repo" | [odoo.dependencies] | Repository to clone as dependency |
Strategies: "tag" (default, finds latest v{odoo}.*), "branch" (uses {odoo}.0), or explicit version
π CD Variables (Jenkins - Deploy Pipeline)
| Variable | Section | Default | Description |
| version | [odoo] | - | Odoo version for Docker image builds |
| edition | [odoo] | enterprise | Odoo edition for Docker builds |
| build_docker | [odoo] | - | Enable Docker image building on deploy |
| git_hosts | [odoo] | "" | Extra Git hosts for pip install during Docker builds |
π·οΈ Customer Registry (CD only)
| Variable | Section | Description |
| url | [registry] | Customer's private Docker registry URL |
| namespace | [registry] | Registry namespace/project |
| credentials_id | [registry] | Jenkins credentials ID for registry auth |
π Python Version
Defaults to 3.10. To override, set in pyproject.toml:
python_version = "3.12"
π Secrets Setup
π’ Organization Secrets (Already Configured!)
These are set at the organization level by admins. You don't need to do anything!
| Secret | Purpose |
| REGISTRY_URL | Docker registry URL |
| REGISTRY_USER | Docker registry username |
| REGISTRY_PASSWORD | Docker registry password |
| ENTERPRISE_TOKEN | Gitea token for enterprise modules |
| DOCKER_MINIMAL_TOKEN | PAT for odoo-docker-minimal repo |
| CONFIG_TOKEN | PAT for private repo access |
| SONAR_TOKEN | SonarQube authentication |
| SONAR_HOST_URL | SonarQube server URL |
β Good news! All these secrets are inherited from the organization. Just use secrets: inherit in your workflow (already configured).
π Repository Secrets (Only if Needed)
In rare cases, you might need repo-specific secrets:
- Go to your repo β Settings β Secrets and variables β Actions
- Click "New repository secret"
- Add only if you have project-specific credentials
π‘ Pro tip: 99% of projects don't need any repo-level secrets!
π§ͺ Testing Configuration
Test Modes
The CI is smart about when to run tests:
| Event | What Runs | Why |
| Pull Request | Changed modules + dependencies | β‘ Fast feedback |
| Push to main/staging | All module tests | π Full validation |
| PR with run-all-tests label | All module tests | π― Force full run |
π Dependencies are automatic! When testing a module, Odoo automatically installs all its dependencies from __manifest__.py. Git submodules are also always included.
Configure Testing in pyproject.toml
[odoo.testing] enabled = true # Set to false to disable tests entirely test_tags = "much_unit" # Change if using different test tags
Common Scenarios
πΉ I use custom test tags
[odoo.testing] test_tags = "my_custom_tag"
πΉ I want to disable tests temporarily
[odoo.testing] enabled = false
πΉ I want to run ALL tests (no tag filtering)
[odoo.testing] enabled = true test_tags = "" # Empty = run all tests for affected modules
π¦ Repository Dependencies
When your modules depend on code from other repositories (e.g., shared libraries), configure them in pyproject.toml. The CI will automatically clone these before running tests.
Configuration
[odoo.dependencies]
# Format: "org/repo" = "version_strategy"
#
# Strategies:
# "tag" - Find latest tag matching v{odoo-major}.* (RECOMMENDED)
# "branch" - Clone the {odoo-major}.0 branch
# "X.Y.Z" - Explicit branch or tag name
#
"much-GmbH/much-integration-hub" = "tag"
"much-GmbH/much-notify" = "tag"
Version Resolution Examples
| Strategy | Config | Resolves to (Odoo 17) |
| "tag" | "much-GmbH/repo" = "tag" | Latest v17.* tag (e.g., v17.0.1.0.0) |
| "branch" | "much-GmbH/repo" = "branch" | Branch 17.0 |
| Explicit | "much-GmbH/repo" = "v17.0.0.1.0" | Exact tag v17.0.0.1.0 |
Important Notes
β οΈ Dependencies are explicit, not transitive!
If your addon depends on ihub, and ihub depends on much-notify, you must list both:
[odoo.dependencies] "much-GmbH/much-integration-hub" = "tag" "much-GmbH/much-notify" = "tag" # Required by ihub!
Python Dependencies
Python dependencies from dependency repositories are automatically installed. If a dependency repo has a requirements.txt file (at repo root or module level), it will be collected and installed before tests run.
No manual configuration needed! β
Caching
Dependencies are cached based on pyproject.toml hash. Changing the file invalidates the cache.
Skip Dependencies
Use the workflow input to skip dependency cloning:
uses: much-GmbH-sandbox/github-actions/.github/workflows/odoo-tests.yml@v1 with: odoo-version: '17' skip-dependencies: true # Don't clone repo dependencies
π οΈ Local Development Setup
Step 1: Install Pre-commit
pip install pre-commit pre-commit install
Step 2: Verify Setup
pre-commit run --all-files
What Pre-commit Does
Every time you commit, these tools run automatically:
| Tool | What it Does |
| π¨ Black | Formats your Python code |
| π¦ isort | Sorts your imports |
| π Flake8 | Checks for Python errors |
| π‘οΈ Bandit | Scans for security issues |
| π¦ Pylint-Odoo | Odoo-specific checks |
| π§Ή autoflake | Removes unused imports |
| β¬οΈ pyupgrade | Modernizes Python syntax |
π‘ Tip: If pre-commit blocks your commit, it usually auto-fixes the issues. Just git add and commit again!
β Pre-flight Checklist
Before pushing your first code:
- π Updated pyproject.toml with correct Odoo version
- π§ͺ Configured [odoo.testing] section if needed
- π§ Installed pre-commit hooks locally
- β¨ Ran pre-commit run --all-files successfully
- π Created first commit and pushed
First Push Verification
After your first push, check:
- Go to Actions tab in your repo
- Verify the CI workflow runs
- Check that quality checks pass
- Check that tests run (if enabled)
β FAQ
π€ Why did my commit fail?
Pre-commit hooks likely found issues. Check the output for details.
Quick fix:
# Most issues are auto-fixed, just add and commit again git add . git commit -m "your message"
If that doesn't work:
# See what's wrong pre-commit run --all-files # Fix issues manually, then commit
π€ How do I skip pre-commit for one commit?
Only do this if absolutely necessary:
git commit --no-verify -m "emergency fix"
β οΈ Warning: CI will still run these checks!
π€ Why are my tests not running?
Check these things:
- Is [odoo.testing] enabled = true in pyproject.toml?
- Do your test files have the correct tags?
- Are you testing on a PR vs push? (PRs only test changed modules)
π€ How do I run all tests on a PR?
Add the label run-all-tests to your PR.
π€ Can I customize linting rules?
Yes! Edit these files:
- .flake8 - Flake8 rules
- .pylintrc - Pylint/Odoo rules
- .bandit - Security scan rules
π€ How do I add a new module to the repo?
Just create your module folder at the root:
my-repo/ βββ my_new_module/ β βββ __init__.py β βββ __manifest__.py β βββ models/ β βββ views/ βββ pyproject.toml βββ ...
The CI will automatically discover it!
π€ Why are my repository dependencies not being cloned?
Check these things:
- Is the [odoo.dependencies] section in pyproject.toml?
- Does the repository have tags matching v{odoo-version}.* if using "tag" strategy?
- Does the CONFIG_TOKEN secret have access to the dependency repositories?
Try using branch strategy:
[odoo.dependencies]
"much-GmbH/my-dependency" = "branch" # Uses {odoo}.0 branch
π€ Tests fail with "module not found" after adding dependencies?
Remember: dependencies are explicit, not transitive. If your dependency has its own dependencies, you must list them all:
[odoo.dependencies] "much-GmbH/main-dep" = "tag" "much-GmbH/sub-dep" = "tag" # Required by main-dep "much-GmbH/another-dep" = "tag" # Also required by main-dep
π€ Tests fail with "External dependency not met"?
This happens when a dependency module requires a Python package. The CI automatically collects requirements.txt files from dependency repos, but if the package is declared only in external_dependencies (manifest), ensure the dependency repo has a requirements.txt with that package.
Example error: Unable to install module "ihub_log" because external dependency 'cachetools' is not met
Solution: The dependency repo should have cachetools in its requirements.txt.
π Related Resources
| Resource | Description |
| github-actions | Centralized CI workflows |
| odoo-docker-minimal | Docker test environment |
π Need Help?
- CI Issues: Check the workflow run logs in the Actions tab
- Pre-commit Issues: Run pre-commit run --all-files -v for verbose output
- General Questions: Ask in the #i-dev Slack channel
Last updated: January 2026