odoo 9 AssertionError 在 fs 的记录和字段中断言自我
odoo 9 AssertionError assert self in records and field in fs
当我尝试更新影响计算字段的值时,我收到了这个错误:
Odoo Server Error
Traceback (most recent call last):
File "/Users/abdalla/projects/greenway/odoo-server/openerp/http.py", line 647, in _handle_exception
return super(JsonRequest, self)._handle_exception(exception)
File "/Users/abdalla/projects/greenway/odoo-server/openerp/http.py", line 684, in dispatch
result = self._call_function(**self.params)
File "/Users/abdalla/projects/greenway/odoo-server/openerp/http.py", line 320, in _call_function
return checked_call(self.db, *args, **kwargs)
File "/Users/abdalla/projects/greenway/odoo-server/openerp/service/model.py", line 118, in wrapper
return f(dbname, *args, **kwargs)
File "/Users/abdalla/projects/greenway/odoo-server/openerp/http.py", line 313, in checked_call
result = self.endpoint(*a, **kw)
File "/Users/abdalla/projects/greenway/odoo-server/openerp/http.py", line 963, in call
return self.method(*args, **kw)
File "/Users/abdalla/projects/greenway/odoo-server/openerp/http.py", line 513, in response_wrap
response = f(*args, **kw)
File "/Users/abdalla/projects/greenway/odoo-server/addons/web/controllers/main.py", line 904, in call_kw
return self._call_kw(model, method, args, kwargs)
File "/Users/abdalla/projects/greenway/odoo-server/addons/web/controllers/main.py", line 896, in _call_kw
return getattr(request.registry.get(model), method)(request.cr, request.uid, *args, **kwargs)
File "/Users/abdalla/projects/greenway/odoo-server/openerp/api.py", line 250, in wrapper
return old_api(self, *args, **kwargs)
File "/Users/abdalla/projects/greenway/odoo-server/openerp/api.py", line 381, in old_api
result = method(recs, *args, **kwargs)
File "/Users/abdalla/projects/greenway/odoo-server/openerp/models.py", line 6036, in onchange
record.mapped(field_seq)
File "/Users/abdalla/projects/greenway/odoo-server/openerp/models.py", line 5534, in mapped
recs = recs._mapped_func(operator.itemgetter(name))
File "/Users/abdalla/projects/greenway/odoo-server/openerp/models.py", line 5514, in _mapped_func
vals = [func(rec) for rec in self]
File "/Users/abdalla/projects/greenway/odoo-server/openerp/models.py", line 5752, in getitem
return self._fields[key].get(self, type(self))
File "/Users/abdalla/projects/greenway/odoo-server/openerp/fields.py", line 829, in get
self.determine_value(record)
File "/Users/abdalla/projects/greenway/odoo-server/openerp/fields.py", line 927, in determine_value
record._prefetch_field(self)
File "/Users/abdalla/projects/greenway/odoo-server/openerp/api.py", line 248, in wrapper
return new_api(self, *args, **kwargs)
File "/Users/abdalla/projects/greenway/odoo-server/openerp/models.py", line 3295, in _prefetch_field
assert self in records and field in fs
AssertionError
终于找到问题所在了:
问题是计算字段的方法不存在(我不小心重命名了它)。所以当 odoo 尝试获取这个字段的值时它失败了,并显示这个奇怪的错误
当我尝试更新影响计算字段的值时,我收到了这个错误:
Odoo Server Error Traceback (most recent call last): File "/Users/abdalla/projects/greenway/odoo-server/openerp/http.py", line 647, in _handle_exception return super(JsonRequest, self)._handle_exception(exception) File "/Users/abdalla/projects/greenway/odoo-server/openerp/http.py", line 684, in dispatch result = self._call_function(**self.params) File "/Users/abdalla/projects/greenway/odoo-server/openerp/http.py", line 320, in _call_function return checked_call(self.db, *args, **kwargs) File "/Users/abdalla/projects/greenway/odoo-server/openerp/service/model.py", line 118, in wrapper return f(dbname, *args, **kwargs) File "/Users/abdalla/projects/greenway/odoo-server/openerp/http.py", line 313, in checked_call result = self.endpoint(*a, **kw) File "/Users/abdalla/projects/greenway/odoo-server/openerp/http.py", line 963, in call return self.method(*args, **kw) File "/Users/abdalla/projects/greenway/odoo-server/openerp/http.py", line 513, in response_wrap response = f(*args, **kw) File "/Users/abdalla/projects/greenway/odoo-server/addons/web/controllers/main.py", line 904, in call_kw return self._call_kw(model, method, args, kwargs) File "/Users/abdalla/projects/greenway/odoo-server/addons/web/controllers/main.py", line 896, in _call_kw return getattr(request.registry.get(model), method)(request.cr, request.uid, *args, **kwargs) File "/Users/abdalla/projects/greenway/odoo-server/openerp/api.py", line 250, in wrapper return old_api(self, *args, **kwargs) File "/Users/abdalla/projects/greenway/odoo-server/openerp/api.py", line 381, in old_api result = method(recs, *args, **kwargs) File "/Users/abdalla/projects/greenway/odoo-server/openerp/models.py", line 6036, in onchange record.mapped(field_seq) File "/Users/abdalla/projects/greenway/odoo-server/openerp/models.py", line 5534, in mapped recs = recs._mapped_func(operator.itemgetter(name)) File "/Users/abdalla/projects/greenway/odoo-server/openerp/models.py", line 5514, in _mapped_func vals = [func(rec) for rec in self] File "/Users/abdalla/projects/greenway/odoo-server/openerp/models.py", line 5752, in getitem return self._fields[key].get(self, type(self)) File "/Users/abdalla/projects/greenway/odoo-server/openerp/fields.py", line 829, in get self.determine_value(record) File "/Users/abdalla/projects/greenway/odoo-server/openerp/fields.py", line 927, in determine_value record._prefetch_field(self) File "/Users/abdalla/projects/greenway/odoo-server/openerp/api.py", line 248, in wrapper return new_api(self, *args, **kwargs) File "/Users/abdalla/projects/greenway/odoo-server/openerp/models.py", line 3295, in _prefetch_field assert self in records and field in fs AssertionError
终于找到问题所在了: 问题是计算字段的方法不存在(我不小心重命名了它)。所以当 odoo 尝试获取这个字段的值时它失败了,并显示这个奇怪的错误