0
我的字段功能中出现错误。 在我的函数中,我想从我的变量total
返回一个浮点值。而且我已经搜索了它,并且我找到了一个答案here但我仍然不明白这个解释。 这是我的错误。如何在Odoo中使用字段功能返回字典
ValueError: dictionary update sequence element #0 has length 1; 2 is required
这是我的代码。
@api.multi
@api.depends('total_eec', 'total_tec')
def _consumption_actual_value(self):
res = {}
total = 0.0
for i in self:
total = i.total_eec + i.total_tec
res[i.id] = total
return res
_columns = {'consumption_actual': fields.function(_consumption_actual_value, string='Consumption (kWh) Actual'), # TEC + EEC}
请帮忙。