def get_and_group_by_field(cr, uid, obj, ids, field, context=None):
 res = {}
 for record in obj.read(cr, uid, ids, [field], context=context):
  key = record[field]
  res.setdefault((key[0] if isinstance(key, tuple) else key), []).append(record['id'])
 return res

def get_and_group_by_field ( cr , uid , obj , ids , field , context = None ) : res = { } for record in obj . read ( cr , uid , ids , [ field ] , context = context ) : key = record [ field ] res . setdefault ( ( key [ 0 ] if isinstance ( key , tuple ) else key ) , [ ] ) . append ( record [ 'id' ] ) return res
read the values of field´´ for the given ids´´ and group ids by value .