Why Connect GitHub to Odoo?
Development teams use GitHub for code. Business teams use Odoo for project management, timesheets, and invoicing. Without integration, project managers manually update Odoo tasks based on GitHub activity, developers switch contexts to log time, and billing is disconnected from actual development work. A GitHub-Odoo integration automates these handoffs.
What You Can Automate
- Commit references: Mentioning a task ID in a commit message updates the Odoo task
- PR status: Opening or merging a PR updates the task stage
- Issue sync: GitHub issues create Odoo tasks (or vice versa)
- Time tracking: Commit activity auto-generates timesheet entries
- Notifications: GitHub events post to Odoo chatter on related tasks
Prerequisites
- Odoo 17 or 18 with Project module
- GitHub account with repository admin access
- GitHub Personal Access Token or GitHub App
Step 1: Create a GitHub Personal Access Token
- Go to GitHub → Settings → Developer Settings → Personal Access Tokens → Fine-grained tokens
- Click Generate New Token
- Set repository access to the specific repos you want to integrate
- Grant permissions: Issues (read/write), Pull Requests (read), Contents (read)
- Copy the token
Step 2: Set Up GitHub Webhooks
Webhooks push GitHub events to Odoo in real time:
- Go to your GitHub repository → Settings → Webhooks
- Click Add Webhook
- Set Payload URL:
https://your-odoo.com/api/github/webhook - Content type:
application/json - Set a webhook secret (store this in Odoo for verification)
- Select events: Pushes, Pull requests, Issues, Issue comments
Step 3: Build the Odoo Webhook Handler
Create an Odoo controller to receive GitHub webhook events:
import hmac, hashlib, json
from odoo import http
class GitHubWebhook(http.Controller):
@http.route('/api/github/webhook', type='json', auth='none', csrf=False)
def handle_webhook(self, **kwargs):
# Verify webhook signature
secret = http.request.env['ir.config_parameter'].sudo().get_param('github_webhook_secret')
signature = http.request.httprequest.headers.get('X-Hub-Signature-256')
body = http.request.httprequest.get_data()
expected = 'sha256=' + hmac.new(secret.encode(), body, hashlib.sha256).hexdigest()
if not hmac.compare_digest(signature, expected):
return {'error': 'Invalid signature'}
event = http.request.httprequest.headers.get('X-GitHub-Event')
data = json.loads(body)
if event == 'push':
self._handle_push(data)
elif event == 'pull_request':
self._handle_pr(data)
return {'status': 'ok'}Step 4: Link Commits to Tasks
Use a naming convention in commit messages to link activity to Odoo tasks:
# Convention: include task ID in commit message
git commit -m "Fix invoice calculation [TASK-42]"
git commit -m "Add export feature [TASK-108]"
# Webhook handler extracts TASK-42,
# finds project.task with id=42,
# posts commit info to the task's chatterThe webhook handler parses commit messages for task references, looks up the Odoo task, and adds a chatter message with the commit hash, author, and message.
Step 5: Auto-Update Task Stages from PR Events
Map GitHub PR lifecycle events to Odoo task stage changes:
| GitHub Event | Odoo Stage Change |
|---|---|
| PR opened | In Progress → Code Review |
| PR review approved | Code Review → Approved |
| PR merged | Approved → Done |
| PR closed (not merged) | Code Review → In Progress |
Step 6: Sync GitHub Issues to Odoo Tasks
For teams that want external contributors to create work items via GitHub Issues:
- GitHub issue created → Create Odoo task in a designated project
- GitHub issue labeled → Set task tags in Odoo
- GitHub issue closed → Move Odoo task to Done
- Odoo task comment → Post as GitHub issue comment (bidirectional)
Troubleshooting
Webhook Delivery Failures
Check GitHub's webhook delivery log (repository Settings → Webhooks → Recent Deliveries). Common issues: Odoo URL not reachable, SSL certificate errors, controller returning 500. GitHub retries failed deliveries for up to 3 days.
Signature Verification Failing
Ensure the webhook secret in GitHub matches the one stored in Odoo. The secret is case-sensitive and must not have trailing whitespace. GitHub uses HMAC-SHA256 for the X-Hub-Signature-256 header.
Task References Not Found
If commit messages reference task IDs that do not exist in Odoo, log the miss and skip. Use a consistent task ID format (e.g., TASK-{id} or #{id}) and document the convention for your development team.
DeployMonkey + GitHub
DeployMonkey instances are cloud-hosted with stable HTTPS URLs, so GitHub webhooks connect reliably. Our AI agent can help design your GitHub-Odoo workflow, generate the webhook handler code, and troubleshoot delivery issues.