創建 'LINE_NO' 當我更新的價值,它拋出了KeyError異常列:40field.function - KeyError異常:40
我的代碼:
def _get_line_no(self, cr, uid, ids, line_no, arg, context=None):
res = {}
for record in self.browse(cr, uid, ids, context=context):
nextno =0
no = record.next_line_no
next_no = nextno + no
total =+ next_no
res={
'next_line_no':next_no,
'line_no': total
}
return res
_columns = {
'line_no':fields.function(_get_line_no,string='Line No',type='integer'),
'next_line_no':fields.integer(' Next Line No'),
}
_defaults = {
'next_line_no':1
}
拋出錯誤:KeyError異常:40
我該如何解決?
它的工作原理,更正代碼總數+ = next_no – 3156938
@dhana真棒! :) –
@AtulArvind謝謝請給+1,所以它是有用的所有用戶 – dhana