From 66fcdffd5bd7bc775f9280dafd50e1013839d99f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Tue, 15 Jul 2025 17:45:18 +0200 Subject: [PATCH] Initialize recent date when closing periods with empty period list (grafted from beed0d8fffcf8aa86ac5e6a2fe50adbfb7e5adcc) --HG-- branch : 6.0 --- modules/stock_lot_sled/stock.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/modules/stock_lot_sled/stock.py b/modules/stock_lot_sled/stock.py index 33b72d487b..93894e7539 100644 --- a/modules/stock_lot_sled/stock.py +++ b/modules/stock_lot_sled/stock.py @@ -379,7 +379,9 @@ class Period(metaclass=PoolMeta): # Don't allow to close a period if all products at this date # are not yet expired - recent_date = max(period.date for period in periods) + recent_date = max( + (period.date for period in periods), + default=datetime.date.min) today = Date.today() query = move.join(lot, 'INNER',