Fix search_quantity to compute product_by_location like get_quantity

(transplanted from 21e928e05ca37a6ce97164d0933463fa26922e40)
This commit is contained in:
Cédric Krier committed 2009-10-27 10:19:07 +01:00
1 parent 968ca6393a
commit c1674aa789
1 file changed
+13 -7
+13 -7
View File
@@ -81,15 +81,21 @@ class Product(OSV):
if not (context and context.get('locations') and domain):
return []
if (name != 'forecast_quantity') and context.get('stock_date_end'):
if context['stock_date_end'] != date_obj.today(cursor, user,
context=context):
context = context.copy()
del context['stock_date_end']
if name == 'forecast_quantity' and not context.get('stock_date_end'):
if name == 'quantity' and \
context.get('stock_date_end') and \
context.get('stock_date_end') > \
date_obj.today(cursor, user, context=context):
context = context.copy()
context['stock_date_end'] = datetime.date.max
context['stock_date_end'] = date_obj.today(
cursor, user, context=context)
if name == 'forecast_quantity':
context = context.copy()
context['forecast'] = True
if not context.get('stock_date_end'):
context['stock_date_end'] = datetime.date.max
pbl = self.products_by_location(
cursor, user, location_ids=context['locations'], with_childs=True,