Subject: changeset in modules/stock_lot_sled:4.6 Avoid overflow when adding shelf life delay to stock date end From: Cédric Krier <[email protected]>
changeset 326d5c67167b in modules/stock_lot_sled:4.6 details: https://hg.tryton.org/modules/stock_lot_sled?cmd=changeset;node=326d5c67167b 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 38b6fcaac7dd -r 326d5c67167b stock.py --- a/stock.py Mon Oct 30 15:23:47 2017 +0100 +++ 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
