我不明白为什么会发生这种情况,因为错误显示对象或函数不可迭代,而且此错误来自基本文件而非来自任何自定义模块,错误显示它是pythonic。
这是错误追溯。
Traceback (most recent call last):
File "/home/viraj/workspace/pansuriya/odoo_v8/openerp/http.py", line 537, in _handle_exception
return super(JsonRequest, self)._handle_exception(exception)
File "/home/viraj/workspace/pansuriya/odoo_v8/openerp/http.py", line 574, in dispatch
result = self._call_function(**self.params)
File "/home/viraj/workspace/pansuriya/odoo_v8/openerp/http.py", line 310, in _call_function
return checked_call(self.db, *args, **kwargs)
File "/home/viraj/workspace/pansuriya/odoo_v8/openerp/service/model.py", line 118, in wrapper
return f(dbname, *args, **kwargs)
File "/home/viraj/workspace/pansuriya/odoo_v8/openerp/http.py", line 307, in checked_call
return self.endpoint(*a, **kw)
File "/home/viraj/workspace/pansuriya/odoo_v8/openerp/http.py", line 803, in __call__
return self.method(*args, **kw)
File "/home/viraj/workspace/pansuriya/odoo_v8/openerp/http.py", line 403, in response_wrap
response = f(*args, **kw)
File "/home/viraj/workspace/pansuriya/odoo_v8/addons/web/controllers/main.py", line 944, in call_kw
return self._call_kw(model, method, args, kwargs)
File "/home/viraj/workspace/pansuriya/odoo_v8/addons/web/controllers/main.py", line 936, in _call_kw
return getattr(request.registry.get(model), method)(request.cr, request.uid, *args, **kwargs)
File "/home/viraj/workspace/pansuriya/odoo_v8/openerp/api.py", line 250, in wrapper
return old_api(self, *args, **kwargs)
File "/home/viraj/workspace/pansuriya/odoo_v8/addons/account_check_writing/account_voucher.py", line 93, in create
return super(account_voucher, self).create(cr, uid, vals, context=context)
File "/home/viraj/workspace/pansuriya/odoo_v8/openerp/api.py", line 250, in wrapper
return old_api(self, *args, **kwargs)
File "/home/viraj/workspace/pansuriya/odoo_v8/addons/mail/mail_thread.py", line 381, in create
thread_id = super(mail_thread, self).create(cr, uid, values, context=context)
File "/home/viraj/workspace/pansuriya/odoo_v8/openerp/api.py", line 250, in wrapper
return old_api(self, *args, **kwargs)
File "/home/viraj/workspace/pansuriya/odoo_v8/openerp/api.py", line 345, in old_api
result = method(recs, *args, **kwargs)
File "/home/viraj/workspace/pansuriya/odoo_v8/openerp/models.py", line 4092, in create
record = self.browse(self._create(old_vals))
File "/home/viraj/workspace/pansuriya/odoo_v8/openerp/api.py", line 248, in wrapper
return new_api(self, *args, **kwargs)
File "/home/viraj/workspace/pansuriya/odoo_v8/openerp/api.py", line 481, in new_api
result = method(self._model, cr, uid, *args, **kwargs)
File "/home/viraj/workspace/pansuriya/odoo_v8/openerp/models.py", line 4191, in _create
updates.append((field, '%s', current_field._symbol_set[1](vals[field])))
File "/home/viraj/workspace/pansuriya/odoo_v8/openerp/osv/fields.py", line 409, in <lambda>
self._symbol_f = lambda x: _symbol_set_float(self, x)
File "/home/viraj/workspace/pansuriya/odoo_v8/openerp/osv/fields.py", line 386, in _symbol_set_float
precision, scale = digits
TypeError: 'function' object is not iterable
根据代码,应该调用 account_voucher 模型的 button_proforma_voucher 方法,但是控件确实会出现,并且之前会出现错误。
答案 0 :(得分:2)
十进制精度定义存在问题 digits_compute 正在运行,而数字在旧api代码中无法使用float字段。
之所以发生这种情况,是因为我之前在github上为v8提取了最新代码,但是没有使用最新代码,所以我需要更新该字段定义。
import openerp.addons.decimal_precision as dp
_columns = {
'currency_rate' : fields.float(digits_compute=dp.get_precision( 'Account' ), string='Currency Rate' ),
}