Slice the onions as finely as you can. Place the slices in a colander, lightly sprinkling salt on them and separating the segments. Let the onions express their moisture for 15 minutes, then lay them on paper towels and press out their moisture with more paper towels.
Heat the olive oil and butter in a big cast iron pot (cast iron allows even diffusion of the heat, which prevents burning). Add the onion slices, tossing them around to coat them with oil. Keep the heat low - you don't want a sizzling sound as the onions go in. Cover the pot and leave it for 20 minutes. When you uncover it you will find the onions have given up a lot of moisture. Cook them on low, uncovered, for an hour, stirring occasionally.
Add a pinch of sugar to aid caramelisation. As the onions begin to darken and brown, they will need constant stirring. They will reduce a lot in volume.
Once the onions are caramelised and deep red brown, add the beef stock. Simmer in very low for another half hour. Check for seasoning, but it should be salty enough.
Lightly toast the slices of French bread and add a dash of sherry to the soup to lighten it. Ladle the soup into deep bowls, put the bread on top and sprinkle with Gruyere cheese. Melted and slightly brown the cheese under the grill.