Skip to content

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

Do not return cancelled fulfillments in me API

Unknown38acac6d8fe7
diff --git a/saleor/graphql/account/schema.py b/saleor/graphql/account/schema.py
index f6d9872ade..2b21154d51 100644
--- a/saleor/graphql/account/schema.py
+++ b/saleor/graphql/account/schema.py
@@ -38,6 +38,7 @@ class AccountQueries(graphene.ObjectType):
@login_required
def resolve_me(self, info):
+ info.context.kwargs = dict(ignore_cancelled_fulfillment=True)
return info.context.user
@permission_required('account.manage_staff')
diff --git a/saleor/graphql/order/types.py b/saleor/graphql/order/types.py
index 1f3bab2ea5..c3004e778f 100644
--- a/saleor/graphql/order/types.py
+++ b/saleor/graphql/order/types.py
@@ -3,6 +3,7 @@ import graphene_django_optimizer as gql_optimizer
from graphene import relay
from ...order import models
+from ...order.models import FulfillmentStatus
from ...product.templatetags.product_images import get_product_image_thumbnail
from ..account.types import User
from ..core.connection import CountableDjangoObjectType
@@ -265,7 +266,12 @@ class Order(CountableDjangoObjectType):
@staticmethod
def resolve_fulfillments(self, info):
- return self.fulfillments.all().order_by('pk')
+ context_kwargs = getattr(info.context, 'kwargs', {})
+ if context_kwargs.get('ignore_cancelled_fulfillment', False):
+ qs = self.fulfillments.exclude(status=FulfillmentStatus.CANCELED)
+ else:
+ qs = self.fulfillments.all()
+ return qs.order_by('pk')
@staticmethod
def resolve_lines(self, info):