Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
Remove ValueError from celery task
Krzysztof Świątek19db7c033dc2
diff --git a/saleor/graphql/discount/mutations.py b/saleor/graphql/discount/mutations.pyindex d018b3a34c..8fc8dd3a02 100644--- a/saleor/graphql/discount/mutations.py+++ b/saleor/graphql/discount/mutations.py@@ -270,12 +270,7 @@ class SaleUpdateMinimalVariantPriceMixin:def success_response(cls, instance):# Update the "minimal_variant_prices" of the associated, discounted# products (including collections and categories).- if (- instance.products.all().exists()- or instance.categories.all().exists()- or instance.collections.all().exists()- ):- update_products_minimal_variant_prices_of_discount_task.delay(instance.pk)+ update_products_minimal_variant_prices_of_discount_task.delay(instance.pk)return super().success_response(instance)diff --git a/saleor/product/utils/variant_prices.py b/saleor/product/utils/variant_prices.pyindex 14038b2379..d2cc2c649b 100644--- a/saleor/product/utils/variant_prices.py+++ b/saleor/product/utils/variant_prices.py@@ -58,18 +58,12 @@ def update_products_minimal_variant_prices_of_catalogues(if collection_ids:q_list.append(Q(collectionproduct__collection_id__in=collection_ids))# Asserting that the function was called with some ids- if not q_list:- raise ValueError(- "Provide at least one of the ID lists:\n"- "\tproduct_ids,\n"- "\tcategory_ids,\n"- "\tcollection_ids."- )- # Querying the products- q_or = reduce(operator.or_, q_list)- products = Product.objects.filter(q_or).distinct()+ if q_list:+ # Querying the products+ q_or = reduce(operator.or_, q_list)+ products = Product.objects.filter(q_or).distinct()- update_products_minimal_variant_prices(products)+ update_products_minimal_variant_prices(products)def update_products_minimal_variant_prices_of_discount(discount):