-->

Database schema changed; now odoo won't run

2019-06-14 09:12发布

问题:

I have a problem when I want to start Odoo my local server (localhost).

What happens is I made a change in the database and deleted a field because i didn't need it anymore. But the field was in a tree view and I cannot start the server because the view does not find the field that I removed.

The error is as follows:

2016-04-20 11:46:10,863 3393 INFO prueba3 werkzeug: 127.0.0.1 - - [20/Apr/2016 11:46:10] "GET /favicon.ico HTTP/1.1" 500 -
2016-04-20 11:46:10,903 3393 ERROR prueba3 werkzeug: Error on request:
Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/werkzeug/serving.py", line 177, in run_wsgi
    execute(self.server.app)
  File "/usr/lib/python2.7/dist-packages/werkzeug/serving.py", line 165, in execute
    application_iter = app(environ, start_response)
  File "/opt/odoo9/odoo9/openerp/service/server.py", line 245, in app
    return self.app(e, s)
  File "/opt/odoo9/odoo9/openerp/service/wsgi_server.py", line 184, in application
    return application_unproxied(environ, start_response)
  File "/opt/odoo9/odoo9/openerp/service/wsgi_server.py", line 170, in application_unproxied
    result = handler(environ, start_response)
  File "/opt/odoo9/odoo9/openerp/http.py", line 1488, in __call__
    return self.dispatch(environ, start_response)
  File "/opt/odoo9/odoo9/openerp/http.py", line 1462, in __call__
    return self.app(environ, start_wrapped)
  File "/usr/lib/python2.7/dist-packages/werkzeug/wsgi.py", line 579, in __call__
    return self.app(environ, start_response)
  File "/opt/odoo9/odoo9/openerp/http.py", line 1637, in dispatch
    ir_http = request.registry['ir.http']
  File "/opt/odoo9/odoo9/openerp/http.py", line 360, in registry
    return openerp.modules.registry.RegistryManager.get(self.db) if self.db else None
  File "/opt/odoo9/odoo9/openerp/modules/registry.py", line 355, in get
    update_module)
  File "/opt/odoo9/odoo9/openerp/modules/registry.py", line 386, in new
    openerp.modules.load_modules(registry._db, force_demo, status, update_module)
  File "/opt/odoo9/odoo9/openerp/modules/loading.py", line 340, in load_modules
    registry.setup_models(cr)
  File "/opt/odoo9/odoo9/openerp/modules/registry.py", line 200, in setup_models
    model._setup_fields(cr, SUPERUSER_ID)
  File "/opt/odoo9/odoo9/openerp/api.py", line 250, in wrapper
    return old_api(self, *args, **kwargs)
  File "/opt/odoo9/odoo9/openerp/api.py", line 354, in old_api
    result = method(recs, *args, **kwargs)
  File "/opt/odoo9/odoo9/openerp/models.py", line 3043, in _setup_fields
    field.setup_full(self)
  File "/opt/odoo9/odoo9/openerp/fields.py", line 493, in setup_full
    self._setup_related_full(model)
  File "/opt/odoo9/odoo9/openerp/fields.py", line 1464, in _setup_related_full
    super(Selection, self)._setup_related_full(model)
  File "/opt/odoo9/odoo9/openerp/fields.py", line 530, in _setup_related_full
    field = target._fields[name]
KeyError: u'x_tipo_envase'

The field eliminated is called ' x_tipo_envase '

This error is a fatal error and I can not start the server. The views the change by Odoo GUI. I can not modify the XML files.

How can I start the server to fix this error in the GUI Odoo?

回答1:

Please go through these steps:

  1. Comment the view in openerp.py
  2. Restart the server
  3. Upgrade the module

Now if every thing is working properly un-comment the commented view in openerp.py. ,restart the server and upgrade the module once again .



回答2:

AFAICS that's not an error on the server start sequence, the error is when you enter that view.

If so, activate the Developer Mode, go to Settings > Technical > User Interface > Views, find the offending Tree view, and edit the XML to remove the field.



回答3:

You can run this server with blow command

./odoo.py -d your_db_name --db-filter=your_db_name -u base 

this is working fine