Saute sliced onion for 2-3 minutes. Wipe the legs and dust them in the flour. Shake them to drop excess flour. Remove the onions from the pan and put them in a clay pot.
In the same oil fry the thighs until browned on all sides. Preheat oven to 356°F (180°C). Put the fried onions on the legs. Spread chopped potatoes around them, along with tomatoes and celery. Sprinkle with parsley and thyme.
Return to the oven and bake for another 15-20 minutes.