OCA / OpenUpgrade

Open source upgrade path for Odoo/OpenERP
https://oca.github.io/OpenUpgrade/
GNU Affero General Public License v3.0
742 stars 696 forks source link

odoo 8 -> odoo9 keyError 'index' for model '_unknown' #2025

Closed bizslink-calon closed 5 years ago

bizslink-calon commented 5 years ago

Traceback (most recent call last): File "/tmp/upgrade/openupgrade/9.0/server/openerp/modules/registry.py", line 390, in new openerp.modules.load_modules(registry._db, force_demo, status, update_module) File "/tmp/upgrade/openupgrade/9.0/server/openerp/modules/loading.py", line 379, in load_modules report=report, models_to_check=models_to_check, upg_registry=upg_registry File "/tmp/upgrade/openupgrade/9.0/server/openerp/modules/loading.py", line 178, in load_module_graph init_module_models(cr, package.name, models) File "/tmp/upgrade/openupgrade/9.0/server/openerp/modules/module.py", line 300, in init_module_models result = obj._auto_init(cr, {'module': module_name}) File "/tmp/upgrade/openupgrade/9.0/server/openerp/api.py", line 250, in wrapper return old_api(self, *args, kwargs) File "/tmp/upgrade/openupgrade/9.0/server/openerp/models.py", line 2496, in _auto_init self._field_create(cr, context=context) File "/tmp/upgrade/openupgrade/9.0/server/openerp/api.py", line 250, in wrapper return old_api(self, *args, *kwargs) File "/tmp/upgrade/openupgrade/9.0/server/openerp/models.py", line 487, in _field_create if cols[k][key] != vals[key]: KeyError: 'index' 2019-09-18 02:20:16,049 21504 CRITICAL odoo10 openerp.service.server: Failed to initialize database odoo10. Traceback (most recent call last): File "/tmp/upgrade/openupgrade/9.0/server/openerp/service/server.py", line 894, in preload_registries registry = RegistryManager.new(dbname, update_module=update_module) File "/tmp/upgrade/openupgrade/9.0/server/openerp/modules/registry.py", line 390, in new openerp.modules.load_modules(registry._db, force_demo, status, update_module) File "/tmp/upgrade/openupgrade/9.0/server/openerp/modules/loading.py", line 379, in load_modules report=report, models_to_check=models_to_check, upg_registry=upg_registry File "/tmp/upgrade/openupgrade/9.0/server/openerp/modules/loading.py", line 178, in load_module_graph init_module_models(cr, package.name, models) File "/tmp/upgrade/openupgrade/9.0/server/openerp/modules/module.py", line 300, in init_module_models result = obj._auto_init(cr, {'module': module_name}) File "/tmp/upgrade/openupgrade/9.0/server/openerp/api.py", line 250, in wrapper return old_api(self, args, kwargs) File "/tmp/upgrade/openupgrade/9.0/server/openerp/models.py", line 2496, in _auto_init self._field_create(cr, context=context) File "/tmp/upgrade/openupgrade/9.0/server/openerp/api.py", line 250, in wrapper return old_api(self, *args, **kwargs) File "/tmp/upgrade/openupgrade/9.0/server/openerp/models.py", line 487, in _field_create if cols[k][key] != vals[key]: KeyError: 'index'

This error occurs when upgrade base, model name is '_unknown', not only field 'index', many fields defined in model can not be found.

pedrobaeza commented 5 years ago

This seems something broken in your database, as model can't be _unknown unless you mangled that models previously. You have to check this in your previous version and then try again. Be sure also that version 8 is totally updated before trying.

Closing as this is not an OpenUpgrade issue, but a specific one with your DB.

bizslink-calon commented 5 years ago

This seems something broken in your database, as model can't be _unknown unless you mangled that models previously. You have to check this in your previous version and then try again. Be sure also that version 8 is totally updated before trying.

Closing as this is not an OpenUpgrade issue, but a specific one with your DB.

It's may created by class 'unknown' in ir/ir_model.py, and 3 fields are insert into ir_model_fields. i do not know why this abstract model will be initialized when upgrade, and those fields are never found in production server which in odoo 7. when deleted those 3 fields in ir_model_fields. and some other errors occurs

2019-09-18 08:27:46,599 7854 INFO odoo10 openerp.sql_db: Programming error: column "index" of relation "ir_model_fields" does not exist LINE 1: ...s (serialization_field_id,model_id,translate,name,index,requ... ^ , in query INSERT INTO ir_model_fields (serialization_field_id,model_id,translate,name,index,required,related,id,relation_table,readonly,column2,relation,relation_field,ttype,model,copy,column1,selectable,field_description,help) VALUES (%(serialization_field_id)s,%(model_id)s,%(translate)s,%(name)s,%(index)s,%(required)s,%(related)s,%(id)s,%(relation_table)s,%(readonly)s,%(column2)s,%(relation)s,%(relation_field)s,%(ttype)s,%(model)s,%(copy)s,%(column1)s,%(selectable)s,%(field_description)s,%(help)s) 2019-09-18 08:27:46,600 7854 ERROR odoo10 openerp.modules.registry: Failed to load registry Traceback (most recent call last): File "/tmp/upgrade/openupgrade/9.0/server/openerp/modules/registry.py", line 390, in new openerp.modules.load_modules(registry._db, force_demo, status, update_module) File "/tmp/upgrade/openupgrade/9.0/server/openerp/modules/loading.py", line 379, in load_modules report=report, models_to_check=models_to_check, upg_registry=upg_registry File "/tmp/upgrade/openupgrade/9.0/server/openerp/modules/loading.py", line 178, in load_module_graph init_module_models(cr, package.name, models) File "/tmp/upgrade/openupgrade/9.0/server/openerp/modules/module.py", line 300, in init_module_models result = obj._auto_init(cr, {'module': module_name}) File "/tmp/upgrade/openupgrade/9.0/server/openerp/api.py", line 250, in wrapper return old_api(self, *args, kwargs) File "/tmp/upgrade/openupgrade/9.0/server/openerp/models.py", line 2495, in _auto_init self._field_create(cr, context=context) File "/tmp/upgrade/openupgrade/9.0/server/openerp/api.py", line 250, in wrapper return old_api(self, *args, *kwargs) File "/tmp/upgrade/openupgrade/9.0/server/openerp/models.py", line 475, in _field_create cr.execute(query, vals) File "/tmp/upgrade/openupgrade/9.0/server/openerp/sql_db.py", line 154, in wrapper return f(self, args, kwargs) File "/tmp/upgrade/openupgrade/9.0/server/openerp/sql_db.py", line 233, in execute res = self._obj.execute(query, params) UndefinedColumn: column "index" of relation "ir_model_fields" does not exist

This means new fields for ir_model_fields defined in odoo 9 are not created when initializing. and why? Infactly, we have simulated this process many times and no such errors until you update branches days ago.

pedrobaeza commented 5 years ago

Branch 9.0 hasn't been updated since a lot (and only with fixes).