def METHOD_NAME(self, category_ids):
    if not isinstance(category_ids, list):
        category_ids = [category_ids]
    order = self._context.get('products_order', '')
    only_with_stock = self._context.get('only_with_stock', False)
    category_type = self._context.get('category_type', False)
    if category_type == 'public_category':
        domain = [('public_categ_ids', 'in', category_ids)]
    else:
        domain = [('categ_id', 'in', category_ids)]
    if only_with_stock:
        domain.append(('qty_available', '>', 0))
    products = self.env[self.env.product_type].search(
        domain, order=order)
    return products