Base Module Update Failures
Running -u base or -u all is the most common upgrade operation in Odoo, and also the most error-prone. When it fails, you see:
ERROR odoo.modules.loading: module base: error while updating
psycopg2.errors.UndefinedColumn: column ir_module_module.foo does not exist
ERROR odoo.modules.registry: Failed to load registry
Traceback: ... ParseError: Error while parsing view ...
ERROR: Module loading failed: database 'mydb' is not initializedError 1: Column Does Not Exist
Cause: A module removed or renamed a field, but the database still references the old column name in views, actions, or filters.
# Find references to the missing column
sudo -u postgres psql -d mydb -c "
SELECT name, model, arch_db FROM ir_ui_view
WHERE arch_db::text LIKE '%old_field_name%';
"
# Delete or fix the offending view
sudo -u postgres psql -d mydb -c "
DELETE FROM ir_ui_view WHERE id = 123;
"
# Retry the update
./odoo-bin -c /etc/odoo.conf -d mydb -u base --stop-after-initError 2: View Parsing Errors
Cause: A view XML is invalid, references a non-existent field, or has an incorrect inherit_id.
# The error message tells you which view:
ParseError: Error while parsing view my_module.view_name
# Option 1: Fix the module code and retry
# Option 2: Remove the broken view from database
sudo -u postgres psql -d mydb -c "
SELECT id, name, model FROM ir_ui_view WHERE key = 'my_module.view_name';
DELETE FROM ir_ui_view WHERE key = 'my_module.view_name';
"Error 3: Constraint Violations During Update
Cause: New constraints conflict with existing data.
# Error: duplicate key value violates unique constraint
# Find the duplicate data
sudo -u postgres psql -d mydb -c "
SELECT field1, field2, COUNT(*) FROM my_table
GROUP BY field1, field2 HAVING COUNT(*) > 1;
"
# Fix duplicates before retrying update
sudo -u postgres psql -d mydb -c "
DELETE FROM my_table WHERE id IN (
SELECT id FROM (
SELECT id, ROW_NUMBER() OVER(PARTITION BY field1, field2 ORDER BY id) as rn
FROM my_table
) t WHERE t.rn > 1
);
"Error 4: Module Dependency Not Met
# Error: Unmet module dependencies: module_x depends on module_y
# Install missing dependency first
./odoo-bin -c /etc/odoo.conf -d mydb -i module_y --stop-after-init
# Then retry
./odoo-bin -c /etc/odoo.conf -d mydb -u base --stop-after-initError 5: Database Not Initialized
# Error: database 'mydb' is not initialized
# The database exists but has no Odoo tables
# Option 1: Initialize it
./odoo-bin -c /etc/odoo.conf -d mydb -i base --stop-after-init
# Option 2: You may be connecting to the wrong database
grep db_name /etc/odoo.confSafe Update Procedure
Always follow this process to minimize risk:
# 1. Backup first
sudo -u postgres pg_dump mydb > /tmp/mydb_backup_$(date +%Y%m%d).sql
# 2. Stop Odoo
sudo systemctl stop odoo
# 3. Run update with --stop-after-init
./odoo-bin -c /etc/odoo.conf -d mydb -u my_module --stop-after-init --workers=0
# 4. Check for errors in output
# If successful, start Odoo
sudo systemctl start odoo
# 5. If failed, restore backup
sudo -u postgres psql -c "DROP DATABASE mydb;"
sudo -u postgres psql -c "CREATE DATABASE mydb OWNER odoo;"
sudo -u postgres psql mydb < /tmp/mydb_backup_*.sqlTips for Large Databases
# Use --workers=0 to avoid multiprocessing issues during update
# Increase timeout limits
./odoo-bin -c /etc/odoo.conf -d mydb -u base \
--stop-after-init --workers=0 \
--limit-time-real=3600 --limit-time-cpu=1800Prevention
DeployMonkey performs module updates in isolated environments with automatic backup and rollback. The AI agent validates module compatibility before applying updates and detects schema conflicts early.