From d36272a676216f10f5f61b6c57fdbbe8774e4e80 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Sat, 6 Apr 2013 12:33:50 +0200 Subject: [PATCH] Catch OverflowError in get_quantity when appending timedelta If date is date.max then appending one day to it will raise an OverflowError. review761002 (transplanted from 01636875abb6aee9e9d390728f36a5efe476bc1f) --- product.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/product.py b/product.py index 7195abe71c..72d37a5061 100644 --- a/product.py +++ b/product.py @@ -668,7 +668,10 @@ class ProductQuantitiesByWarehouse(ModelSQL, ModelView): quantities[date] = Product.products_by_location( [warehouse_id], [product_id], with_childs=True, skip_zero=False)[(warehouse_id, product_id)] - date_start = date + datetime.timedelta(1) + try: + date_start = date + datetime.timedelta(1) + except OverflowError: + pass cumulate = 0 for date in dates: cumulate += quantities[date]