Pre-heat the oven to 180°C.
Heat a large, heavy-based saucepan over a moderate heat and saute pancetta, stirring occasionally, for 3-4 minutes until just coloured. Remove and drain on kitchen paper. Add the onion to the pan with half the olive oil and sweat over a reduced heat for 4-5 minutes, stirring occasionally.
Meanwhile, rub the base and sides of a 30cm x 15cm oval, ceramic baking dish with the rest of the olive oil. Layer the potato slices evenly (seasoning well between layers) in the base and top with the pancetta and onions. Sprinkle over the chopped parsley and reserve to one side.
Melt the butter in a medium saucepan over a medium heat, then whisk in the flour to create a smooth roux. Cook for 1-2 minutes, whisking occasionally, then whisk in the milk in a slow, steady stream until you have a thickened sauce. Simmer for 4-5 minutes, whisking occasionally. Season to taste and then pour over the potatoes and onions in the dish.
Roll the pastry out to a large coval with thickness of 1cm roughly so that it will line the top of the pie. Transfer carefully to the dish, folding and tucking to make it fit. Trim any overhanging pastry and use to decorate the top of the pie. Brush all over with the beaten egg and make a small slit in the centre to allow steam to escape while baking.
Bake for 40-50 minutes until the pastry is golden brown and glazed and the filling is cooked and piping hot. Remove and allow to cool for 5 minutes before serving from the dish.
For top tips on protecting you and your family when preparing raw meat and poultry, visit Food Safety in the Home and view the full Food safety at home video.