Hello, I try to get the stock and the locations of a product but can't get it work.
#!/usr/bin/env python #-*- coding: utf-8 -*- import datetime from proteus import config, Model, Wizard from con_data import * config = config.set_xmlrpc(url) Product = Model.get('product.product') Location = Model.get('stock.location') Inventory = Model.get('stock.inventory') locations = Location.find([('type', '=', 'storage'), ('parent.name', '=' ,'Main Storage')]) locations = [l.id for l in locations] config.context['language'] = 'de_DE' config._context['locations'] = locations #config.context['stock_date_end'] = datetime.date(2015, 4, 7) def check_stock(product_code): (product,) = Product.find([('code', '=', product_code)]) print "product code:", product.code print "product name:", product.name print "product quantity:", product.quantity bylocation = Wizard('product.by_location', [product]) bylocation.execute("by_location") check_stock("PRODUCTCODE") assert state in self.states AssertionError I have never used state and have no clue how to use it. Would be nice to get some help. I have the correct stock but cant find the storage name. Thanks