For any partition λ let ω(λ) denote the four parameter weight ω(λ)=a∑i≥1⌈λ2i−1/2⌉b∑i≥1⌊λ2i−1/2⌋c∑i≥1⌈λ2i/2⌉d∑i≥1⌊λ2i/2⌋, and let ℓ(λ) be the length of λ. We show that the generating function ∑ω(λ)zℓ(λ), where the sum runs over all ordinary (resp. strict) partitions with parts each ≤N, can be expressed by the Al-Salam–Chihara polynomials. As a corollary we derive Andrews’ result by specializing some parameters and Boulet’s results by letting N→+∞. In the last section we prove a Pfaffian formula for the weighted sum ∑ω(λ)zℓ(λ)Pλ(x) where Pλ(x) is Schur’s P-function and the sum runs over all strict partitions.