Development Workflow
Environment Setup
Prerequisites
- Python 3.8+ (Odoo 18 requirement)
- PostgreSQL 12+
- Git
- Docker (optional, for isolated testing)
Local Development Setup
# Clone repositories
git clone <cnf-custom-modules-repo> CNFOdooCustomModules
git clone <odoo-18-repo> odoo_18
# Create virtual environment
python3 -m venv venv-odoo18
source venv-odoo18/bin/activate
# Install Odoo dependencies
pip install -r odoo_18/requirements.txt
pip install -r CNFOdooCustomModules/requirements.txt
Database Setup
# Create test database
createdb cnf_odoo18_test
# Copy production data (sanitized)
pg_dump cnf_odoo13_prod | psql cnf_odoo18_test
Module Upgrade Process
1. Assessment Phase
# Check module in v13 environment
./odoo-bin shell -d cnf_odoo13_test
>>> module = env['ir.module.module'].search([('name', '=', 'module_name')])
>>> print(module.dependencies_id.mapped('name'))
2. Code Migration
Common Changes Required
Python 3 Compatibility
API Changes
# Old (v13)
@api.multi
def action_confirm(self):
for record in self:
# logic
# New (v18)
def action_confirm(self):
for record in self:
# logic
Field Definitions
# Old (v13)
field_name = fields.Char(string="Name", required=True)
# New (v18) - mostly the same, but check for deprecated parameters
field_name = fields.Char(string="Name", required=True)
3. Testing Phase
Unit Testing
# Run module-specific tests
./odoo-bin test -i module_name -d test_db --stop-after-init
# Run with coverage
coverage run ./odoo-bin test -i module_name
coverage report
Integration Testing
- Install module in clean database
- Test with dependencies
- Verify data migration
- Check performance
4. Documentation Updates
Update module README with: - Odoo 18 compatibility notes - Migration steps performed - Breaking changes - New features/improvements
Git Workflow
Branch Strategy
# Create feature branch
git checkout -b upgrade/module_name_v18
# Make changes
git add .
git commit -m "feat: upgrade module_name to Odoo 18
- Update API calls for v18 compatibility
- Fix deprecated decorators
- Update manifest version"
# Push for review
git push origin upgrade/module_name_v18
Commit Guidelines
feat:New features or major upgradesfix:Bug fixesrefactor:Code improvementsdocs:Documentation updatestest:Test additions/modifications
Code Review Checklist
Before Submitting
- [ ] Module installs without errors
- [ ] All tests pass
- [ ] Dependencies are correct
- [ ] No hardcoded values
- [ ] Security rules updated
- [ ] Views render correctly
- [ ] Performance acceptable
Review Focus Areas
- API Compatibility - All v18 APIs used correctly
- Security - Access rights and record rules
- Performance - No N+1 queries, efficient searches
- UI/UX - Views work on all devices
- Data Migration - Existing data preserved
Staging Deployment
Pre-deployment
# Update module list
./odoo-bin update-list -d staging_db
# Test upgrade
./odoo-bin -u module_name -d staging_db --stop-after-init
Deployment Steps
- Backup staging database
- Deploy code to staging
- Run update command
- Verify functionality
- Run automated tests
- User acceptance testing
Troubleshooting
Common Issues
Import Errors
# Check for moved imports
try:
from odoo.addons.base.models.res_partner import ResPartner
except ImportError:
from odoo.addons.base.models.res_partner import Partner as ResPartner
View Errors
<!-- Check for deprecated attributes -->
<!-- Old -->
<field name="field" position="after" />
<!-- New - same, but verify in v18 docs -->
<field name="field" position="after" />
JavaScript/Assets - Check for changes in asset bundle names - Update paths in manifest.py - Verify QWeb templates
Performance Optimization
Database Indexes
# Add indexes for frequently searched fields
_sql_constraints = [
('code_unique', 'UNIQUE(code)', 'Code must be unique'),
]
# Or in field definition
code = fields.Char(string="Code", index=True)
Batch Processing
# Use batch processing for large datasets
for batch in self.split_every(1000):
batch.process_records()
self.env.cr.commit()
Module Status Updates
After completing work:
1. Update modules 4.csv with results
2. Document any issues found
3. Note performance improvements
4. Record testing outcomes
Getting Help
- Check Odoo 18 official documentation
- Review similar modules already upgraded
- Ask in team chat for complex issues
- Consult third-party vendor docs for their modules