Am 02.05.2015 um 18:50 schrieb Cédric Krier:
On 01 May 06:21, TPH wrote:
You need to set the product in context before find locations
Product = Model.get('product.product')
Location = Model.get('stock.location')
(product,) = Product.find([('code', '=', product_code)])
config.context['product'] = product.id
(location,) = Location.find([('type', '=', 'storage'), ("name", "=",
location_name)])
config._context['locations'] = [location.id]
You must not set the context like that but you must use the context
manager of proetus.config.set_context
Thanks
This part is working. If I not set "config._context['locations']"
product stock is also 0.
If I try "proteus.config.set_context['product'] = product.id" is get result:
AttributeError: 'module' object has no attribute 'set_context'
Same result. Product quantity shown. Location quantity not.
regards