Initialize recent date when closing periods with empty period list

(grafted from beed0d8fffcf8aa86ac5e6a2fe50adbfb7e5adcc)

--HG--
branch : 6.0
This commit is contained in:
Cédric Krier
2025-07-15 17:45:18 +02:00
parent 88562645b9
commit 66fcdffd5b
+3 -1
View File
@@ -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',