Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
4287 Lượt xem

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?

Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
1
thg 10 17
3842
0
thg 8 17
3399
0
thg 3 15
4465
0
thg 4 24
1695
1
thg 2 24
3040