Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
Remove ununsed method on Product model
Damian W199c18b98a5c
diff --git a/saleor/product/models.py b/saleor/product/models.pyindex b2084b7734..e8414ba153 100644--- a/saleor/product/models.py+++ b/saleor/product/models.py@@ -293,17 +293,6 @@ class Product(SeoModel, ModelWithMetadata, PublishableModel):images = list(self.images.all())return images[0] if images else None- def get_price_range(- self, discounts: Optional[Iterable[DiscountInfo]] = None- ) -> Optional[MoneyRange]:- import opentracing-- with opentracing.global_tracer().start_active_span("get_price_range"):- if self.variants.all():- prices = [variant.get_price(discounts) for variant in self]- return MoneyRange(min(prices), max(prices))- return None-@staticmethoddef sort_by_attribute_fields() -> list:return ["concatenated_values_order", "concatenated_values", "name"]diff --git a/tests/api/test_product.py b/tests/api/test_product.pyindex 74a8b53cd8..f83f24a468 100644--- a/tests/api/test_product.py+++ b/tests/api/test_product.py@@ -468,7 +468,6 @@ def test_products_query_with_filter():assert product.is_published is Trueassert "Juice1" not in product.name- product.minimal_variant_price = Money("10.00", "USD")product.save()second_product = product@@ -798,7 +797,10 @@ def test_sort_products(user_api_client, product):product.updated_at = datetime.utcnow()product.save()ProductVariant.objects.create(- product=product, sku="1234", cost_price=Money("1.00", "USD"), price_amount=20+ product=product,+ sku="1234",+ cost_price=Money("1.00", "USD"),+ price_amount=Decimal(20),)query = SORT_PRODUCTS_QUERYdiff --git a/tests/test_product.py b/tests/test_product.pyindex f4cfd4d0a9..f7612e2623 100644--- a/tests/test_product.py+++ b/tests/test_product.py@@ -4,7 +4,7 @@ from unittest.mock import patchimport pytestfrom freezegun import freeze_time-from prices import Money, MoneyRange+from prices import Moneyfrom saleor.account import events as account_eventsfrom saleor.product import models@@ -98,30 +98,6 @@ def test_get_price(assert price.amount == expected_price-def test_product_get_price_range_with_variants(product_type, category):- product = models.Product.objects.create(- product_type=product_type, category=category- )- product.variants.create(sku="2", price=Money("20.00", "USD"))- product.variants.create(sku="3", price=Money("11.00", "USD"))-- price = product.get_price_range()-- start = Money("11.00", "USD")- stop = Money("20.00", "USD")- assert price == MoneyRange(start=start, stop=stop)---def test_product_get_price_range_no_variants(product_type, category):- product = models.Product.objects.create(- product_type=product_type, category=category- )-- price = product.get_price_range()-- assert price is None--def test_product_get_price_do_not_charge_taxes(product_type, category, discount_info):product = models.Product.objects.create(product_type=product_type, category=category, charge_taxes=False,diff --git a/tests/test_product_minimal_variant_price.py b/tests/test_product_minimal_variant_price.pyindex 1290ef1c64..884dbe9400 100644--- a/tests/test_product_minimal_variant_price.py+++ b/tests/test_product_minimal_variant_price.py@@ -91,7 +91,6 @@ def test_product_variant_objects_create_updates_minimal_variant_price(product):def test_product_variant_objects_bulk_create_updates_minimal_variant_price(product):- product.refresh_from_db()assert product.minimal_variant_price == Money("10.00", "USD")ProductVariant.objects.bulk_create([