This question has been flagged

In openerp v6 is possible to search by context parameter. For example in product list as context parameter we can choose 'warehouse' and the search shows the quantity of products in the warehouse chosen.  

I would like to get the same in odoo, so I decided to implement a wizard, this wizard asks for a warehouse and it should show the all product quantities belonging to that warehouse.

This is the code:


class search_product_balerce(osv.osv_memory):

_name = 'search.product.warehouse'

_description = 'Product search'

_columns = {

'warehouse_id': fields.many2one('stock.warehouse', string="Almacén"),

}

def search_warehouse(self, cr, uid, ids, context=None):

      if context is None:

         context = {}

      warehouse=self.read(cr, uid, ids, ['warehouse_id'], context=context)

      context.update({'warehouse_id' : warehouse[0]['warehouse_id'][0]})

      return {

                'view_type': 'list',

                'name': 'Resultado de búsqueda',

                'view_mode': 'list,form',

                'res_model': 'product.product',

                'type': 'ir.actions.act_window',

                'context': context

           }


As you can see, what I do es to update context wtih warehouse_id provided by user, I expect to get all products belinging to the warehouse chosen and its quantities, but I always get the same list of products, it seems like context parameter is not taking effect.


Any suggestions?

Avatar
Discard