İçereği Atla
Menü
Bu soru işaretlendi
2 Cevaplar
5619 Görünümler

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,

 

 

Avatar
Vazgeç
Üretici En İyi Yanıt

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

Avatar
Vazgeç
En İyi Yanıt

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.

Avatar
Vazgeç
İlgili Gönderiler Cevaplar Görünümler Aktivite
1
Mar 15
4834
1
Mar 15
5636
1
Mar 15
5633
2
Şub 24
1907
2
Ağu 25
873