In a large, heavy-bottomed, ovenproof pot, on medium heat, cook the onions with the butter and bacon until tender. Turn the heat up to high and add the garlic, ginger, tomato, spices, and sugar. Stir until vegetables start to lightly caramelize. Add the vinegar, mustard and stock. Stir in the beans. Cover and place in the oven for 1 hour. Remove from oven. The beans should have absorbed a lot of the liquid, if the beans are soupy place on top of the stove and cook over medium heat until the desired consistency is reached. Season, to taste, with salt and pepper.