Why can't a stock period be closed if not all products are expired?

The stock_lot_sled module has this check:

https://hg.tryton.org/modules/stock_lot_sled/file/tip/stock.py#l380

That prevents closing a period if there are moves for lots whose shelf life expiration date is later than today.

We’re facing a problem with a company that produces species (among many other stuff). Species have +3 years of shelf life so it prevents us from closing the 2019 period, for example.

I also understand that it can be a problem with products that have shorter shelf life periods but a very large number of stock moves.

So is that check really a good idea? Would at least be possible to make that check optional or find a way to make it possible for a module to override it without the need of patching?

It is strictly needed because the expiration is based on the virtual disappearance of the incoming move so the stock quantity can not be stored.
It could only be improved if we check only for lot with quantity at the closing date (maybe just on today) (on storage location).

Thanks for answering, yet I don’t understand what you mean.

Isn’t the problem solved if we add “skip_lot_sled” to the context when computing the quantities for closing?

No it is not because in any case the expired move will not be ignored.