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

Hello every one,

i want check a lead type is 'lead' or 'opportunity'? from crm_lead table.

here is my code,

def _check_lead(self, cr, uid, ids, fields, args, context=None):
            for lead in self.browse(cr, uid, ids, type, context=context):

                if lead.type == 'lead':

                    print "type is lead"

                else:

                    print "type is opportunity"

please correct my code,

 

thanks in advance,

 

 

아바타
취소
작성자 베스트 답변

You should always use browse() and not read() It has a better performance and his object oriented.

아바타
취소
베스트 답변

If you will still use browse as intended, then remove the 'type' argument from the call, as well as the context, i.e.:

for lead in self.browse(cr, uid, ids):

[EDIT]

@Fabien: I have removed the read. Apparantly the difference is now negligible.

아바타
취소
관련 게시물 답글 화면 활동
1
3월 15
4899
1
3월 15
5705
1
3월 15
5744
2
2월 24
1982
2
8월 25
952