Soak salted cod in cold water overnight or for a few hours. Drain water, repeat. Heat a large pot of water until boiling. Cook cod for 5 minutes; drain and cool, leaving cod in large pieces. Set aside.
Preheat oven to 375 degrees F (190 degrees C).
In an 8x11 casserole dish, layer half the potato slices, all of the cod, and all of the onions. Top with remaining potato slices. In a small bowl, mix together olive oil, garlic, parsley, pepper flakes, paprika, and tomato sauce. Pour evenly over casserole.
Bake in preheated oven for 45 minutes, or until potatoes are tender.