This question has been flagged
1 Reply
1693 Views

Using: Community v11.0

Issue: I have broken access to the modules that use the partner/contact Model after attempting to add External ID of a customer as a new Field to the Contact model.

What I am seeing: Any time when trying to access Sales or Purchases I get a Server Error.  I have copied the output to the bottom of this page.

What I did to cause this issue: I was trying to add a new field in Developer Mode.  In particular I was attempting to follow the details on this following thread:

https://www.odoo.com/forum/help-1/question/how-can-i-show-a-record-s-external-id-in-a-list-view-i-also-want-users-to-be-able-to-search-for-records-using-this-field-146080

I was attempting to add a new field that would reference the External ID of the customer.  I followed the example using 'Contact' as the Model instead of what was shown 'View'.  When I originally got an error for not having filled out the Dependency field, I used 'id'.  The image I've attached shows what I input.  As soon as I attempted to save this - it failed and I began getting the above errors.

What I have tried to do: I have searched for that field (in case it was created) in order to delete it - but can't find anything that looks like it in the list of fields.  I don't know what else to do - I just want to undo what I did with the field creation dialog.  I've also looked at the error output - but I'm not seeing anything that is indicates where I have to go to fix the issue.

What I inputted to cause the issue:

Just want to get back to where the system was before I made this mistake.  Any help provided is greatly appreciated!

Here is a sample of the error output I get when clicking on the Sales module link:

 

 

 

 

 

Avatar
Discard
Author Best Answer

** Failed to get this in the original message **

Error Message:

Error:
Odoo Server Error

Traceback (most recent call last):
  File "/odoo/odoo-server/odoo/fields.py", line 937, in __get__
    value = record.env.cache.get(record, self)
  File "/odoo/odoo-server/odoo/api.py", line 960, in get
    value = self._data[field][record.id][key]
KeyError: <odoo.api.Environment object at 0x7f7bf99a9c18>

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/odoo/odoo-server/odoo/http.py", line 650, in _handle_exception
    return super(JsonRequest, self)._handle_exception(exception)
  File "/odoo/odoo-server/odoo/http.py", line 310, in _handle_exception
    raise pycompat.reraise(type(exception), exception, sys.exc_info()[2])
  File "/odoo/odoo-server/odoo/tools/pycompat.py", line 87, in reraise
    raise value
  File "/odoo/odoo-server/odoo/http.py", line 692, in dispatch
    result = self._call_function(**self.params)
  File "/odoo/odoo-server/odoo/http.py", line 342, in _call_function
    return checked_call(self.db, *args, **kwargs)
  File "/odoo/odoo-server/odoo/service/model.py", line 97, in wrapper
    return f(dbname, *args, **kwargs)
  File "/odoo/odoo-server/odoo/http.py", line 335, in checked_call
    result = self.endpoint(*a, **kw)
  File "/odoo/odoo-server/odoo/http.py", line 936, in __call__
    return self.method(*args, **kw)
  File "/odoo/odoo-server/odoo/http.py", line 515, in response_wrap
    response = f(*args, **kw)
  File "/odoo/odoo-server/addons/web/controllers/main.py", line 934, in call_kw
    return self._call_kw(model, method, args, kwargs)
  File "/odoo/odoo-server/addons/web/controllers/main.py", line 926, in _call_kw
    return call_kw(request.env[model], method, args, kwargs)
  File "/odoo/odoo-server/odoo/api.py", line 689, in call_kw
    return call_kw_multi(method, model, args, kwargs)
  File "/odoo/odoo-server/odoo/api.py", line 680, in call_kw_multi
    result = method(recs, *args, **kwargs)
  File "/odoo/odoo-server/odoo/models.py", line 2601, in read
    values[name] = field.convert_to_read(record[name], record, use_name_get)
  File "/odoo/odoo-server/odoo/fields.py", line 2000, in convert_to_read
    return (value.id, value.sudo().display_name)
  File "/odoo/odoo-server/odoo/fields.py", line 941, in __get__
    self.determine_value(record)
  File "/odoo/odoo-server/odoo/fields.py", line 1052, in determine_value
    self.compute_value(recs)
  File "/odoo/odoo-server/odoo/fields.py", line 1005, in compute_value
    fields = records._field_computed[self]
KeyError: account.payment.term.display_name

What I was adding in the Fields / New:

Field Name: x_xml_id

Field Label: External ID  / Field Type: Char

Dependencies: id

Compute:

res = self.get_external_id()

for record in self:

       record['x_xml_id'] = res.get(record.id)

Avatar
Discard