2016-12-23 9 views
1
내 코드

:기능이 필드를 칸반보기에서 제대로 작동하지

def get_score(self, cr, uid, ids, context={}, arg=None,obj=None): 
    result = {} 
    for f in self.browse(cr, uid,ids): 
     net_score = float(f.earn_score.f.availed_score) 
     result[f.id] = net_score 
    return result 

'net_score': fields.function(get_score, method=True, string='Net Score',type='float'), 

이 방법은 폼보기에서 잘 작동은 모든 선수에 대한 올바른 순 점수를 보여,하지만 난 간판보기에서 같은 필드를 표시 할 때, Kanban보기에 표시된 모든 플레이어에 대해 net_score를 합산하여 모두에 대해 동일한 누적 점수를 표시합니다.

Kanban의 모든 플레이어에 대해 net_hours을 표시하려면 어떻게해야합니까? net_score = 플로트 (f.earn_score.f.availed_score)

내가 잘 모르겠어요하지만 그것이 있어야 희망 : 나는 내가 한 실수가 발견 된 코드를 통해 갔다

+0

결과 [f.id] = net_score을 – Shahid

답변

0

net_score = 플로트 (f.earn_score + f.availed_score)

그리고 당신이 아래의 코드를 시도 할 수 있습니다 칸반의 순 점수뿐만 아니라 다른 뷰 보여줄 수 :

def get_score(self, cr, uid, ids, context={}, arg=None,obj=None): 
    result = {} 
    for f in ids: 
     curr_obj = self.browse(cr,uid,f) 
     net_score = float(curr_obj.earn_score + curr_obj.availed_score) 
     result[f] = net_score 
    return result