def _can_use_cache(products, shop, customer):
 product_ids = [prod.id for prod in products]
 for supplier in Supplier.objects.all():
  for sp in ShopProduct.objects.filter(product__id__in=product_ids):
   if (not sp.is_orderable(supplier, customer=customer, quantity=sp.minimum_purchase_quantity)):
    return False
 return True

def _can_use_cache ( products , shop , customer ) : product_ids = [ prod . id for prod in products ] for supplier in Supplier . objects . all ( ) : for sp in ShopProduct . objects . filter ( product__id__in = product_ids ) : if ( not sp . is_orderable ( supplier , customer = customer , quantity = sp . minimum_purchase_quantity ) ) : return False return True
check whether the cached products can be still used if any of the products is no more orderable refetch the products .