Possibly in the 17th century in Oporto.
Oporto has always lived from its trade and port. In the 18th century, codfish was one of the main products sold in this city, particularly to the English. The English were also involved very early on in selling and exporting Port wine, and since these two products were often transported together, a recipe making use of both naturally came up. This unusual combination appeared in this context bringing together two of the biggest treasures of Portuguese cuisine.
There are several slightly different versions of this recipe, but this is one of the most famous recipes.
Cut the soaked codfish into fillets removing all its skin and bones. Dip the fillets in flour and fry them in olive oil. Add crushed peeled tomatoes with no seeds, crushed garlic, chopped parsley, scalloped mushrooms, and a glass of Port wine. Let this mixture simmer for fifteen minutes while seasoning with salt and pepper to taste. Then place the fillets on a tray and pour tomato sauce. Sprinkle bread crumbs before putting it in the oven. Leave it in the oven for 15 minutes.
Serve this dish with sliced boiled potatoes rolled in eggs and fried in olive oil.
Guedes, F. (2001). As 100 maneiras de cozinhar Bacalhau e outros peixes. Publicações Dom Quixote
Ferrão, J.E.M.; Abreu, M.E.C.; Pinho, F.A.R.; Abreu, L.C. (1984) Tesouros da Cozinha Tradicional Portuguesa. Seleções do Reader’s Digest.
Cardoso, A.B. (2008). Os mercados do vinho do Porto e o sal português (1704-1747). A Articulação do sal português aos circuitos mundiais – antigos e novos consumos. Porto: Instituto de História Moderna – Universidade do Porto, p. 45-54.