| name | odoo-migration-assistant |
| description | Helps migrate Odoo modules and customizations between versions, specifically focusing on upgrades to/from Odoo 16.0. This skill should be used when the user requests migration help, such as "Migrate this module to Odoo 16" or "Upgrade from version 15 to 16" or "What changed in Odoo 16 for stock valuation?" or "Migration guide for this module". |
Odoo Migration Assistant
Overview
This skill provides guidance for migrating Odoo modules between versions, with specialized knowledge of Odoo 16.0 changes, API differences, and upgrade procedures.
Migration Scenarios
1. Upgrade TO Odoo 16.0
Migrating modules from older versions (14.0, 15.0) to 16.0.
2. Upgrade FROM Odoo 16.0
Preparing modules for future Odoo versions.
3. Version Compatibility Check
Determining what changes are needed for version compatibility.
Migration Workflow
Step 1: Identify Source and Target Versions
Ask for:
- Current Odoo version
- Target Odoo version
- Module name and purpose
- Dependencies
Step 2: Assess Changes Required
Review:
- API changes between versions
- Deprecated features
- New required fields or methods
- View structure changes
- Dependency updates
Step 3: Create Migration Plan
Provide step-by-step migration guide.
Odoo 16.0 Specific Changes
Key Changes in Odoo 16.0
1. Python Version
- Minimum: Python 3.8
- Recommended: Python 3.10+
2. Manifest Changes
{
'version': '15.0.1.0.0',
'depends': ['base', 'stock'],
'license': 'LGPL-3',
}
{
'version': '16.0.1.0.0',
'depends': ['base', 'stock'],
'license': 'LGPL-3',
'assets': {
'web.assets_backend': [
'module/static/src/**/*',
],
},
}
3. Stock Valuation Changes
class StockMove(models.Model):
_inherit = 'stock.move'
def _create_account_move_line(self):
pass
class StockMove(models.Model):
_inherit = 'stock.move'
def _create_account_move_line(self, credit_account_id, debit_account_id, journal_id, qty, description, svl_id, cost):
pass
4. Widget Changes
<field name="amount" widget="monetary" options="{'currency_field': 'currency_id'}"/>
<field name="amount" widget="monetary" options="{'currency_field': 'currency_id'}"/>
5. Removed/Deprecated Methods
_update_average_price() - Replaced with new accounting methods
- Some portal methods reorganized
Migration Patterns
Pattern 1: Update Manifest
'version': '16.0.1.0.0',
'data': [
'security/ir.model.access.csv',
'views/views.xml',
],
'assets': {
'web.assets_backend': [
'module_name/static/src/js/*.js',
],
},
Pattern 2: Update Model Fields
class StockMove(models.Model):
_inherit = 'stock.move'
custom_field = fields.Char(...)
def _action_done(self, cancel_backorder=False):
return super()._action_done(cancel_backorder=cancel_backorder)
Pattern 3: Update Views
<record id="view_form" model="ir.ui.view">
<field name="inherit_id" ref="stock.view_move_form"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='product_id']" position="after">
<field name="custom_field"/>
</xpath>
</field>
</record>
Pattern 4: Create Migration Script
def migrate(cr, version):
"""Pre-migration script for 16.0.1.0.0"""
cr.execute("""
UPDATE model_table
SET new_field = old_field
WHERE new_field IS NULL
""")
def migrate(cr, version):
"""Post-migration script for 16.0.1.0.0"""
from odoo import api, SUPERUSER_ID
env = api.Environment(cr, SUPERUSER_ID, {})
records = env['model.name'].search([])
records._compute_field_name()
old_records = env['old.model'].search([])
old_records.unlink()
Pattern 5: Update Tests
from odoo.tests import TransactionCase
class TestModule(TransactionCase):
def setUp(self):
super().setUp()
def test_feature(self):
record = self.env['model.name'].create({
'name': 'Test',
})
self.assertTrue(record)
Version-Specific Changes
Migrating FROM 15.0 TO 16.0
Major Changes:
- Stock accounting methods updated
- Some JavaScript widgets updated
- Python 3.10 support added
- Minor ORM improvements
Steps:
- Update
__manifest__.py version to 16.0.x.x.x
- Test on Odoo 16 test database
- Check deprecation warnings
- Update any changed method signatures
- Test all functionality
- Create migration scripts if data changes needed
Migrating FROM 14.0 TO 16.0
Major Changes:
- All changes from 14→15 plus 15→16
- Significant OWL (JavaScript framework) changes
- Python 2 completely removed
- Many deprecated features removed
Steps:
- Consider migrating 14→15→16 (two-step migration)
- Review all custom JavaScript (major changes)
- Update all deprecated API calls
- Extensive testing required
Migration Checklist
Migration Commands
mkdir -p module_name/migrations/16.0.1.0.0
pg_dump production_db > backup.sql
createdb test_migration_db
psql test_migration_db < backup.sql
python3 src/odoo-bin -c src/odoo.conf \
-d test_migration_db \
-u module_name \
--stop-after-init
tail -f /var/log/odoo/odoo.log | grep ERROR
Common Migration Issues
Issue 1: Missing Field Error
Error: Field 'xyz' does not exist
Solution: Add field to model or remove from views
Issue 2: Method Signature Changed
TypeError: method() takes X positional arguments but Y were given
Solution: Update method call to match new signature
Issue 3: View Inheritance Broken
Error: View inheritance may not use attribute: ...
Solution: Update XPath or view structure
Issue 4: Dependencies Not Found
Error: Module 'xyz' not found
Solution: Update dependency version or find replacement
Testing After Migration
python3 src/odoo-bin -c src/odoo.conf \
-d DATABASE_NAME \
--test-enable \
--stop-after-init \
-u module_name
python3 src/odoo-bin shell -c src/odoo.conf -d DATABASE_NAME
>>> env['model.name'].search([]).read()
>>>
Resources
references/odoo16_changes.md
Comprehensive list of changes introduced in Odoo 16.0 affecting common modules and customizations.
references/api_changes.md
Detailed API changes by module (stock, account, sale, etc.) between Odoo versions.
scripts/migration_template.py
Template for creating migration scripts with common patterns and examples.