details:   https://code.tryton.org/tryton/commit/54977ca200c0
branch:    default
user:      Cédric Krier <[email protected]>
date:      Tue Mar 04 22:05:19 2025 +0100
description:
        Remove only lot expiring in the future

        Closes #13901
diffstat:

 modules/stock_lot_sled/stock.py |  8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)

diffs (27 lines):

diff -r dbad6143d6d0 -r 54977ca200c0 modules/stock_lot_sled/stock.py
--- a/modules/stock_lot_sled/stock.py   Wed Jul 08 15:03:35 2026 +0200
+++ b/modules/stock_lot_sled/stock.py   Tue Mar 04 22:05:19 2025 +0100
@@ -320,7 +320,8 @@
                 if add_join(sub_query.from_, lot):
                     clause = (
                         (lot.shelf_life_expiration_date == Null)
-                        | (lot.shelf_life_expiration_date >= expiration_date))
+                        | (lot.shelf_life_expiration_date >= expiration_date)
+                        | (lot.shelf_life_expiration_date < today))
                     if sub_query.where:
                         sub_query.where &= clause
                     else:
@@ -338,10 +339,11 @@
                     for sub_query in find_queries(union_expired):
                         lot = Lot.__table__()
                         if add_join(sub_query.from_, lot):
-                            # only lot expiring during the period
+                            # only lot expiring during the future part of the
+                            # period
                             clause = (
                                 (lot.shelf_life_expiration_date
-                                    >= stock_date_start)
+                                    >= max(stock_date_start, today))
                                 & (lot.shelf_life_expiration_date
                                     < stock_date_end))
                             if sub_query.where:

Reply via email to