Put the onions, oil, garlic and half the thyme leaves into a large pan and set over a medium-high heat. Sauté for 8 minutes, stirring frequently, until the onions are softened, taking care not to let them brown.
Stir in the squash, carrots, mushrooms and flour and fry for another 3-4 minutes, stirring constantly.
Add the stock, lentils and soy sauce and bring to a boil. Reduce the heat and simmer for 25-30 minutes, stirring now and again, until the lentils are soft and the vegetables are almost tender. Season to taste.
Preheat the oven to 200C, fan 180C, gas mark 6.
Bring a large pan of salted water to the boil and cook the sweet potato slices for 3 minutes. Drain thoroughly and lay out on a board.
Transfer the vegetable mixture into a large casserole dish and lay the sweet potato slices on top. Drizzle over some olive oil and scatter over the remaining thyme leaves. Season well and bake for 30-40 minutes, until golden on top and all the vegetables are tender.
Serve with a salad or some greens.
