获取TypeError:type()参数1必须是字符串,而不是None

时间:2015-05-14 09:05:37

标签: python openerp odoo

我在安装自定义Odoo模块时遇到错误。

这是我得到的完整Traceback。当我点击模块看板视图上的安装按钮时。

Traceback (most recent call last):
  File "/home/software/ws/bma8_dev/odoo/openerp/http.py", line 518, in _handle_exception
    return super(JsonRequest, self)._handle_exception(exception)
  File "/home/software/ws/bma8_dev/odoo/openerp/http.py", line 539, in dispatch
    result = self._call_function(**self.params)
  File "/home/software/ws/bma8_dev/odoo/openerp/http.py", line 295, in _call_function
    return checked_call(self.db, *args, **kwargs)
  File "/home/software/ws/bma8_dev/odoo/openerp/service/model.py", line 113, in wrapper
    return f(dbname, *args, **kwargs)
  File "/home/software/ws/bma8_dev/odoo/openerp/http.py", line 292, in checked_call
    return self.endpoint(*a, **kw)
  File "/home/software/ws/bma8_dev/odoo/openerp/http.py", line 759, in __call__
    return self.method(*args, **kw)
  File "/home/software/ws/bma8_dev/odoo/openerp/http.py", line 388, in response_wrap
    response = f(*args, **kw)
  File "/home/software/ws/bma8_dev/odoo/openerp/addons/web/controllers/main.py", line 953, in call_button
    action = self._call_kw(model, method, args, {})
  File "/home/software/ws/bma8_dev/odoo/openerp/addons/web/controllers/main.py", line 941, in _call_kw
    return getattr(request.registry.get(model), method)(request.cr, request.uid, *args, **kwargs)
  File "/home/software/ws/bma8_dev/odoo/openerp/api.py", line 237, in wrapper
    return old_api(self, *args, **kwargs)
  File "/home/software/ws/bma8_dev/odoo/openerp/addons/base/module/module.py", line 450, in button_immediate_install
    return self._button_immediate_function(cr, uid, ids, self.button_install, context=context)
  File "/home/software/ws/bma8_dev/odoo/openerp/api.py", line 237, in wrapper
    return old_api(self, *args, **kwargs)
  File "/home/software/ws/bma8_dev/odoo/openerp/addons/base/module/module.py", line 498, in _button_immediate_function
    registry = openerp.modules.registry.RegistryManager.new(cr.dbname, update_module=True)
  File "/home/software/ws/bma8_dev/odoo/openerp/modules/registry.py", line 346, in new
    openerp.modules.load_modules(registry._db, force_demo, status, update_module)
  File "/home/software/ws/bma8_dev/odoo/openerp/modules/loading.py", line 363, in load_modules
    loaded_modules, update_module)
  File "/home/software/ws/bma8_dev/odoo/openerp/modules/loading.py", line 263, in load_marked_modules
    loaded, processed = load_module_graph(cr, graph, progressdict, report=report, skip_modules=loaded_modules, perform_checks=perform_checks)
  File "/home/software/ws/bma8_dev/odoo/openerp/modules/loading.py", line 158, in load_module_graph
    models = registry.load(cr, package)
  File "/home/software/ws/bma8_dev/odoo/openerp/modules/registry.py", line 148, in load
    model = cls._build_model(self, cr)
  File "/home/software/ws/bma8_dev/odoo/openerp/models.py", line 659, in _build_model
    cls = type(cls._name, (cls,), attrs)
TypeError: type() argument 1 must be string, not None

任何人都可以知道出了什么问题吗?

1 个答案:

答案 0 :(得分:3)

您错过了模型上所需的模块描述符。

尝试在模型类上class Node: def __init__(self): self.value = None self.next = None def __str__(self): return self.value _name

它将解决此类错误。