We present a new chemical evolution model meant to be a first step in the self-consistent study of both optical and X-ray properties of elliptical galaxies. Detailed cooling and heating processes in the interstellar medium are taken into account using a mono-phase one-zone treatment which allows a more reliable modelling of the galactic wind regime with respect to previous work. The model successfully reproduces simultaneously the mass-metallicity, colour-magnitude, the L_X - L_B and the L_X - T relations, as well as the observed trend of the [Mg/Fe] ratio as a function of sigma, by adopting the prescriptions of Pipino & Matteucci (2004) for the gas infall and star formation timescales. We found that a late secondary accretion of gas from the environment plays a fundamental role in driving the L_X - L_B and L_X - T relations and can explain their large observational scatter. The iron discrepancy, namely the too high predicted iron abundance in X-ray haloes of ellipticals compared to observations, still persists. On the other hand, we predict [O/Fe] in the ISM which is in good agreement with the most recent observations. We suggest possible mechanisms acting on a galactic scale which may solve the iron discrepancy. In particular, mixing of gas driven by AGNs may preserve the gas mass (and thus the X-ray luminosity) while diluting the iron abundance. New predictions for the amounts of iron, oxygen and energy ejected into the intracluster medium (ICM) are presented and we conclude that Type Ia supernovae (SNe Ia) play a fundamental role in the ICM enrichment. SNe Ia activity, in fact, may power a galactic wind lasting for a considerable amount of the galactic lifetime, even in the case for which the efficiency of energy transfer into the ISM per SN Ia event is less than unity.