Flipping the pose on the x axis is pasted incorrectly
The bones of your right leg are not well oriented, you must have duplicated your left leg instead of symmetrized it. So delete the right leg, bend a bit the left leg (always better to show Blender in what direction it is supposed to bend), symmetrize it. As you'll see you'll need to correct the IK Pole Angle of the right lower leg (0°). It should work.