Current and planned observations of the cosmic microwave background (CMB) polarization anisotropies, with their ever increasing number of detectors, have reached a potential accuracy that requires a very demanding control of systematic effects. While some of these systematics can be reduced in the design of the instruments, others will have to be modeled and hopefully accounted for or corrected a posteriori. We propose QuickPol, a quick and accurate calculation of the full effective beam transfer function and of temperature to polarization leakage at the power spectra level, as induced by beam imperfections and mismatches between detector optical and electronic responses. All the observation details such as exact scanning strategy, imperfect polarization measurements, and flagged samples are accounted for. Our results are validated on Planck high frequency instrument (HFI) simulations. We show how the pipeline can be used to propagate instrumental uncertainties up to the final science products, and could be applied to experiments with rotating half-wave plates.