Briefly pour hot water over the onions and then quench with cold water. This way, small onions can be peeled effortlessly.
Heat the olive oil in a frying pan. Fry the whole onions until golden.
Add sherry and sherry vinegar. Stir in 1/4 l of water and the spices. Season everything with salt and sugar. Cover and cook the onions over low heat for about 30 minutes, then let them cool in the broth. Refrigerate until ready to serve.