Skip to content

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

Test statuses set instead of list of booleans

Artur Smęt0c1b58f7f7ac
diff --git a/saleor/dashboard/order/forms.py b/saleor/dashboard/order/forms.py
index c79b2dd15f..acc714e56d 100644
--- a/saleor/dashboard/order/forms.py
+++ b/saleor/dashboard/order/forms.py
@@ -210,8 +210,8 @@ class CancelGroupForm(forms.Form):
self.delivery_group.status = Status.CANCELLED
self.delivery_group.save()
other_groups = self.delivery_group.order.groups.all()
- statuses = other_groups.values_list('status', flat=True)
- if all(status == Status.CANCELLED for status in statuses):
+ statuses = set(other_groups.values_list('status', flat=True))
+ if statuses == {Status.CANCELLED}:
# Cancel whole order
self.delivery_group.order.status = Status.CANCELLED
self.delivery_group.order.save(update_fields=['status'])