Grease the baking dish with 1 tsp of vegetable oil.
Boil the potatoes in a saucepan with lightly salted boiling water for about 8 minutes or until cooked and just tender (be careful not to overcook the potatoes or they'll begin to fall apart). Once the potatoes are tender, drain and set aside.
Meanwhile, add 1 tablespoon margarine or butter and 1 tbsp oil to a saucepan over a medium heat. Gently fry the fennel and onion, stirring occasionally, for 10-15 minutes, or until soft.
Add layers of the cooked potatoes and the cooked fennel and onion to the baking dish. Season each layer with a little salt and pepper and repeat, finishing with a layer of the fennel and onion on top.
To make the roux sauce, melt 2 tablespoons of margarine or butter in a saucepan over a medium heat, then mix in the flour whilst stirring continuously. Pour a little milk into the mixture and work into a smooth paste. Continue to add small quantities of milk until the smooth paste becomes thick and creamy. Pour in the remaining milk and half the gruyere cheese, stir well until the cheese has melted. Season to taste.
Preheat the grill to a high temperature.
Pour the sauce over the potato and fennel. Sprinkle the remaining cheese evenly over the potato. Transfer to the grill and cook until the top is golden and bubbly.