Melt butter with 1 tablespoon olive oil in a large Dutch oven over medium-low heat. Add onions and salt, toss well, cover, and cook for 12 to 15 minutes until softened.
Remove the lid, add sugar, and increase heat to medium. Cook for 35 to 45 minutes, stirring more often as the onions darken, until evenly deep golden brown. Add a splash of water if the fond begins to scorch.
Stir in garlic for 30 seconds. Sprinkle flour over the onions and cook, stirring continuously, for 2 minutes.
Pour in the white wine and scrape up the browned bits. Simmer for 3 to 4 minutes until slightly reduced.
Add beef stock, thyme, bay leaf, pepper, and Worcestershire. Bring to a gentle boil, reduce heat, and simmer uncovered for 25 to 30 minutes. Remove herbs, stir in optional sherry, and adjust salt.
Heat oven to 400°F (200°C). Brush baguette slices with the remaining olive oil and toast for 6 to 8 minutes per side until dry and golden.
Place oven-safe crocks on a rimmed baking sheet. Fill with hot soup, top each with two baguette slices, then cover with Gruyère and Parmesan.
Broil about 6 inches from the heat for 2 to 4 minutes, watching constantly, until the cheese bubbles and browns. Rest for 5 minutes before serving.