0
필드 기능에 오류가 있습니다. 내 함수에서, 내 변수 total
에서 float 값을 반환하고 싶습니다. 그리고 나는 이미 그것을 찾았고 대답은 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}
도와주세요.