odoo 8 - 缺少错误 - 无法与原型继承建立联系

odoo 8 - missing error - can't create contact with prototype inheritance

我在 odoo 8 中创建合作伙伴时遇到以下错误:

MissingError

One of the documents you are trying to access has been deleted, please try again after refreshing.

HTTP 回溯:

2015-06-09 10:32:37,377 1344 ERROR #db-name# openerp.http: Exception during JSON request handling.
Traceback (most recent call last):
  File "/opt/odoo/openerp/http.py", line 526, in _handle_exception
    return super(JsonRequest, self)._handle_exception(exception)
  File "/opt/odoo/openerp/http.py", line 563, in dispatch
    result = self._call_function(**self.params)
  File "/opt/odoo/openerp/http.py", line 303, 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 300, in checked_call
    return self.endpoint(*a, **kw)
  File "/opt/odoo/openerp/http.py", line 792, in __call__
    return self.method(*args, **kw)
  File "/opt/odoo/openerp/http.py", line 396, in response_wrap
    response = f(*args, **kw)
  File "/opt/odoo/addons/web/controllers/main.py", line 949, in call_kw
    return self._call_kw(model, method, args, kwargs)
  File "/opt/odoo/addons/web/controllers/main.py", line 941, in _call_kw
    return getattr(request.registry.get(model), method)(request.cr, request.uid, *args, **kwargs)
  File "/opt/odoo/openerp/api.py", line 241, in wrapper
    return old_api(self, *args, **kwargs)
  File "/opt/odoo/openerp/api.py", line 336, in old_api
    result = method(recs, *args, **kwargs)
  File "/opt/odoo/openerp/addons/base/res/res_partner.py", line 569, in create
    partner = super(res_partner, self).create(vals)
  File "/opt/odoo/openerp/api.py", line 239, in wrapper
    return new_api(self, *args, **kwargs)
  File "/opt/odoo/openerp/api.py", line 462, in new_api
    result = method(self._model, cr, uid, *args, **kwargs)
  File "/opt/odoo/addons/mail/mail_thread.py", line 377, in create
    thread_id = super(mail_thread, self).create(cr, uid, values, context=context)
  File "/opt/odoo/openerp/api.py", line 241, in wrapper
    return old_api(self, *args, **kwargs)
  File "/opt/odoo/openerp/api.py", line 336, in old_api
    result = method(recs, *args, **kwargs)
  File "/opt/odoo/openerp/models.py", line 4025, in create
    record = self.browse(self._create(old_vals))
  File "/opt/odoo/openerp/api.py", line 239, in wrapper
    return new_api(self, *args, **kwargs)
  File "/opt/odoo/openerp/api.py", line 462, in new_api
    result = method(self._model, cr, uid, *args, **kwargs)
  File "/opt/odoo/openerp/models.py", line 4226, in _create
    self.pool[model_name]._store_set_values(cr, user, ids, fields2, context)
  File "/opt/odoo/openerp/api.py", line 241, in wrapper
    return old_api(self, *args, **kwargs)
  File "/opt/odoo/openerp/models.py", line 4335, in _store_set_values
    result = self._columns[val[0]].get(cr, self, ids, val, SUPERUSER_ID, context=context)
  File "/opt/odoo/openerp/osv/fields.py", line 1361, in get
    result = self._fnct(obj, cr, uid, ids, name, self._arg, context)
  File "/opt/odoo/addons/account_followup/account_followup.py", line 137, in _get_latest
    amls = partner.unreconciled_aml_ids
  File "/opt/odoo/openerp/fields.py", line 765, in __get__
    return record._cache[self]
  File "/opt/odoo/openerp/models.py", line 5852, in __getitem__
    return value.get() if isinstance(value, SpecialValue) else value
  File "/opt/odoo/openerp/fields.py", line 53, in get
    raise self.exception
MissingError: ('MissingError', u'One of the documents you are trying to access has been deleted, please try again after refreshing.')
2015-06-09 10:32:37,379 1344 INFO #db-name# werkzeug: #ip# - - [09/Jun/2015 10:32:37] "POST /web/dataset/call_kw/res.partner/create HTTP/1.1" 200 -

上下文:我开发了一个新模块,想继承res.partner几个模型。我通过从 __init__.py 中取出所有模型来缩小范围,除了这个测试模型:

# -*- coding: utf-8 -*-
from openerp import fields, models

class Testmodel(models.Model):
    _name = 'module_name.testmodel'
    _inherit = 'res.partner'

__openerp__.py.

我也把所有观点都删掉了

看来继承是这个问题的原因。我试图将其更改为 _inherits = {'res.partner': 'partner_id'} 然后错误不再显示,但我不想要那种继承。 我想要的结果是一个包含 res.partner 所有字段的测试模型,但作为数据库中的一个单独模型,就像这张图片中称为 prototype inheritance: https://odoo-80.readthedocs.org/en/latest/reference/orm.html

如果我编辑现有合作伙伴并尝试将现有母公司分配给它,则会出现相同的错误消息。

尝试依赖清单文件中的 res.partner :)

in __openerp__.py
{...
'depends': ["base",],
...
}

我在从 project.task 继承时遇到了类似的问题,结果是一个错误。我通过编辑函数 _hours_get 解决了它(在您的情况下,它将是 _get_latest)。该函数从一个空的数据库查询中访问一个结果,但它没有验证该结果包含的内容。

所以我希望您可以通过更正 _get_latest 中的代码来解决您的问题。