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
This commit is contained in:
Raimon Esteve 2017-08-31 09:49:25 +02:00
parent 276366c042
commit f1dd2a2004
1 changed files with 3 additions and 2 deletions

View File

@ -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)