In 'Settings/Users/Access management', enable the right:
'Manage expiry dates of products'
In a stock order, for each product line, you can enter an expiration date.
You can also add the same date for all the lines of the stock order (at the bottom of the stock order page).
When you sold a product, you don’t record an expiry date. The oldest products are the first to be sold.
In 'Products/Expiration date', you will find a report with all your product batches ordered by expiration date, with remaining days before expiration and stock available.