In a 6 quart heavy bottomed dutch oven or pot, heat 3 tablespoons olive oil on medium heat. Add the sliced onions and stir to coat.
Cook the onions uncovered stirring often, until they have softened. About 15 to 20 minutes.
Increase the heat to medium-high. Add the remaining tablespoon of olive oil and the butter cook stirring often, until the onions start to brown. About 10-15 more minutes.
To the onions add sugar and salt continuing to cook until the onions are a rich golden brown, about 10 to 15 minutes. Add garlic cooking for 1 minute or until fragrant.
Add wine to the pot to deglaze. Scrape any browned bits from bottom and sides of the pot
To the pot add beef stock, bay leaves, thyme and pepper. Bring to a simmer then cover the pot with a lid and cook on medium-low for about 30 minutes.
After 30 minutes uncover adjusting the salt and black pepper to your taste. Remove bay leaves. Add brandy or sherry, if using.
Cheese Toast: Just before serving, preheat oven to 450°F. Line a large sheet pan with parchment paper. Raise oven rack to upper third of oven.
Brush both sides of the French bread lightly olive oil.
Place into the oven and toast until lightly browned, about 5 minutes. Remove from oven, flip and sprinkle with Gruyere cheese and a sprinkling of grated Parmesan.
Return baking sheet to oven for a few minutes longer just until the cheese is bubbly and lightly golden brown.
Serve: Ladle soup into a bowl or soup crock. Top each with one piece of cheese bread. Garnish with fresh thyme or chives.
Serve immediately.