无法在Odoo 9上安装模块

时间:2016-11-22 21:26:43

标签: module openerp odoo-9

卸载某些模块后,每当我尝试安装模块时都会出现一个奇怪的错误,我无法安装任何模块。

Odoo官方模块也受到影响。 无法弄清楚问题是什么。

这是追溯:

Odoo Server Error
Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/openerp/http.py", line 648, in _handle_exception
    return super(JsonRequest, self)._handle_exception(exception)
  File "/usr/lib/python2.7/dist-packages/openerp/http.py", line 685, in dispatch
    result = self._call_function(**self.params)
  File "/usr/lib/python2.7/dist-packages/openerp/http.py", line 321, in _call_function
    return checked_call(self.db, *args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/openerp/service/model.py", line 118, in wrapper
    return f(dbname, *args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/openerp/http.py", line 314, in checked_call
    result = self.endpoint(*a, **kw)
  File "/usr/lib/python2.7/dist-packages/openerp/http.py", line 964, in __call__
    return self.method(*args, **kw)
  File "/usr/lib/python2.7/dist-packages/openerp/http.py", line 514, in response_wrap
    response = f(*args, **kw)
  File "/usr/lib/python2.7/dist-packages/openerp/addons/web/controllers/main.py", line 892, in call_button
    action = self._call_kw(model, method, args, {})
  File "/usr/lib/python2.7/dist-packages/openerp/addons/web/controllers/main.py", line 880, in _call_kw
    return getattr(request.registry.get(model), method)(request.cr, request.uid, *args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/openerp/api.py", line 250, in wrapper
    return old_api(self, *args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/openerp/addons/base/module/module.py", line 459, in button_immediate_install
    return self._button_immediate_function(cr, uid, ids, self.button_install, context=context)
  File "/usr/lib/python2.7/dist-packages/openerp/api.py", line 250, in wrapper
    return old_api(self, *args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/openerp/addons/base/module/module.py", line 534, in _button_immediate_function
    registry = openerp.modules.registry.RegistryManager.new(cr.dbname, update_module=True)
  File "/usr/lib/python2.7/dist-packages/openerp/modules/registry.py", line 386, in new
    openerp.modules.load_modules(registry._db, force_demo, status, update_module)
  File "/usr/lib/python2.7/dist-packages/openerp/modules/loading.py", line 338, in load_modules
    loaded_modules, update_module)
  File "/usr/lib/python2.7/dist-packages/openerp/modules/loading.py", line 237, in load_marked_modules
    loaded, processed = load_module_graph(cr, graph, progressdict, report=report, skip_modules=loaded_modules, perform_checks=perform_checks)
  File "/usr/lib/python2.7/dist-packages/openerp/modules/loading.py", line 137, in load_module_graph
    init_module_models(cr, package.name, models)
  File "/usr/lib/python2.7/dist-packages/openerp/modules/module.py", line 300, in init_module_models
    result = obj._auto_init(cr, {'module': module_name})
  File "/usr/lib/python2.7/dist-packages/openerp/api.py", line 250, in wrapper
    return old_api(self, *args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/openerp/models.py", line 2643, in _auto_init
    self._set_default_value_on_column(cr, k, context=context)
  File "/usr/lib/python2.7/dist-packages/openerp/api.py", line 250, in wrapper
    return old_api(self, *args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/openerp/models.py", line 2399, in _set_default_value_on_column
    default = default(self, cr, SUPERUSER_ID, context)
  File "/usr/lib/python2.7/dist-packages/openerp/api.py", line 250, in wrapper
    return old_api(self, *args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/openerp/api.py", line 354, in old_api
    result = method(recs, *args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/openerp/fields.py", line 82, in <lambda>
    return api.model(lambda model: field.convert_to_write(value(model)))
  File "/usr/lib/python2.7/dist-packages/openerp/fields.py", line 1718, in convert_to_write
    return value.id
AttributeError: 'int' object has no attribute 'id'
编辑:我已经安装了pip并升级了所有软件包,错误消失了,现在我又换了一个新软件包:

2016-11-23 18:24:23,868 820 WARNING myerp openerp.models.schema: Table 'product_category': unable to set a NOT NULL constraint on column 'name' !
If you want to have it, you should update the records and execute manually:
ALTER TABLE product_category ALTER COLUMN name SET NOT NULL
2016-11-23 18:24:24,468 820 INFO myerp openerp.sql_db: bad query: ALTER TABLE "product_product" ADD FOREIGN KEY ("product_tmpl_id") REFERENCES "product_template" ON DELETE cascade
2016-11-23 18:24:24,468 820 ERROR myerp openerp.modules.registry: Failed to load registry
Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/openerp/modules/registry.py", line 386, in new
    openerp.modules.load_modules(registry._db, force_demo, status, update_module)
  File "/usr/lib/python2.7/dist-packages/openerp/modules/loading.py", line 338, in load_modules
    loaded_modules, update_module)
  File "/usr/lib/python2.7/dist-packages/openerp/modules/loading.py", line 237, in load_marked_modules
    loaded, processed = load_module_graph(cr, graph, progressdict, report=report, skip_modules=loaded_modules, perform_checks=perform_checks)
  File "/usr/lib/python2.7/dist-packages/openerp/modules/loading.py", line 137, in load_module_graph
    init_module_models(cr, package.name, models)
  File "/usr/lib/python2.7/dist-packages/openerp/modules/module.py", line 307, in init_module_models
    obj._auto_end(cr, {'module': module_name})
  File "/usr/lib/python2.7/dist-packages/openerp/api.py", line 250, in wrapper
    return old_api(self, *args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/openerp/models.py", line 2716, in _auto_end
    cr.execute('ALTER TABLE "%s" ADD FOREIGN KEY ("%s") REFERENCES "%s" ON DELETE %s' % (t, k, r, d))
  File "/usr/lib/python2.7/dist-packages/openerp/sql_db.py", line 141, in wrapper
    return f(self, *args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/openerp/sql_db.py", line 220, in execute
    res = self._obj.execute(query, params)
IntegrityError: insert or update on table "product_product" violates foreign key constraint "product_product_product_tmpl_id_fkey"
DETAIL:  Key (product_tmpl_id)=(1) is not present in table "product_template".

我能做什么?

0 个答案:

没有答案