diff --git a/modules/stock/location.py b/modules/stock/location.py index c3f4c45953..a854c7bff4 100644 --- a/modules/stock/location.py +++ b/modules/stock/location.py @@ -406,7 +406,7 @@ class Location(DeactivableMixin, tree(), ModelSQL, ModelView): context = {} if (name == 'quantity' - and (trans_context.get('stock_date_end', datetime.date.max) + and ((trans_context.get('stock_date_end') or datetime.date.max) > Date_.today())): context['stock_date_end'] = Date_.today() @@ -494,7 +494,7 @@ class Location(DeactivableMixin, tree(), ModelSQL, ModelView): return Template(trans_context['product_template']) context = {} - if 'stock_date_end' in trans_context: + if trans_context.get('stock_date_end') is not None: # Use the last cost_price of the day context['_datetime'] = datetime.datetime.combine( trans_context['stock_date_end'], datetime.time.max)