Right now to get the list of products along with their quantities I use:
ProductsByLocation = Model.get('stock.products_by_locations') with config.set_context ( locations = [warehouse.id] ): products = ProductsByLocation.find('') for product in products: print(product.quantity)
However, I have two issues:
- Looping over
product.quantityfor each product is pretty slow. In the client, it happens pretty quickly. How can I read the quantities faster?
- How can I set the ‘At Date’ in proteus like in the client (for Products by Locations)?
Any solution must also be usable for calculating
cost_value for the products.
PS. Searching for products and getting
cost_value is equally slow, since it’s done one by one over a loop.