From f1dd2a200488a9c32bfd7645898bb376c6d47257 Mon Sep 17 00:00:00 2001 From: Raimon Esteve Date: Thu, 31 Aug 2017 09:49:25 +0200 Subject: [PATCH] Set with_childs to True to calculate qty with childs Since stock-1424cdd76ac2 set with_childs to False when there are more thant one warehause --- product.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/product.py b/product.py index 7eb1371..e6570fb 100644 --- a/product.py +++ b/product.py @@ -24,7 +24,7 @@ class Template: 'locations' not in Transaction().context): warehouses = Location.search([('type', '=', 'warehouse')]) location_ids = [w.storage_location.id for w in warehouses] - with Transaction().set_context(locations=location_ids): + with Transaction().set_context(locations=location_ids, with_childs=True): return super(Template, self).sum_product(name) return super(Template, self).sum_product(name) @@ -51,7 +51,8 @@ class Product: if not context.get('locations'): warehouses = Location.search([('type', '=', 'warehouse')]) location_ids = [w.storage_location.id for w in warehouses] - with Transaction().set_context(locations=location_ids, stock_date_end=today): + with Transaction().set_context(locations=location_ids, + stock_date_end=today, with_childs=True): return cls._get_quantity(products, name, location_ids, products) # return super (with locations in context) return super(Product, cls).get_quantity(products, name)