Hi,
I’m running into an issue of negative quantities in some locations after closing a stock period.
The day 12-02-2026 I’ve closed a stock period at date 31-12-2025, I had locations with stock on them before the period date, which was moved after the period date, but before I’ve closed it, and those locations were deactivated, so, the stock they had <=31-12-2025 is not inserted into stock_period_cache, but the stock coming from this locations is being computed.
Is this the expected behaviour?
To fix it, with a simple query I can find all the locations deactivated in that time, so I guess I can compute their stock at the period date and insert those values into the stock_period_cache table, but I would also like to know if there is better alternatives.
Thanks in advance.
No, it should not be possible to deactivate locations with stock. Even there is a validation which prevents it.
For me you must check which locations are set as inactive, reactivat them and then simplify reopen and close the period again with the valid stock on it.
I did not deactivated a location with stock, the location had stock, I’ve moved it, then I’ve deactivated it, the thing is, the location is currently deactivated, so it is being skipped in the Period.close function, but it was not deactivated and had stock at the date of the period I want to close.
Then there is a bug in Tryton that should be reported and fixed. Could you please fill an issue?
As we do not have a way to know if the location was active at the date where the period was closed probably we should compute the stock of a deactivated location when closing a period. It will be great if you can provide a fix and/or a test scenario.