콘텐츠로 건너뛰기
메뉴
커뮤니티에 참여하려면 회원 가입을 하시기 바랍니다.
신고된 질문입니다
3 답글
12959 화면

In the below fuction I want to update  "account_bank_statement" table field balance_end_real with the vale balance_end. i.e "update account.bank.statement set balance_end_real=balance_end where id=ids"

 

"def _compute_difference(self, cr, uid, ids, fieldnames, args, context=None):
        result =  dict.fromkeys(ids, 0.0)

        for obj in self.browse(cr, uid, ids, context=context):
            
            result[obj.id] = obj.balance_end_real - obj.balance_end

        return result  "

 

아바타
취소
베스트 답변

It seems that balance_end_real field already in the same model (or inherited) with the method you defined. In that case you don't need to use update sql manually, just use write method.

self.write(cr, uid, ids, {'balance_end_real': obj.balance_end}, context=context)

 

아바타
취소
작성자

Thank you very much. This is the best answer

베스트 답변

Hi,

You can use "cr.execute" to update record based on id. Refer the following example:

cr.execute('update account_period set state=%s where id=%s', (mode, id))

아바타
취소
베스트 답변

Use "cr.execute" and update directly using sql update statement...

아바타
취소
관련 게시물 답글 화면 활동
0
9월 23
6448
1
7월 20
5195
0
12월 23
8326
0
3월 15
3411
0
3월 15
3711