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