Skip to content

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

quickfix for created resolver in productvariant (#10072)

Jakub6c77053a9cbe
diff --git a/saleor/graphql/product/tests/test_variant.py b/saleor/graphql/product/tests/test_variant.py
index 91c0366b7d..41bde00410 100644
--- a/saleor/graphql/product/tests/test_variant.py
+++ b/saleor/graphql/product/tests/test_variant.py
@@ -95,6 +95,7 @@ def test_fetch_variant(
unit
value
}
+ created
}
}
"""
@@ -117,6 +118,7 @@ def test_fetch_variant(
content = get_graphql_content(response)
data = content["data"]["productVariant"]
assert data["name"] == variant.name
+ assert data["created"] == variant.created_at.isoformat()
stocks_count = variant.stocks.count()
assert len(data["deprecatedStocksByCountry"]) == stocks_count
diff --git a/saleor/graphql/product/types/products.py b/saleor/graphql/product/types/products.py
index c9d4e1e87e..3f189f4786 100644
--- a/saleor/graphql/product/types/products.py
+++ b/saleor/graphql/product/types/products.py
@@ -353,8 +353,8 @@ class ProductVariant(ChannelContextTypeWithMetadata, ModelObjectType):
model = models.ProductVariant
@staticmethod
- def resolve_created(root: models.ProductVariant, _info):
- return root.created_at
+ def resolve_created(root: ChannelContext[models.ProductVariant], _info):
+ return root.node.created_at
@staticmethod
def resolve_channel(root: ChannelContext[models.Product], _info):