Grease a round casserole dish (24 cm Ø; 7 cm high). Heat sugar with 200 ml water in a pan. Leave to simmer until the sugar caramelises to a golden yellow. Pour evenly onto the bottom of the mould. Let it cool down. Mix sweetened condensed milk, 400 ml milk and 8 eggs. Pour into the mould.
Fill the fat pan of the oven to about 2/3 with hot water. Put the mould in. Let it stand in the preheated oven (electric cooker: 175 °C/ circulating air: 150 °C/ gas: see manufacturer) for approx. 50 minutes.
About 15 minutes before the end of the cooking time, chop the chocolate and melt it over a warm water bath. Stir in oil. Mix flour and cocoa. Beat 3 eggs and brown sugar with the whisk of the hand mixer for about 5 minutes until thick and creamy. Stir in the chocolate mixture. Stir in the flour mixture and 50 ml milk briefly. Fold in grated chocolate.
When the egg mixture has set, carefully place the dough on top and spread. Bake at the same temperature for another 20 minutes. Remove from the oven and allow to cool. Loosen the rim with a knife. Chill for several hours, preferably overnight. Turn the flan over onto a plate. Serve cut into pieces.