Manage empty stock end date values on location quantities

Closes #12289
This commit is contained in:
Sergi Almacellas Abellana
2023-05-25 15:55:40 +02:00
parent b769623b79
commit c594bc67df
+2 -2
View File
@@ -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)