Subject: changeset in modules/stock_lot_sled:5.0 Avoid overflow when adding shelf life delay to stock date end From: Cédric Krier <[email protected]>
changeset 034bb0779970 in modules/stock_lot_sled:5.0 details: https://hg.tryton.org/modules/stock_lot_sled?cmd=changeset;node=034bb0779970 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 d30bc28a5867 -r 034bb0779970 stock.py --- a/stock.py Sat Jan 26 01:12:04 2019 +0100 +++ b/stock.py Mon Jan 14 23:59:08 2019 +0100 @@ -248,7 +248,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
