Unfortunately, this is a known situation and the airline was right, despite the Schengen code.
He renewed it a few days before taking the flight so he got a paper proving that he did it and that is supposedly mean to avoid this kind of situation.
Officially, he didn't. You renew your ID as soon as you get a new printed document with a new expiration date that is in the future. Some countries allow
naive procedures for renewing IDs in order to save money. The idea is that if you didn't change your appearence significantly you can continue using the old photo ID, and government can save on the cost of giving you a new ID, which they pay for.
I know a number of cases of rejected passengers when their ID is extended by the government to up to 15 years, as explained in the French Ministry Of Interior Affairs. Not all foreign government accept this practice.
Espagne appars in
Pays dont les autorités n’ont pas officiellement transmis leur position quant à l’acceptation de la carte d’identité dont la validité est prolongée de 5 ans
Countries whose authorities have not officially transmitted their position on the acceptance of the identity card, the validity of which is extended by 5 years
That is trash when crossing the border, even if your local authorities allow and it is socially acceptable. An expired document is not a document, it's like it doesn't exist.
One might blame the government officer having opted to issue a sheet of paper rather than a new paper/plastic ID.
One consideration: according to Schengen rules, there theoretically should be no systematic ID check on travelers. In fact, this occurs on land borders. The truth is that the PNR regulation in Europe requires passengers to be systematically identified when they board a plane, regardless of their destination. Their name is kept for 6 months in the airline database should government authorities issue an investigation to retrieve the list. After that, they must be anonymized.