🌐 Create a Git Repository
🌐

Create a Git Repository

Your quickstart guide to creating a new Odoo addon repository

🎯 Quick Start

Option 1: Use GitHub Template (Recommended)

  1. Go to base-template
  2. Click "Use this template" β†’ "Create a new repository"
  3. Name your repository and create it
  4. 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:

  1. Go to your repo β†’ Settings β†’ Secrets and variables β†’ Actions
  2. Click "New repository secret"
  3. 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:

  1. Go to Actions tab in your repo
  2. Verify the CI workflow runs
  3. Check that quality checks pass
  4. 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