File "/usr/local/lib/python2.7/dist-packages/openerp-7.0_20140112_001021-py2.7.egg/openerp/osv/osv.py", line 199, in execute
res = self.execute_cr(cr, uid, obj, method, *args, **kw)
File "/usr/local/lib/python2.7/dist-packages/openerp-7.0_20140112_001021-py2.7.egg/openerp/osv/osv.py", line 187, in execute_cr
return getattr(object, method)(cr, uid, *args, **kw)
File "/usr/local/lib/python2.7/dist-packages/openerp-7.0_20140112_001021-py2.7.egg/openerp/addons/base_import/models.py", line 219, in parse_preview
fields = self.get_fields(cr, uid, record.res_model, context=context)
File "/usr/local/lib/python2.7/dist-packages/openerp-7.0_20140112_001021-py2.7.egg/openerp/addons/base_import/models.py", line 116, in get_fields
cr, uid, field['relation'], context=context, depth=depth-1)
File "/usr/local/lib/python2.7/dist-packages/openerp-7.0_20140112_001021-py2.7.egg/openerp/addons/base_import/models.py", line 116, in get_fields
cr, uid, field['relation'], context=context, depth=depth-1)
File "/usr/local/lib/python2.7/dist-packages/openerp-7.0_20140112_001021-py2.7.egg/openerp/addons/base_import/models.py", line 103, in get_fields
'string': field['string'],
KeyError: 'string'
我收到此错误,当我以客户形式导入时。此表单继承自res_partner。 这是csv文件。
id,"name"
__export__.res_partner_10,"1"
__export__.res_partner_11,"2"
__export__.res_partner_579,"abrajeethan"
__export__.res_partner_640,"Abu"
__export__.res_partner_584,"ahmekldsgjfmkp"
__export__.res_partner_469,"Anand"
__export__.res_partner_672,"aniasdftha"
__export__.res_partner_49,"Ayantasdfika"
__export__.res_partner_481,"Aasdfyantikr"
当我导入其他表单时,csv格式工作正常。但不是在客户工作。
xml代码:
<record id="extended_view_partner_tree" model="ir.ui.view">
<field name="name">Customers</field>
<field name="model">res.partner</field>
<field name="inherit_id" ref="base.view_partner_tree"/>
<field name="arch" type="xml">
<tree string="Contacts">
<field name="client_id"/>
<field name="clientadded_date"/>
<field name="branch"/>
<field name="phone"/>
<field name="email"/>
</tree>
</field>
</record>
请告诉您如何清除此错误。
答案 0 :(得分:2)
我得到了答案。在models.py文件中的addons / base_import文件夹中。在103行。
我已改为
'string':fields.get('string'),
而不是
'string':fields['string']