Subject: changeset in modules/stock_lot_sled:4.4 Avoid overflow when adding 
shelf life delay to stock date end
From: Cédric Krier <[email protected]>

changeset 369bc111eec6 in modules/stock_lot_sled:4.4
details: 
https://hg.tryton.org/modules/stock_lot_sled?cmd=changeset;node=369bc111eec6
description:
        Avoid overflow when adding shelf life delay to stock date end

        issue7883
        review50681002
        (grafted from 30d0ae631ea2c2a0c804e412b0140b77e67d7a74)
diffstat:

 stock.py |  8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)

diffs (18 lines):

diff -r 761bf5975ce5 -r 369bc111eec6 stock.py
--- a/stock.py  Mon May 01 21:05:41 2017 +0200
+++ b/stock.py  Mon Jan 14 23:59:08 2019 +0100
@@ -250,7 +250,13 @@
             config = Config(1)
             shelf_life_delay = config.get_multivalue('shelf_life_delay')
             if shelf_life_delay:
-                expiration_date = stock_date_end + shelf_life_delay
+                try:
+                    expiration_date = stock_date_end + shelf_life_delay
+                except OverflowError:
+                    if shelf_life_delay >= datetime.timedelta(0):
+                        expiration_date = datetime.date.max
+                    else:
+                        expiration_date = datetime.date.min
             else:
                 expiration_date = stock_date_end
 

Reply via email to