什么是KeyError:导入中的'string'?

时间:2015-07-08 09:32:41

标签: python-2.7 openerp openerp-7

有人能解释为什么会这样吗?我有包含销售的模块,现在当我导入产品时弹出一个错误说:

  File "/opt/openerp/custom_server70_addons/extra-addons/base_import/models.py", line 220, in parse_preview
     fields = self.get_fields(cr, uid, record.res_model, context=context)
  File "/opt/openerp/custom_server70_addons/extra-addons/base_import/models.py", line 117, in get_fields
     cr, uid, field['relation'], context=context, depth=depth-1)  
  File "/opt/openerp/custom_server70_addons/extra-addons/base_impor/models.py", line 104, in get_fields
    'string': field['string'],
KeyError: 'string'

我试图改变

'string': field['string'];

,可在默认模块中找到

'string': field.get('string')

它工作正常,但我不想更改默认代码,因为它可能会在将来造成麻烦。

非常感谢任何帮助。

1 个答案:

答案 0 :(得分:0)

您的某个字段似乎没有字符串。

例如:

'my_field': fields.char(string='my string')

检查所有字段并在字段中添加字符串标签,然后尝试再次导入记录。