Heat the oil in a medium saucepan and fry the onions over a low heat for 15 minutes, until soft and caramelised. Add the sugar and vinegar and cook for a further 5 minutes.
Sprinkle the flour into the pan and stir until the flour has been incorporated and made a thick paste. Add the stock and bring to a boil whilst stirring, then lower the heat and simmer for a