Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
Drop ProductSales type
Marcin Gębalada9c569a8f11
diff --git a/saleor/graphql/product/schema.py b/saleor/graphql/product/schema.pyindex 73e0a0bd73..46d9f7ff15 100644--- a/saleor/graphql/product/schema.py+++ b/saleor/graphql/product/schema.py@@ -23,7 +23,7 @@ from .resolvers import (resolve_report_product_sales)from .types import (ReportingPeriod, Category, Collection, Product, Attribute, ProductType,- ProductVariant, ProductSales, StockAvailability)+ ProductVariant, StockAvailability)class ProductQueries(graphene.ObjectType):@@ -69,7 +69,7 @@ class ProductQueries(graphene.ObjectType):ProductVariant, ids=graphene.List(graphene.ID),description='Lookup multiple variants by ID')report_product_sales = DjangoFilterConnectionField(- ProductSales,+ ProductVariant,period=graphene.Argument(ReportingPeriod, required=True),description='List of top selling products.')diff --git a/saleor/graphql/product/types.py b/saleor/graphql/product/types.pyindex 35820268ed..4141b1f659 100644--- a/saleor/graphql/product/types.py+++ b/saleor/graphql/product/types.py@@ -137,6 +137,7 @@ class ProductVariant(CountableDjangoObjectType):cost_price = graphene.Field(Money, description='Cost price of the variant.')margin = graphene.Int(description='Gross margin percentage value.')+ quantity_ordered = graphene.Int(description='Total quantity ordered.')class Meta:description = """Represents a version of a product such as different@@ -164,18 +165,6 @@ class ProductVariant(CountableDjangoObjectType):def resolve_price_override(self, info):return self.price_override--class ProductSales(ProductVariant):- quantity_ordered = graphene.Int(description='Total quantity ordered.')-- class Meta:- description = """Provides information about sales of a product, such- as total quantity ordered or product's revenue."""- exclude_fields = ['variant_images']- interfaces = [relay.Node]- model = models.ProductVariant- filter_fields = ['id']-def resolve_quantity_ordered(self, info):# This field is added through annotation when using the# `resolve_top_products` resolver.