Skip to content

Saleor Core: the high performance, composable, headless commerce API.

Define `only_fields` for stock type

Mira Szewczyk22fd2e5ccee2
diff --git a/saleor/graphql/schema.graphql b/saleor/graphql/schema.graphql
index 5533af8e00..8953a8529c 100644
--- a/saleor/graphql/schema.graphql
+++ b/saleor/graphql/schema.graphql
@@ -4144,11 +4144,11 @@ input StaffUserInput {
}
type Stock implements Node {
- id: ID!
warehouse: Warehouse!
productVariant: ProductVariant!
quantity: Int!
quantityAllocated: Int!
+ id: ID!
available: Int
}
diff --git a/saleor/graphql/warehouse/types.py b/saleor/graphql/warehouse/types.py
index 023edd3b9c..9bf3a45284 100644
--- a/saleor/graphql/warehouse/types.py
+++ b/saleor/graphql/warehouse/types.py
@@ -72,6 +72,7 @@ class Stock(CountableDjangoObjectType):
description = "Represents stock."
model = models.Stock
interfaces = [graphene.relay.Node]
+ only_fields = ["warehouse", "product_variant", "quantity", "quantity_allocated"]
@staticmethod
@permission_required(StockPermissions.MANAGE_STOCKS)