AttributeError:'NoneType'对象在Openerp中没有属性'fields_get'

时间:2012-05-11 07:38:43

标签: python xml openerp

为什么会出现此错误?是否有人熟悉此错误。当我点击任何标签时出现此错误,例如:销售,购买,人力资源,会计等。

Traceback (most recent call last):
File "/home/openERP/src/openerp-server/bin/osv/osv.py", line 122, in wrapper
return f(self, dbname, *args, **kwargs)
File "/home/openERP/src/openerp-server/bin/osv/osv.py", line 176, in execute
res = self.execute_cr(cr, uid, obj, method, *args, **kw)
File "/home/openERP/src/openerp-server/bin/osv/osv.py", line 167, in execute_cr
return getattr(object, method)(cr, uid, *args, **kw)
File "/home/openERP/src/openerp-server/bin/addons/hr/hr_department.py", line 94, in read
res = super(ir_action_window, self).read(cr, uid, select, fields=fields, context=context, load=load)
File "/home/openERP/src/openerp-server/bin/osv/orm.py", line 2944, in read
result = self._read_flat(cr, user, select, fields, context, load)
File "/home/openERP/src/openerp-server/bin/osv/orm.py", line 3064, in _read_flat
res2 = self._columns[f].get(cr, self, ids, f, user, context=context, values=res)
File "/home/openERP/src/openerp-server/bin/osv/fields.py", line 800, in get
res = self._fnct(obj, cr, user, ids, name, self._arg, context)
File "/home/openERP/src/openerp-server/bin/addons/base/ir/ir_actions.py", line 193, in _search_view
fields_from_fields_get = self.pool.get(act.res_model).fields_get(cr, uid, context=context)
AttributeError: 'NoneType' object has no attribute 'fields_get'

2 个答案:

答案 0 :(得分:3)

看起来像是问题:

self.pool.get(act.res_model)

它应该是您使用_name属性的名称

试试

self.pool.get(act.res.model)

答案 1 :(得分:2)

self.pool.get(act.res_model)正在返回None(因为字典pool没有包含密钥act.res_model的条目。

因此,该对象上的调用.fields_get(...)失败(因为None显然没有这样的方法,这就是错误消息试图告诉你的方法。