Hello, I changed the code in the /server/bin/osv/fields.py and solved my problem
this was the function I changed:
def _fnct_read(self, obj, cr, uid, ids, field_name, args, context=None): self._field_get2(cr, uid, obj, context)
if not ids: return {}
relation = obj._name
res = {}.fromkeys(ids, False)
objlst = obj.browse(cr, uid, ids)
for data in objlst:
if not data: continue
t_data = data relation = obj._name
for i in range(len(self.arg)): field_detail = self._relations[i] relation = field_detail['object'] try: if not t_data[self.arg[i]]: t_data = False break except: t_data = False break
# Modificado por AMA para resolver o bug em que o one 2 many em related aparece apenas o ultimo valor
if field_detail['type'] in ('one2many', 'many2many'): all_t_data = t_data[self.arg[i]] t_data_list=[] for t_data in all_t_data: t_data_list.append(t_data.id) else: t_data = t_data[self.arg[i]]
if type(t_data) == type(objlst[0]) and field_detail['type'] not in ('one2many', 'many2many'): res[data.id] = t_data.id
else: res[data.id] = t_data
if field_detail['type'] in ('one2many', 'many2many'):
if type(t_data) == type(objlst[0]): res[data.id] = t_data_list else: res[data.id] = t_data
if self._type=='many2one':
ids = filter(None, res.values())
if ids:
ng = dict(obj.pool.get(self._obj).name_get(cr, uid, ids, context=context))
for r in res: if res[r]: res[r] = (res[r], ng[res[r]])
return res
Hello, I changed the code in the /server/ bin/osv/ fields. py and solved my problem
this was the function I changed:
def _fnct_read(self, obj, cr, uid, ids, field_name, args, context=None):
self._ field_get2( cr, uid, obj, context)
continue
relation = obj._name self.arg) ):
field_ detail = self._relations[i]
relation = field_detail[ 'object' ]
try:
if not t_data[ self.arg[ i]]:
t_data = False
break
except:
t_ data = False
break 'type'] in ('one2many', 'many2many'):
all_ t_data = t_data[self.arg[i]]
t_ data_list= []
for t_data in all_t_data:
t_data_ list.append( t_data. id)
else:
t_ data = t_data[self.arg[i]]
if not ids: return {}
relation = obj._name
res = {}.fromkeys(ids, False)
objlst = obj.browse(cr, uid, ids)
for data in objlst:
if not data:
t_data = data
for i in range(len(
# Modificado por AMA para resolver o bug em que o one 2 many em related aparece apenas o ultimo valor
if field_detail[
if type(t_data) == type(objlst[0]) and field_detail[ 'type'] not in ('one2many', 'many2many'):
res[data. id] = t_data.id
res[data. id] = t_data
else:
if field_detail[ 'type'] in ('one2many', 'many2many'):
res[ data.id] = t_data_list
else:
res[ data.id] = t_data
if type(t_data) == type(objlst[0]):
if self._type= ='many2one' : pool.get( self._obj) .name_get( cr, uid, ids, context=context))
if res[r]:
res[ r] = (res[r], ng[res[r]])
ids = filter(None, res.values())
if ids:
ng = dict(obj.
for r in res:
return res