Heat the oven to 350°. Heat the oil in a large skillet over medium heat. Add the potatoes, brown them on both sides, then transfer them to a separate dish. In the same pan, cook the butter and onions until soft and slightly browned, about 5 to 6 minutes.
Coat a large, shallow baking dish with butter. Add the potatoes and onions in alternating layers, making sure to finish with a layer of potatoes. Warm the stock and pour it over the potatoes. Cover the dish with foil and bake it for 40 minutes. Remove the foil and bake for another 10 minutes or until the potatoes are crispy on top. To serve, cut the casserole into squares.