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)
This commit is contained in:
Cédric Krier committed 2013-04-06 12:33:50 +02:00
1 parent 86985cbbc8
commit d36272a676
1 file changed
+4 -1
+4 -1
View File
@@ -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]