2016-06-24 11 views

Antwort

0

Sie sind alle im Wesentlichen die gleichen, der Unterschied ist, dass die Weitergabe von cr und uid in odoo8 veraltet ist, aber diese Variablen sind noch verfügbar für Sie zu verwenden, aber sie sind jetzt als private interne Attribute der Klasse, weshalb sie haben _ vor ihnen nehmen Sie dies zum Beispiel

#old api 
cursor = self._cr 

#new api everything is contained in env (the environment) 
self.env.cr 


#api v7 
def foo(self, cr, uid, ids, context=None): 
    #you can use cr here instead of self._cr because it is explicitly passed to the method 

# api v8 
def foo(self): 
    # you don't need to pass in cr, uid, ids and context 
Verwandte Themen