Odoo Help


Search by context parameter in wizard

Diego Calzadilla
on 6/23/15, 12:34 PM 591 views

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?

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.


Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

1 follower(s)


Asked: 6/23/15, 12:34 PM
Seen: 591 times
Last updated: 6/23/15, 12:34 PM