Comment 5 for bug 362280

Revision history for this message
Marcel van der Boom (HS-Development BV) (mrb) wrote :

Workaround:
  # Second level _inherits, break search. See bug #362280
  # This workaround only works in the fields are also in product.product
  def search(self, cr, uid, args, offset=0, limit=None, order=None, context={}, count=False):
      # If there is nothing in args, dont bother
      if len(args):
          # Do the search on products and get their ids, make sure count is
          # false, otherwise resultsets larger than limit will produce an error
          product_ids = self.pool.get('product.product').search(cr, uid, args, offset, limit, order,context,False)

          # Use the product ids to search the corresponding
          args = [('product_id','in',product_ids)]

      return super(YOURCLASSNAME,self).search(cr,uid,args,offset,limit,order,context,count)