odoo / odoo

Odoo. Open Source Apps To Grow Your Business.
https://www.odoo.com
Other
38.8k stars 25.14k forks source link

[8.0] KeyError: 'display_name' when trying to import opportunities #1050

Closed hiaz closed 10 years ago

hiaz commented 10 years ago

Hello,

when I try to import opportunities then i get this error immediately:

2014-07-09 19:25:36,439 26483 INFO db openerp.addons.base_import.models: importing 1 rows...
2014-07-09 19:25:36,452 26483 ERROR db openerp.http: Exception during JSON request handling.
Traceback (most recent call last):
  File "/opt/openerp/server/openerp/http.py", line 476, in _handle_exception
    return super(JsonRequest, self)._handle_exception(exception)
  File "/opt/openerp/server/openerp/http.py", line 495, in dispatch
    result = self._call_function(**self.params)
  File "/opt/openerp/server/openerp/http.py", line 311, in _call_function
    return checked_call(self.db, *args, **kwargs)
  File "/opt/openerp/server/openerp/service/model.py", line 113, in wrapper
    return f(dbname, *args, **kwargs)
  File "/opt/openerp/server/openerp/http.py", line 308, in checked_call
    return self.endpoint(*a, **kw)
  File "/opt/openerp/server/openerp/http.py", line 685, in __call__
    return self.method(*args, **kw)
  File "/opt/openerp/server/openerp/http.py", line 360, in response_wrap
    response = f(*args, **kw)
  File "/opt/openerp/server/addons/web/controllers/main.py", line 983, in call_kw
    return self._call_kw(model, method, args, kwargs)
  File "/opt/openerp/server/addons/web/controllers/main.py", line 975, in _call_kw
    return getattr(request.registry.get(model), method)(request.cr, request.uid, *args, **kwargs)
  File "/opt/openerp/server/openerp/api.py", line 204, in wrapper
    return old_api(self, *args, **kwargs)
  File "/opt/openerp/server/addons/base_import/models.py", line 327, in do
    cr, uid, import_fields, data, context=context)
  File "/opt/openerp/server/openerp/api.py", line 204, in wrapper
    return old_api(self, *args, **kwargs)
  File "/opt/openerp/server/openerp/models.py", line 1060, in load
    context=context, log=messages.append):
  File "/opt/openerp/server/openerp/models.py", line 1200, in _convert_records
    for record, extras in stream:
  File "/opt/openerp/server/openerp/tools/misc.py", line 1126, in next
    val = next(self.stream, _ph)
  File "/opt/openerp/server/openerp/models.py", line 1117, in _extract_records
    if columns[field[0]]._type == 'one2many'])
KeyError: 'display_name'

Importing customers, etc. works.

Thank you! hiaz

engelant commented 10 years ago

same for me, but in my case product categories are affected:

2014-07-10 09:42:49,104 7149 INFO DRFimport openerp.addons.base_import.models: importing 40 rows...
2014-07-10 09:42:49,109 7149 ERROR DRFimport openerp.http: Exception during JSON request handling.
Traceback (most recent call last):
  File "/opt/odoo/openerp/http.py", line 476, in _handle_exception
    return super(JsonRequest, self)._handle_exception(exception)
  File "/opt/odoo/openerp/http.py", line 495, in dispatch
    result = self._call_function(**self.params)
  File "/opt/odoo/openerp/http.py", line 311, in _call_function
    return checked_call(self.db, *args, **kwargs)
  File "/opt/odoo/openerp/service/model.py", line 113, in wrapper
    return f(dbname, *args, **kwargs)
  File "/opt/odoo/openerp/http.py", line 308, in checked_call
    return self.endpoint(*a, **kw)
  File "/opt/odoo/openerp/http.py", line 685, in __call__
    return self.method(*args, **kw)
  File "/opt/odoo/openerp/http.py", line 360, in response_wrap
    response = f(*args, **kw)
  File "/opt/odoo/addons/web/controllers/main.py", line 983, in call_kw
    return self._call_kw(model, method, args, kwargs)
  File "/opt/odoo/addons/web/controllers/main.py", line 975, in _call_kw
    return getattr(request.registry.get(model), method)(request.cr, request.uid, *args, **kwargs)
  File "/opt/odoo/openerp/api.py", line 204, in wrapper
    return old_api(self, *args, **kwargs)
  File "/opt/odoo/addons/base_import/models.py", line 327, in do
    cr, uid, import_fields, data, context=context)
  File "/opt/odoo/openerp/api.py", line 204, in wrapper
    return old_api(self, *args, **kwargs)
  File "/opt/odoo/openerp/models.py", line 1060, in load
    context=context, log=messages.append):
  File "/opt/odoo/openerp/models.py", line 1200, in _convert_records
    for record, extras in stream:
  File "/opt/odoo/openerp/tools/misc.py", line 1126, in next
    val = next(self.stream, _ph)
  File "/opt/odoo/openerp/models.py", line 1117, in _extract_records
    if columns[field[0]]._type == 'one2many'])
KeyError: 'display_name'
engelant commented 10 years ago

It seems that the automatic import field assignment does not work as expected, since I have the option to chose the field "Name" twice. Changing it to the second "Name" entry makes importing possible.

hiaz commented 10 years ago

In my case there is only one field called "Name" but if I skipt to import the field then i get:

"Missing required value for the field 'Subject' (name)"

Then I change the import field to 'Subject' and everything seems to be ok.

Maybe the naming changed or is broken?

lukebranch commented 10 years ago

I've got the same issue here. Here's a snippet from the traceback in the logs:

KeyError: 'display_name' 2014-07-11 04:52:32,047 1286 INFO WETTI openerp.addons.base_import.models: importing 1399 rows... 2014-07-11 04:52:32,063 1286 ERROR WETTI openerp.http: Exception during JSON request handling.

and another different error from an earlier attempt:

2014-07-11 04:50:20,922 1286 INFO WETTI openerp.service.model: SERIALIZATION_FAILURE, retry 1/5 in 0.7434 sec... 2014-07-11 04:52:30,369 1286 INFO WETTI openerp.addons.base_import.models: importing 1399 rows... 2014-07-11 04:52:30,384 1286 ERROR WETTI openerp.http: Exception during JSON request handling.

jjscarafia commented 10 years ago

Same error to me

mcassuto commented 10 years ago

Same issue when importing hr_employee, there is 2 fieds 'name'; choosing the second one, allowed the import.

mart-e commented 10 years ago

Hello,

display_name issues have been fixed at rev f138aa2, you should no longer have this issue with updated code