python - Strange super () return behaviour when using a temp variable to store the super return value -


pythionans

why these 2 functions return different value when using temp return result?

i have never seen behaviour before , need understand why. clues or ideas?

def _store_get_values(self, cr, uid, ids, fields, context=none):     return super(pai, self)._store_get_values(cr, uid,  ids, fields, context) 

returns

[(10, 'pai', [13484l], ['line_next_approver_id', 'next_approver_id', 'line_id', 'partner_id'])]

and

def _store_get_values(self, cr, uid, ids, fields, context=none):     result = super(pai, self)._store_get_values(cr, uid, ids, fields, context)     return result 

returns

[(10, 'pai', [13485l], ['line_id', 'next_approver_id', 'partner_id', 'line_next_approver_id'])]

i have in openerp/odoo framework. believe has nothing framework logic python ways

from sourcecodebrowser.com:

02486     def _store_get_values(self, cr, uid, ids, fields, context): 02487         result = {} 02488         fncts = self.pool._store_function.get(self._name, []) 02489         fnct in range(len(fncts)): 02490             result.setdefault(fncts[fnct][0], {}) 02491             ids2 = fncts[fnct][2](self,cr, uid, ids, context) 02492             id in filter(none, ids2): 02493                 result[fncts[fnct][0]].setdefault(id, []) 02494                 result[fncts[fnct][0]][id].append(fnct) 02495         result2 = [] 02496         object in result: 02497             k2 = {} 02498             id,fnct in result[object].items(): 02499                 k2.setdefault(tuple(fnct), []) 02500                 k2[tuple(fnct)].append(id) 02501             fnct,id in k2.items(): 02502                 result2.append((fncts[fnct[0]][4],object,id,map(lambda x: fncts[x][1], fnct))) 02503         result2.sort() 02504         return result2 

this code seems result of code golf challenge, however... result2.append(...) line producing result. let's take closer @ it:

result2.append((     fncts[fnct[0]][4],     object,     id,     map(lambda x: fncts[x][1], fnct) )) 

the result of map() list giving problems. order of items returned map() depends on order of items in fnct.

what fnct? comes k2. k2 generated result[object]. result generated ids2. ids2 result of call fncts[fnct][2]. fncts taken self.pool._store_function.

so, @ source of _store_function , you'll find answer.


Comments

Popular posts from this blog

sublimetext3 - what keyboard shortcut is to comment/uncomment for this script tag in sublime -

java - No use of nillable="0" in SOAP Webservice -

ubuntu - Laravel 5.2 quickstart guide gives Not Found Error -