From e15a497a3178da6aff9291ebd27ab45d50b60a37 Mon Sep 17 00:00:00 2001 From: Laetitia Gangloff Date: Wed, 5 Aug 2015 11:18:12 +0200 Subject: [PATCH] [FIX] stock_available : update sublocations computation --- stock_available/product.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/stock_available/product.py b/stock_available/product.py index 9e4f233b0ae7..199a8ef63787 100644 --- a/stock_available/product.py +++ b/stock_available/product.py @@ -36,16 +36,16 @@ def _immediately_usable_qty(self): stock_location_obj = self.env['stock.location'] internal_locations = stock_location_obj.search([ ('usage', '=', 'internal')]) - sublocation_ids = [] + sublocations = self.env['stock.location'] for location in internal_locations: - sublocation_ids.append(self.env['stock.location'].search( - [('id', 'child_of', location.id)]).ids) + sublocations += stock_location_obj.search( + [('id', 'child_of', location.id)]) for product_template in self: products = self.env['product.product'].search([ ('product_tmpl_id', '=', product_template.id)]) quant_obj = self.env['stock.quant'] quants = quant_obj.search([ - ('location_id', 'in', sublocation_ids), + ('location_id', 'in', sublocations.ids), ('product_id', 'in', products.ids), ('reservation_id', '=', False)]) availability = 0