From f95485591cf5ef8bf5641c22ff158a5977889e05 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Wed, 4 Feb 2009 13:57:11 +0100 Subject: [PATCH] Check context value in get_quantity on stock.location Verify that the product id from context has a real product record --- location.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/location.py b/location.py index 3f69149e9e..47d9315f0f 100644 --- a/location.py +++ b/location.py @@ -131,7 +131,14 @@ class Location(OSV): if (not context.get('product')) \ or not (isinstance(context['product'], (int, long))): - return dict([(i,0) for i in ids]) + return dict([(i, 0) for i in ids]) + + ctx = context.copy() + ctx['active_test'] = False + if not product_obj.search(cursor, user, [ + ('id', '=', context['product']), + ], context=ctx): + return dict([(i, 0) for i in ids]) if name == 'quantity' and \ context.get('stock_date_end') > \