2015-06-19 11:46 GMT+02:00 TPH <[email protected]>:
> Hello
>
> I can't find the correct way to show products by location using Proteus
> and Tryton 3.2 and need some help please:
>
> xmlrpc_config = proteus.config.set_xmlrpc(url)
> User = Model.get('res.user')
> xmlrpc_config.context['language'] = 'de_de'
> xmlrpc_config._context = User.get_preferences(True, config.context)
> xmlrpc_config._context['stock_date_end'] = datetime.datetime.today()
>
> Location = Model.get('stock.location')
> Product = Model.get('product.product')
>
> (location,) = Location.find(['name', '=', 'LOCATIONNAME'])
>
>
> stock_by_location_wizzard = Wizard('stock.products_by_locations', [
> location])
> stock_by_location_wizzard.execute("open")
>
I don't know if it's possible to do with wizard.
What I do is prepare the context, that is what the wizard does:
with config.set_context({'locations': [location.id], 'stock_date_end': today}):
products_with_stock = Product.find([('quantity', '>', 0)])
for product in products:
print product.quantity
--
Guillem Barba
http://www.guillem.alcarrer.net