Skip to content

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

Do not count canceled quantity in quantity_fulfilled

Anna Siwikff674d022345
diff --git a/saleor/dashboard/order/forms.py b/saleor/dashboard/order/forms.py
index 04f0cedee6..74453d6b30 100644
--- a/saleor/dashboard/order/forms.py
+++ b/saleor/dashboard/order/forms.py
@@ -216,7 +216,7 @@ class CancelFulfillmentForm(forms.Form):
def clean(self):
data = super().clean()
- if not self.fulfillment.can_cancel():
+ if not self.fulfillment.can_edit():
raise forms.ValidationError(
pgettext_lazy(
'Cancel fulfillment form error',
diff --git a/saleor/order/models.py b/saleor/order/models.py
index 8087c5d32b..0f127132df 100644
--- a/saleor/order/models.py
+++ b/saleor/order/models.py
@@ -192,7 +192,8 @@ class OrderLine(models.Model):
@property
def quantity_fulfilled(self):
- lines = FulfillmentLine.objects.filter(order_line=self)
+ lines = FulfillmentLine.objects.filter(
+ order_line=self, fulfillment__status=FulfillmentStatus.FULFILLED)
return sum([line.quantity for line in lines])
def is_fulfilled(self):