Cut the margarine in small pieces and mix it together with the flour by using your fingers. Add the sugar, vanilla sugar and eggs and mix it all well to a dough.
Roll out the dough and cover a pie forms bottom and edges with it. Cut away the rest of it. Place the pie form and the rest of the dough in the fridge for 30 minutes.
Preheat the oven with electrical heat at 180 degrees Celsius.
Pour the milk in a casserole and heat it up on low heat until it reaches boiling point.
Mix the egg yellows and the sugar with an electrical mixer, add the hazelnut flour while stirring.
Add the boiling hot milk in the flour mixture and stir together. Pour the mixture in the casserole and heat up while stirring, continue until the mixture is thick.
Remove the casserole from the stow and add the chocolate in small pieces and stir until the chocolate is melted.
Let the mixture cool down, and then add the ricotta cheese while stirring.
Pour the filling in the pie form.
Roll out the rest of the dough and cut it in thin stripes, and place it on top of the filling to make a square pattern, or make any other decoration you like by using the dough.
Place the pie in the middle of the oven for 35 minutes. Take out the pie and let it cool down, then place it in the fridge for minimum 2 hours before serving it.