Close stock period with unexpirated lots

Hi, I was doing some tests to start working with lots and when closing a period I see that it is not allowed if there are lots without expiring.
I would like to know why this is made like this, I don’t think it makes much sense because if my company works with a long expiration dates I could ‘’‘never’‘’ close periods.
Is there any reason that I have not thought of?
Thanks in advance.

Because product that expire are automatically removed from the stock quantity. So you can not pre-compute the stock quantity as long as there are still such product that did not expire.

So if I have a lot of a product that expires in 5 years, I am sentenced to not being able to pre-calculate the stock until then. Taking into account that during that time no more lot with the same condition has been introduced. I do not see when the stock period could be closed.

Wouldn’t it be a better option to disregard this for the cache (store even the expired ones), and delete this expired stock after querying the stock?

There are probably room for improvements (even if I do not understand what you propose).

That sounds like a very hard requirement. A product expiring in the future may not change the stock quantity until it is expired.

From what I understand, the current computation just ignores the expired lots, so the quantity of expired products is ignored and this adds the constraint above.

One option my be to compute the quantity of the expired products and substract them from the original query using an extra union. This will allow to store the right quantities in the periods and then have the right expired quantity computation.

Something like that is what I meant, I guess I have explained myself badly.

With the current limitation in a real scenario where lots of different products with different expiration dates are constantly being created, it would be practically impossible to close a stock period.